Skip to content

Instantly share code, notes, and snippets.

@apgapg
Created March 29, 2022 17:48
Show Gist options
  • Save apgapg/feeb455c681f1dc33dd3ac108f7a8c1d to your computer and use it in GitHub Desktop.
Save apgapg/feeb455c681f1dc33dd3ac108f7a8c1d to your computer and use it in GitHub Desktop.
Pie Chart with base color support
class HomePage2 extends StatelessWidget {
HomePage2({Key? key}) : super(key: key);
final dataMap = <String, double>{
"Flutter": 5,
};
final colorList = <Color>[
Colors.greenAccent,
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Pie Chart 1"),
),
body: Container(
padding: EdgeInsets.symmetric(horizontal: 16),
child: PieChart(
dataMap: dataMap,
chartType: ChartType.ring,
baseChartColor: Colors.grey[300]!,
colorList: colorList,
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment