diff --git a/lib/views/main_menu_view.dart b/lib/views/main_menu_view.dart index fd3f33f..2a9d3e3 100644 --- a/lib/views/main_menu_view.dart +++ b/lib/views/main_menu_view.dart @@ -3,7 +3,7 @@ import 'package:cabo_counter/utility/globals.dart'; import 'package:cabo_counter/utility/local_storage_service.dart'; import 'package:cabo_counter/views/active_game_view.dart'; import 'package:cabo_counter/views/create_game_view.dart'; -import 'package:cabo_counter/views/information_view.dart'; +import 'package:cabo_counter/views/settings_view.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -35,12 +35,12 @@ class _MainMenuViewState extends State { Navigator.push( context, CupertinoPageRoute( - builder: (context) => const InformationView(), + builder: (context) => const SettingsView(), ), ); }, icon: const Icon( - CupertinoIcons.info_circle, + CupertinoIcons.settings, size: 30, )), middle: const Text('Cabo Counter'), diff --git a/lib/views/settings_view.dart b/lib/views/settings_view.dart new file mode 100644 index 0000000..90cbd2b --- /dev/null +++ b/lib/views/settings_view.dart @@ -0,0 +1,65 @@ +import 'package:flutter/cupertino.dart'; +import 'package:package_info_plus/package_info_plus.dart'; + +class SettingsView extends StatefulWidget { + const SettingsView({super.key}); + + @override + State createState() => _SettingsViewState(); +} + +class _SettingsViewState extends State { + @override + Widget build(BuildContext context) { + return CupertinoPageScaffold( + navigationBar: const CupertinoNavigationBar( + middle: Text('Einstellungen'), + ), + child: SafeArea( + child: Stack( + children: [ + const Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Center( + child: Icon( + CupertinoIcons.settings, + size: 100, + )), + ], + ), + Positioned( + bottom: 30, + left: 0, + right: 0, + child: FutureBuilder( + future: _getPackageInfo(), + builder: (context, snapshot) { + if (snapshot.hasData) { + return Text( + 'Alpha ${snapshot.data!.version} ' + '(Build ${snapshot.data!.buildNumber})', + textAlign: TextAlign.center, + ); + } else if (snapshot.hasError) { + return const Text( + 'App-Version -.-.- (Build -)', + textAlign: TextAlign.center, + ); + } + return const Text( + 'Lade Version...', + textAlign: TextAlign.center, + ); + }, + )), + ], + )), + ); + } + + Future _getPackageInfo() async { + return await PackageInfo.fromPlatform(); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index a20057a..ecbbc81 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: cabo_counter description: "Mobile app for the card game Cabo" publish_to: 'none' -version: 0.1.5+110 +version: 0.1.5+113 environment: sdk: ^3.5.4