Created
August 2, 2025 21:18
-
-
Save imaNNeo/421a27325bfb4aaae60ef453a3c934de to your computer and use it in GitHub Desktop.
fl_chart with limited 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(const MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
const MyApp({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return const MaterialApp( | |
home: HomePage(), | |
); | |
} | |
} | |
class HomePage extends StatelessWidget { | |
const HomePage({super.key}); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
body: SizedBox( | |
width: 200, | |
height: 200, | |
child: LineChart( | |
LineChartData( | |
lineBarsData: [ | |
LineChartBarData( | |
spots: const [ | |
FlSpot(0, 1), | |
FlSpot(1, 3), | |
FlSpot(2, 2), | |
FlSpot(3, 4), | |
], | |
isCurved: true, | |
barWidth: 4, | |
belowBarData: BarAreaData(show: true), | |
), | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Author
imaNNeo
commented
Aug 2, 2025

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