Created
May 28, 2021 10:21
-
-
Save imaNNeo/6bc1afc3b292353ee6d7ffabba617fe5 to your computer and use it in GitHub Desktop.
Dynamid PieChart size
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:fl_chart/fl_chart.dart'; | |
import 'package:flutter/material.dart'; | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'FlChart Demo', | |
showPerformanceOverlay: false, | |
theme: ThemeData( | |
primaryColor: const Color(0xff262545), | |
primaryColorDark: const Color(0xff201f39), | |
brightness: Brightness.dark, | |
), | |
home: Scaffold( | |
body: SafeArea( | |
child: LayoutBuilder( | |
builder: (context, BoxConstraints constrain) { | |
final shortSize = constrain.biggest.shortestSide / 2; | |
return PieChart( | |
PieChartData( | |
sections: [ | |
PieChartSectionData(value: 10, radius: shortSize), | |
PieChartSectionData(value: 10, radius: shortSize), | |
PieChartSectionData(value: 10, radius: shortSize), | |
], | |
centerSpaceRadius: 0, | |
), | |
); | |
}, | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Made for this issue