diff --git a/example/lib/cubits/app/app_cubit.dart b/example/lib/cubits/app/app_cubit.dart index 317f1969b..b33f89042 100644 --- a/example/lib/cubits/app/app_cubit.dart +++ b/example/lib/cubits/app/app_cubit.dart @@ -1,3 +1,5 @@ +import 'package:fl_chart_app/urls.dart'; +import 'package:fl_chart_app/util/app_utils.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:package_info_plus/package_info_plus.dart'; import 'package:equatable/equatable.dart'; @@ -17,6 +19,12 @@ class AppCubit extends Cubit { usingFlChartVersion: BuildConstants.usingFlChartVersion, )); } + + void onVersionClicked() { + AppUtils().tryToLaunchUrl( + Urls.getVersionReleaseUrl(state.usingFlChartVersion), + ); + } } class BuildConstants { diff --git a/example/lib/presentation/menu/app_menu.dart b/example/lib/presentation/menu/app_menu.dart index f4deffdf2..51fcd2daf 100644 --- a/example/lib/presentation/menu/app_menu.dart +++ b/example/lib/presentation/menu/app_menu.dart @@ -4,6 +4,7 @@ import 'package:fl_chart_app/presentation/resources/app_resources.dart'; import 'package:fl_chart_app/urls.dart'; import 'package:fl_chart_app/util/app_helper.dart'; import 'package:fl_chart_app/util/app_utils.dart'; +import 'package:flutter/gestures.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:url_launcher/url_launcher.dart'; @@ -105,12 +106,20 @@ class _AppVersionRow extends StatelessWidget { ), ), if (state.usingFlChartVersion.isNotBlank) ...[ - const TextSpan(text: '\nfl_chart: '), + TextSpan( + text: '\nfl_chart: ', + recognizer: TapGestureRecognizer() + ..onTap = BlocProvider.of(context) + .onVersionClicked, + ), TextSpan( text: 'v${state.usingFlChartVersion}', style: const TextStyle( fontWeight: FontWeight.bold, ), + recognizer: TapGestureRecognizer() + ..onTap = BlocProvider.of(context) + .onVersionClicked, ), ] ], diff --git a/example/lib/presentation/pages/home_page.dart b/example/lib/presentation/pages/home_page.dart index 497e098e8..d1e2b02d3 100644 --- a/example/lib/presentation/pages/home_page.dart +++ b/example/lib/presentation/pages/home_page.dart @@ -4,7 +4,6 @@ import 'package:fl_chart_app/presentation/resources/app_resources.dart'; import 'package:fl_chart_app/urls.dart'; import 'package:fl_chart_app/util/app_helper.dart'; import 'package:fl_chart_app/util/app_utils.dart'; -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:go_router/go_router.dart'; @@ -53,18 +52,7 @@ class HomePage extends StatelessWidget { Navigator.of(context).pop(); } }, - onBannerClicked: kIsWeb || needsDrawer - ? () async { - if (kIsWeb) { - await AppUtils().tryToLaunchUrl(Urls.flChartUrl); - return; - } - if (needsDrawer) { - Navigator.of(context).pop(); - return; - } - } - : null, + onBannerClicked: () => AppUtils().tryToLaunchUrl(Urls.flChartUrl), ); final samplesSectionWidget = ChartSamplesPage(chartType: showingChartType); diff --git a/example/lib/urls.dart b/example/lib/urls.dart index 83cb6d95b..c1af6f547 100644 --- a/example/lib/urls.dart +++ b/example/lib/urls.dart @@ -2,6 +2,10 @@ import 'package:fl_chart_app/util/app_helper.dart'; class Urls { static const flChartUrl = 'https://flchart.dev'; + static const flChartGithubUrl = 'https://github.com/imaNNeo/fl_chart'; + + static String get aboutUrl => '$flChartUrl/about'; + static String getChartSourceCodeUrl(ChartType chartType, int sampleNumber) { final chartDir = chartType.name.toLowerCase(); return 'https://github.com/imaNNeo/fl_chart/blob/master/example/lib/presentation/samples/$chartDir/${chartDir}_chart_sample$sampleNumber.dart'; @@ -12,5 +16,6 @@ class Urls { return 'https://github.com/imaNNeo/fl_chart/blob/master/repo_files/documentations/${chartDir}_chart.md'; } - static String get aboutUrl => '$flChartUrl/about'; + static String getVersionReleaseUrl(String version) => + '$flChartGithubUrl/releases/tag/$version'; } diff --git a/example/web/index.html b/example/web/index.html index a6950c506..42adc297e 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -107,7 +107,5 @@ }); }); - -