From 3c6b97bc485fc6c1f96ba4622399416e5322d98f Mon Sep 17 00:00:00 2001 From: imaNNeoFighT Date: Thu, 20 Jul 2023 16:05:49 +0200 Subject: [PATCH 1/7] Update FUNDING.yml to add my Github sponsor --- .github/FUNDING.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index f7642732d5..bce2830617 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ +github: [imaNNeo] custom: ["https://www.buymeacoffee.com/fl_chart"] From 9cea79f9d7be6f537062f03b29cfb1e45f2322b5 Mon Sep 17 00:00:00 2001 From: imaNNeoFighT Date: Fri, 21 Jul 2023 00:18:06 +0200 Subject: [PATCH 2/7] Update donation links --- README.md | 10 ++++------ pubspec.yaml | 1 + 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c715b5c468..da3693b25a 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,11 @@ We suggest you to check samples source code. ### Donation Your donation **motivates** me to work more on the **fl_chart** and resolve more issues. -You can buy me a coffee! +There are multiple ways to donate me: - - -Or if you are a fan of crypto, you can donate me Bitcoins here: - -`1L7ghKdcmgydmUJAnmYmMaiVjT1LoP4a45` +1. You can be my sponsor on [GitHub](https://github.com/sponsors/imaNNeo) (This is the most reliable way to donate me) +2. You can buy me a coffee! +3. Or if you are a fan of crypto, you can donate me Bitcoins here: `1L7ghKdcmgydmUJAnmYmMaiVjT1LoP4a45` ### Contributing ##### :beer: Pull requests are welcome! diff --git a/pubspec.yaml b/pubspec.yaml index cd5d197d3b..f46c8a296f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,6 +10,7 @@ environment: sdk: ^3.0.0 funding: + - https://github.com/sponsors/imaNNeo - https://www.buymeacoffee.com/fl_chart dependencies: From 114fc7c73f1dc66a82c762e49f844506a11e4a3c Mon Sep 17 00:00:00 2001 From: Iman Khoshabi Date: Mon, 24 Jul 2023 19:30:05 +0200 Subject: [PATCH 3/7] Update README.md --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index da3693b25a..2cbee33fec 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,8 @@ -💥 FL Chart is a highly customizable Flutter chart library that supports Line Chart, Bar Chart, Pie Chart, Scatter Chart, and Radar Chart. 💥 +📊 FL Chart is a highly customizable Flutter chart library that supports **[Line Chart](https://app.flchart.dev/#/line)**, **[Bar Chart](https://app.flchart.dev/#/bar)**, **[Pie Chart](https://app.flchart.dev/#/pie)**, **[Scatter Chart](https://app.flchart.dev/#/scatter)**, and **[Radar Chart](https://app.flchart.dev/#/radar)**. - +✅ Do you want to **motivate me to work more on fl_chart?** You can **[donate me](https://github.com/imaNNeo/fl_chart/edit/master/README.md#donation)** ;) + +![FL Chart Logo](https://github.com/imaNNeo/fl_chart/raw/master/repo_files/images/landing_logo.jpg) [![pub package](https://img.shields.io/pub/v/fl_chart.svg)](https://pub.dartlang.org/packages/fl_chart) [![codecov](https://codecov.io/gh/imaNNeo/fl_chart/branch/master/graph/badge.svg?token=XBhsIZBbZG)](https://codecov.io/gh/imaNNeo/fl_chart) @@ -8,12 +10,11 @@ GitHub Repo stars GitHub contributors GitHub closed issues +![GitHub Sponsors](https://img.shields.io/github/sponsors/imaNNeo) Buy Me A Coffee donate button -![FL Chart Logo](https://github.com/imaNNeo/fl_chart/raw/master/repo_files/images/landing_logo.jpg) - ### Chart Types |LineChart |BarChart |PieChart | From 1a40184b3fa1daf90c69b6886dad611b48e2f44e Mon Sep 17 00:00:00 2001 From: imaNNeoFighT Date: Mon, 31 Jul 2023 23:52:34 +0200 Subject: [PATCH 4/7] Add documentation button to the menu_rows --- example/lib/presentation/menu/app_menu.dart | 7 +++ example/lib/presentation/menu/menu_row.dart | 53 +++++++++++++++++++-- example/lib/urls.dart | 5 ++ example/lib/util/app_helper.dart | 3 ++ 4 files changed, 63 insertions(+), 5 deletions(-) diff --git a/example/lib/presentation/menu/app_menu.dart b/example/lib/presentation/menu/app_menu.dart index 26ece24c5b..179a3ee622 100644 --- a/example/lib/presentation/menu/app_menu.dart +++ b/example/lib/presentation/menu/app_menu.dart @@ -1,6 +1,7 @@ import 'package:fl_chart_app/presentation/resources/app_resources.dart'; import 'package:fl_chart_app/util/app_helper.dart'; import 'package:flutter/material.dart'; +import 'package:url_launcher/url_launcher.dart'; import 'fl_chart_banner.dart'; import 'menu_row.dart'; @@ -48,6 +49,12 @@ class AppMenuState extends State { onTap: () { widget.onItemSelected(position, menuItem); }, + onDocumentsTap: () async { + final url = Uri.parse(menuItem.chartType.documentationUrl); + if (await canLaunchUrl(url)) { + await launchUrl(url); + } + }, ); }, itemCount: widget.menuItems.length, diff --git a/example/lib/presentation/menu/menu_row.dart b/example/lib/presentation/menu/menu_row.dart index 9a402b449e..ee634913bc 100644 --- a/example/lib/presentation/menu/menu_row.dart +++ b/example/lib/presentation/menu/menu_row.dart @@ -2,11 +2,12 @@ import 'package:fl_chart_app/presentation/resources/app_resources.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -class MenuRow extends StatelessWidget { +class MenuRow extends StatefulWidget { final String text; final String svgPath; final bool isSelected; final VoidCallback onTap; + final VoidCallback onDocumentsTap; const MenuRow({ Key? key, @@ -14,16 +15,29 @@ class MenuRow extends StatelessWidget { required this.svgPath, required this.isSelected, required this.onTap, + required this.onDocumentsTap, }) : super(key: key); - bool get _showSelectedState => isSelected; + @override + State createState() => _MenuRowState(); +} + +class _MenuRowState extends State { + bool get _showSelectedState => widget.isSelected; + + bool isHovered = false; @override Widget build(BuildContext context) { return Material( color: Colors.transparent, child: InkWell( - onTap: onTap, + onHover: (bool hovered) { + setState(() { + isHovered = hovered; + }); + }, + onTap: widget.onTap, child: SizedBox( height: AppDimens.menuRowHeight, child: Row( @@ -32,7 +46,7 @@ class MenuRow extends StatelessWidget { width: 36, ), SvgPicture.asset( - svgPath, + widget.svgPath, width: AppDimens.menuIconSize, height: AppDimens.menuIconSize, colorFilter: @@ -42,12 +56,17 @@ class MenuRow extends StatelessWidget { width: 18, ), Text( - text, + widget.text, style: TextStyle( color: _showSelectedState ? AppColors.primary : Colors.white, fontSize: AppDimens.menuTextSize, ), ), + Expanded(child: Container()), + _DocumentationIcon(onTap: widget.onDocumentsTap), + const SizedBox( + width: 18, + ), ], ), ), @@ -55,3 +74,27 @@ class MenuRow extends StatelessWidget { ); } } + +class _DocumentationIcon extends StatelessWidget { + const _DocumentationIcon({ + Key? key, + required this.onTap, + }) : super(key: key); + final VoidCallback onTap; + + @override + Widget build(BuildContext context) { + return SizedBox( + width: 60, + height: 60, + child: IconButton( + onPressed: onTap, + icon: const Icon( + Icons.article, + color: Colors.white, + ), + tooltip: 'Documentation', + ), + ); + } +} diff --git a/example/lib/urls.dart b/example/lib/urls.dart index 081a632287..772c77702a 100644 --- a/example/lib/urls.dart +++ b/example/lib/urls.dart @@ -5,4 +5,9 @@ class Urls { final chartDir = chartType.name.toLowerCase(); return 'https://github.com/imaNNeo/fl_chart/blob/master/example/lib/presentation/samples/$chartDir/${chartDir}_chart_sample$sampleNumber.dart'; } + + static String getChartDocumentationUrl(ChartType chartType) { + final chartDir = chartType.name.toLowerCase(); + return 'https://github.com/imaNNeo/fl_chart/blob/master/repo_files/documentations/${chartDir}_chart.md'; + } } diff --git a/example/lib/util/app_helper.dart b/example/lib/util/app_helper.dart index 506e4a37cb..53f4c70d0f 100644 --- a/example/lib/util/app_helper.dart +++ b/example/lib/util/app_helper.dart @@ -1,4 +1,5 @@ import 'package:fl_chart_app/presentation/resources/app_resources.dart'; +import 'package:fl_chart_app/urls.dart'; enum ChartType { line, bar, pie, scatter, radar } @@ -20,5 +21,7 @@ extension ChartTypeExtension on ChartType { } } + String get documentationUrl => Urls.getChartDocumentationUrl(this); + String get assetIcon => AppAssets.getChartIcon(this); } From 306989dc6027c5b759ac348c41b92a7c8ab6337c Mon Sep 17 00:00:00 2001 From: imaNNeoFighT Date: Mon, 31 Jul 2023 23:55:27 +0200 Subject: [PATCH 5/7] Simplify ChartType enum --- example/lib/presentation/pages/home_page.dart | 4 ++-- .../presentation/samples/chart_sample.dart | 2 +- example/lib/util/app_helper.dart | 23 +++++++------------ 3 files changed, 11 insertions(+), 18 deletions(-) diff --git a/example/lib/presentation/pages/home_page.dart b/example/lib/presentation/pages/home_page.dart index fd49286ff0..35df81d420 100644 --- a/example/lib/presentation/pages/home_page.dart +++ b/example/lib/presentation/pages/home_page.dart @@ -22,7 +22,7 @@ class HomePage extends StatelessWidget { _menuItemsIndices[type] = index; return ChartMenuItem( type, - type.getSimpleName(), + type.displayName, type.assetIcon, ); }, @@ -78,7 +78,7 @@ class HomePage extends StatelessWidget { ? AppBar( elevation: 0, backgroundColor: Colors.transparent, - title: Text(showingChartType.getDisplayName()), + title: Text(showingChartType.displayName), ) : null, ); diff --git a/example/lib/presentation/samples/chart_sample.dart b/example/lib/presentation/samples/chart_sample.dart index a175c4cb91..6d753be251 100644 --- a/example/lib/presentation/samples/chart_sample.dart +++ b/example/lib/presentation/samples/chart_sample.dart @@ -6,7 +6,7 @@ abstract class ChartSample { final int number; final WidgetBuilder builder; ChartType get type; - String get name => '${type.getDisplayName()} Sample $number'; + String get name => '${type.displayName} Sample $number'; String get url => Urls.getChartSourceCodeUrl(type, number); ChartSample(this.number, this.builder); } diff --git a/example/lib/util/app_helper.dart b/example/lib/util/app_helper.dart index 53f4c70d0f..38c5ac882b 100644 --- a/example/lib/util/app_helper.dart +++ b/example/lib/util/app_helper.dart @@ -4,22 +4,15 @@ import 'package:fl_chart_app/urls.dart'; enum ChartType { line, bar, pie, scatter, radar } extension ChartTypeExtension on ChartType { - String getDisplayName() => '${getSimpleName()} Chart'; + String get displayName => '$simpleName Chart'; - String getSimpleName() { - switch (this) { - case ChartType.line: - return 'Line'; - case ChartType.bar: - return 'Bar'; - case ChartType.pie: - return 'Pie'; - case ChartType.scatter: - return 'Scatter'; - case ChartType.radar: - return 'Radar'; - } - } + String get simpleName => switch (this) { + ChartType.line => 'Line', + ChartType.bar => 'Bar', + ChartType.pie => 'Pie', + ChartType.scatter => 'Scatter', + ChartType.radar => 'Radar', + }; String get documentationUrl => Urls.getChartDocumentationUrl(this); From dd479e0e315561c08534c2c15abf6d6a08bef160 Mon Sep 17 00:00:00 2001 From: imaNNeoFighT Date: Tue, 1 Aug 2023 00:00:12 +0200 Subject: [PATCH 6/7] Decrease menu items sizes --- example/lib/presentation/menu/menu_row.dart | 6 +++--- example/lib/presentation/resources/app_dimens.dart | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/example/lib/presentation/menu/menu_row.dart b/example/lib/presentation/menu/menu_row.dart index ee634913bc..63db6e8df0 100644 --- a/example/lib/presentation/menu/menu_row.dart +++ b/example/lib/presentation/menu/menu_row.dart @@ -85,13 +85,13 @@ class _DocumentationIcon extends StatelessWidget { @override Widget build(BuildContext context) { return SizedBox( - width: 60, - height: 60, + width: AppDimens.menuDocumentationIconSize, + height: AppDimens.menuDocumentationIconSize, child: IconButton( onPressed: onTap, icon: const Icon( Icons.article, - color: Colors.white, + color: AppColors.contentColorWhite, ), tooltip: 'Documentation', ), diff --git a/example/lib/presentation/resources/app_dimens.dart b/example/lib/presentation/resources/app_dimens.dart index 60dbc46c2b..b11c81b226 100644 --- a/example/lib/presentation/resources/app_dimens.dart +++ b/example/lib/presentation/resources/app_dimens.dart @@ -1,8 +1,9 @@ class AppDimens { static const double menuMaxNeededWidth = 304; static const double menuRowHeight = 74; - static const double menuIconSize = 36; - static const double menuTextSize = 24; + static const double menuIconSize = 32; + static const double menuDocumentationIconSize = 44; + static const double menuTextSize = 20; static const double chartBoxMinWidth = 350; From 5d81d616c957f7a055bd48b5ca4cb77de62b3391 Mon Sep 17 00:00:00 2001 From: Son Tran Thai Date: Fri, 14 Jul 2023 11:29:16 +0700 Subject: [PATCH 7/7] Use `dart format` instead of `flutter format` (deprecated). --- CONTRIBUTING.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a99c214a10..0d279ee6b1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -61,10 +61,10 @@ You can simply run `make checkstyle`, and if you faced any formatting problem, r ##### Run `make checkstyle` to ensure that your code is formatted correctly - It runs `flutter analyze` to verify that there is no any warning or error. -- It runs `flutter format --set-exit-if-changed --dry-run .` to verify that code has formatted correctly. +- It runs `dart format --set-exit-if-changed --dry-run .` to verify that code has formatted correctly. #### Run `make format` to reformat the code -- It runs `flutter format .` to format your code. +- It runs `dart format .` to format your code. #### Run `make runTests` to ensure that all tests are passing.