Articles in this section
Category / Section

How to set a graphical frame image as a background for the radial gauge widget

1 min read

Description

This article describes how to set a graphical frame image as background for the radial gauge widget.

Solution

You can show the graphical frame image as background for radial gauge with the backgroundImage property of radial axis.

The backgroundImage property of radial axis is a type of ImageProvider. Therefore, you can set the following types of image for backgroundImage property:

  1. AssetImage
  2. NetworkImage
  3. FileImage
  4. MemoryImage

The following steps explain how to set an AssetImage to backgroundImage property of the axis:

Step 1: Create a folder named as images and copy the desired image.

add image folder

Step 2:  To access the image added in the sample, you need to define the folder, which contains the image as assets in pubspec.yaml as like the following snippet.

include assets

Step 3:  Create the radial gauge widget and set the corresponding image, which needs to be displayed as the background image for the radial axis to its backgroundImage property as demonstrated in the following code example.

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Center(
        child: Container(
            child: SfRadialGauge(
      axes: <RadialAxis>[
        RadialAxis(
          backgroundImage: const AssetImage('images/dark_theme_gauge.png'),
        )
      ],
    ))),
  );
}

 

Output:

 

Graphical frame background

 

You can download the demo sample from this link.

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied