Skip to content

Instantly share code, notes, and snippets.

@imaNNeo
Created May 28, 2021 10:21
Show Gist options
  • Save imaNNeo/6bc1afc3b292353ee6d7ffabba617fe5 to your computer and use it in GitHub Desktop.
Save imaNNeo/6bc1afc3b292353ee6d7ffabba617fe5 to your computer and use it in GitHub Desktop.
Dynamid PieChart size
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,
),
);
},
),
),
),
);
}
}
@imaNNeo
Copy link
Author

imaNNeo commented May 28, 2021

Made for this issue

ezgif com-gif-maker

@masfranzhuo
Copy link

very helpful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment