From 4a53ecab15dfc29e38463a58afb199c952c72736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Harrault?= <benoit@harrault.fr> Date: Mon, 30 Oct 2023 16:42:42 +0100 Subject: [PATCH] Add "about" page --- android/gradle.properties | 4 ++-- assets/translations/en.json | 5 +++++ assets/translations/fr.json | 5 +++++ lib/cubit/bottom_nav_cubit.dart | 6 +++--- lib/ui/screens/about_page.dart | 23 +++++++++++++++++++++++ lib/ui/screens/skeleton_screen.dart | 2 ++ lib/ui/widgets/bottom_nav_bar.dart | 4 ++++ pubspec.yaml | 2 +- 8 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 lib/ui/screens/about_page.dart diff --git a/android/gradle.properties b/android/gradle.properties index 33c4377..5a36ab8 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=1.0.23 -app.versionCode=24 +app.versionName=1.0.24 +app.versionCode=25 diff --git a/assets/translations/en.json b/assets/translations/en.json index ca94af1..5159cad 100644 --- a/assets/translations/en.json +++ b/assets/translations/en.json @@ -1,7 +1,12 @@ { "app_name": "Random application", + "bottom_nav_sample": "Sample", "bottom_nav_chart": "Graph", + "bottom_nav_about": "About", + + "about_title": "About", + "about_content": "A random application, for testing purpose only.", "TOP": "TOP", "BOTTOM": "BOTTOM" diff --git a/assets/translations/fr.json b/assets/translations/fr.json index 6016e93..9f39534 100644 --- a/assets/translations/fr.json +++ b/assets/translations/fr.json @@ -1,7 +1,12 @@ { "app_name": "Random application", + "bottom_nav_sample": "Démo", "bottom_nav_chart": "Graph", + "bottom_nav_about": "À propos", + + "about_title": "À propos", + "about_content": "Application fourre-tout, à des fins de tests uniquement.", "TOP": "HAUT", "BOTTOM": "BAS" diff --git a/lib/cubit/bottom_nav_cubit.dart b/lib/cubit/bottom_nav_cubit.dart index 7a39813..eb54062 100644 --- a/lib/cubit/bottom_nav_cubit.dart +++ b/lib/cubit/bottom_nav_cubit.dart @@ -5,9 +5,9 @@ class BottomNavCubit extends HydratedCubit<int> { void updateIndex(int index) => emit(index); - void getFirstScreen() => emit(0); - - void getSecondScreen() => emit(1); + void getDemoPage() => emit(0); + void getGraphPage() => emit(1); + void getAboutPage() => emit(2); @override int? fromJson(Map<String, dynamic> json) { diff --git a/lib/ui/screens/about_page.dart b/lib/ui/screens/about_page.dart new file mode 100644 index 0000000..5c6a647 --- /dev/null +++ b/lib/ui/screens/about_page.dart @@ -0,0 +1,23 @@ +import 'package:easy_localization/easy_localization.dart'; +import 'package:flutter/material.dart'; + +class AboutPage extends StatelessWidget { + const AboutPage({super.key}); + + @override + Widget build(BuildContext context) { + return Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.max, + children: <Widget>[ + Text( + 'about_title', + textAlign: TextAlign.start, + style: Theme.of(context).textTheme.headlineMedium!.apply(fontWeightDelta: 2), + ).tr(), + Text('about_content').tr(), + ], + ); + } +} diff --git a/lib/ui/screens/skeleton_screen.dart b/lib/ui/screens/skeleton_screen.dart index 6d6e9fa..4c43b9b 100644 --- a/lib/ui/screens/skeleton_screen.dart +++ b/lib/ui/screens/skeleton_screen.dart @@ -4,6 +4,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:random/activities/ActivityDemoPage.dart'; import 'package:random/activities/ActivityGraphPage.dart'; import 'package:random/cubit/bottom_nav_cubit.dart'; +import 'package:random/ui/screens/about_page.dart'; import 'package:random/ui/widgets/custom_app_bar.dart'; import 'package:random/ui/widgets/bottom_nav_bar.dart'; @@ -15,6 +16,7 @@ class SkeletonScreen extends StatelessWidget { const List<Widget> pageNavigation = <Widget>[ ActivityDemoPage(), ActivityGraphPage(), + AboutPage(), ]; return BlocProvider<BottomNavCubit>( diff --git a/lib/ui/widgets/bottom_nav_bar.dart b/lib/ui/widgets/bottom_nav_bar.dart index d656854..5e6f710 100644 --- a/lib/ui/widgets/bottom_nav_bar.dart +++ b/lib/ui/widgets/bottom_nav_bar.dart @@ -39,6 +39,10 @@ class BottomNavBar extends StatelessWidget { icon: const Icon(Ionicons.pencil_outline), label: tr('bottom_nav_chart'), ), + BottomNavigationBarItem( + icon: const Icon(Ionicons.information_circle), + label: tr('bottom_nav_about'), + ), ], ); }), diff --git a/pubspec.yaml b/pubspec.yaml index 46f75c5..f779334 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: A random application, for testing purpose only. publish_to: 'none' -version: 1.0.23+24 +version: 1.0.24+25 environment: sdk: '^3.0.0' -- GitLab