diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 30cec9a..eabf858 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -1,7 +1,7 @@ _MyHomePageState(); -} - -class _MyHomePageState extends State { - int _counter = 0; - - void _incrementCounter() { - setState(() { - // This call to setState tells the Flutter framework that something has - // changed in this State, which causes it to rerun the build method below - // so that the display can reflect the updated values. If we changed - // _counter without calling setState(), then the build method would not be - // called again, and so nothing would appear to happen. - _counter++; - }); - } - - @override - Widget build(BuildContext context) { - // This method is rerun every time setState is called, for instance as done - // by the _incrementCounter method above. - // - // The Flutter framework has been optimized to make rerunning build methods - // fast, so that you can just rebuild anything that needs updating rather - // than having to individually change instances of widgets. - return Scaffold( - appBar: AppBar( - // Here we take the value from the MyHomePage object that was created by - // the App.build method, and use it to set our appbar title. - title: Text(widget.title), - ), - body: Center( - // Center is a layout widget. It takes a single child and positions it - // in the middle of the parent. - child: Column( - // Column is also a layout widget. It takes a list of children and - // arranges them vertically. By default, it sizes itself to fit its - // children horizontally, and tries to be as tall as its parent. - // - // Invoke "debug painting" (press "p" in the console, choose the - // "Toggle Debug Paint" action from the Flutter Inspector in Android - // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) - // to see the wireframe for each widget. - // - // Column has various properties to control how it sizes itself and - // how it positions its children. Here we use mainAxisAlignment to - // center the children vertically; the main axis here is the vertical - // axis because Columns are vertical (the cross axis would be - // horizontal). - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'You have pushed the button this many times:', - ), - Text( - '$_counter', - style: Theme.of(context).textTheme.headline4, - ), - ], - ), - ), - floatingActionButton: FloatingActionButton( - onPressed: _incrementCounter, - tooltip: 'Increment', - child: Icon(Icons.add), - ), // This trailing comma makes auto-formatting nicer for build methods. - ); - } -} +import 'package:flutter/material.dart'; +import 'package:google_fonts/google_fonts.dart'; +import 'screens/mainMenu.dart'; + +void main() => runApp(_App()); + +class _App extends StatelessWidget { + @override + Widget build(BuildContext context) { + final textTheme = Theme.of(context).textTheme; + return MaterialApp( + home: MainMenuScreen(), + theme: ThemeData( + primaryColor: Colors.green[800], + colorScheme: Theme.of(context).colorScheme.copyWith( + primary: Color(0xFF2E7D32), + onPrimary: Color(0xFFFFFFFF), + primaryVariant: Color(0xFF005005), + ), + textTheme: GoogleFonts.rubikTextTheme(textTheme), + ), + ); + } +} diff --git a/lib/screens/gameList.dart b/lib/screens/gameList.dart new file mode 100644 index 0000000..c48d44c --- /dev/null +++ b/lib/screens/gameList.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class GameListScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text('Trainingsspiel starten'), + ), + body: Text('a')); + } +} diff --git a/lib/screens/mainMenu.dart b/lib/screens/mainMenu.dart new file mode 100644 index 0000000..c23fc6e --- /dev/null +++ b/lib/screens/mainMenu.dart @@ -0,0 +1,58 @@ +import 'package:flutter/material.dart'; +import 'gameList.dart'; +import '../components/menuButton.dart'; + +class MainMenuScreen extends StatelessWidget { + @override + Widget build(BuildContext context) { + List screens = getScreens(); + return Scaffold( + appBar: AppBar( + actions: [ + IconButton( + icon: const Icon(Icons.account_circle), + tooltip: 'Login', + onPressed: () { + print('tbd'); + }, + ) + ], + title: Text('DartsDrill'), + ), + body: ListView( + children: [ + for (Map i in screens) + MenuButton( + buttonText: i['title'], + onPressed: i['screen'] != null + ? () { + Navigator.push( + context, + MaterialPageRoute(builder: (context) { + return i['screen']; + }), + ); + } + : null, + icon: i['icon']), + ], + ), + ); + } + + List getScreens() { + return [ + { + 'title': 'Trainingsspiel starten', + 'screen': GameListScreen(), + 'icon': Icons.play_arrow_outlined + }, + {'title': 'Meine Trainingspläne', 'icon': Icons.calendar_today_rounded}, + {'title': 'Statistiken', 'icon': Icons.data_usage}, + {'title': 'Daten importieren', 'icon': Icons.import_export}, + {'title': 'Einstellungen', 'icon': Icons.settings}, + {'title': 'Über uns', 'icon': Icons.code}, + {'title': 'Hilfe', 'icon': Icons.live_help_outlined}, + ]; + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 3ce42be..800376a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,12 +15,13 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.0+1 +version: 0.0.1 environment: sdk: ">=2.7.0 <3.0.0" dependencies: + google_fonts: ^2.0.0 flutter: sdk: flutter diff --git a/test/widget_test.dart b/test/widget_test.old.dart similarity index 96% rename from test/widget_test.dart rename to test/widget_test.old.dart index c158002..9f72c11 100644 --- a/test/widget_test.dart +++ b/test/widget_test.old.dart @@ -4,7 +4,7 @@ // utility that Flutter provides. For example, you can send tap and scroll // gestures. You can also use WidgetTester to find child widgets in the widget // tree, read text, and verify that the values of widget properties are correct. - +/* import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; @@ -28,3 +28,4 @@ void main() { expect(find.text('1'), findsOneWidget); }); } +*/ \ No newline at end of file