Skip to content
Snippets Groups Projects
Commit ba1f4bf6 authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Merge branch '81-add-about-page' into 'master'

Resolve "Add "about" page"

Closes #81

See merge request !77
parents 06aa7408 c17bcc8d
No related branches found
No related tags found
1 merge request!77Resolve "Add "about" page"
Pipeline #5659 passed
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
app.versionName=0.1.21
app.versionCode=70
app.versionName=0.1.22
app.versionCode=71
......@@ -3,7 +3,12 @@
"bottom_nav_game": "Game",
"bottom_nav_settings": "Settings",
"bottom_nav_about": "About",
"settings_title": "Settings",
"settings_label_theme": "Theme mode"
"settings_label_theme": "Theme mode",
"about_title": "About",
"about_content": "Simple Sudoku Game. Easy to play, easy to enjoy.",
"about_version": "Version: {version}"
}
......@@ -3,7 +3,12 @@
"bottom_nav_game": "Jeu",
"bottom_nav_settings": "Réglages",
"bottom_nav_about": "Infos",
"settings_title": "Réglages",
"settings_label_theme": "Thème de couleurs"
"settings_label_theme": "Thème de couleurs",
"about_title": "Informations",
"about_content": "Jeu de Sudoku simple, facile à jouer, facile à apprécier.",
"about_version": "Version : {version}"
}
Add "about" minimal page.
Ajout d'une page "informations" minimale.
import 'package:flutter/material.dart';
import 'package:unicons/unicons.dart';
import 'package:sudoku/ui/screens/about_page.dart';
import 'package:sudoku/ui/screens/game_page.dart';
import 'package:sudoku/ui/screens/settings_page.dart';
......@@ -31,9 +32,17 @@ class Menu {
page: SettingsPage(),
);
static const indexAbout = 2;
static const menuItemAbout = MenuItem(
code: 'bottom_nav_about',
icon: Icon(UniconsLine.info_circle),
page: AboutPage(),
);
static Map<int, MenuItem> items = {
indexGame: menuItemGame,
indexSettings: menuItemSettings,
indexAbout: menuItemAbout,
};
static bool isIndexAllowed(int pageIndex) {
......
......@@ -17,12 +17,12 @@ class NavCubit extends HydratedCubit<int> {
emit(Menu.indexGame);
}
void switchToSettingsPage() {
if (state != Menu.indexSettings) {
emit(Menu.indexSettings);
} else {
goToGamePage();
}
void goToSettingsPage() {
emit(Menu.indexSettings);
}
void goToAboutPage() {
emit(Menu.indexAbout);
}
@override
......
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:sudoku/ui/widgets/header_app.dart';
class AboutPage extends StatelessWidget {
const AboutPage({super.key});
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 8),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: <Widget>[
const SizedBox(height: 8),
const AppHeader(text: 'about_title'),
const Text('about_content').tr(),
FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.done:
return const Text('about_version').tr(
namedArgs: {
'version': snapshot.data!.version,
},
);
default:
return const SizedBox();
}
},
),
],
),
);
}
}
......@@ -106,13 +106,24 @@ class GlobalAppBar extends StatelessWidget implements PreferredSizeWidget {
// go to Settings page
menuActions.add(ElevatedButton(
onPressed: () {
context.read<NavCubit>().switchToSettingsPage();
context.read<NavCubit>().goToSettingsPage();
},
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
),
child: Menu.menuItemSettings.icon,
));
// go to About page
menuActions.add(ElevatedButton(
onPressed: () {
context.read<NavCubit>().goToAboutPage();
},
style: ElevatedButton.styleFrom(
shape: const CircleBorder(),
),
child: Menu.menuItemAbout.icon,
));
} else {
// back to Home page
menuActions.add(ElevatedButton(
......
......@@ -9,6 +9,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.5.0"
async:
dependency: transitive
description:
name: async
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
url: "https://pub.dev"
source: hosted
version: "2.11.0"
badges:
dependency: "direct main"
description:
......@@ -136,6 +144,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.3"
http:
dependency: transitive
description:
name: http
sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
http_parser:
dependency: transitive
description:
name: http_parser
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
url: "https://pub.dev"
source: hosted
version: "4.0.2"
hydrated_bloc:
dependency: "direct main"
description:
......@@ -184,6 +208,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: b93d8b4d624b4ea19b0a5a208b2d6eff06004bc3ce74c06040b120eeadd00ce0
url: "https://pub.dev"
source: hosted
version: "8.0.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: f49918f3433a3146047372f9d4f1f847511f2acd5cd030e1f44fe5a50036b70e
url: "https://pub.dev"
source: hosted
version: "3.0.0"
path:
dependency: transitive
description:
......@@ -325,6 +365,22 @@ packages:
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
url: "https://pub.dev"
source: hosted
version: "1.10.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
url: "https://pub.dev"
source: hosted
version: "1.2.0"
synchronized:
dependency: transitive
description:
......@@ -333,6 +389,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.0+1"
term_glyph:
dependency: transitive
description:
name: term_glyph
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
url: "https://pub.dev"
source: hosted
version: "1.2.1"
typed_data:
dependency: transitive
description:
......
......@@ -3,7 +3,7 @@ description: A sudoku game application.
publish_to: "none"
version: 0.1.21+70
version: 0.1.22+71
environment:
sdk: "^3.0.0"
......@@ -18,6 +18,7 @@ dependencies:
flutter_bloc: ^8.1.1
hive: ^2.2.3
hydrated_bloc: ^9.0.0
package_info_plus: ^8.0.0
path_provider: ^2.0.11
unicons: ^2.1.1
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment