diff --git a/trainerbox/images/arrowLinks.png b/trainerbox/images/arrowLinks.png new file mode 100644 index 0000000..f7e0bd0 Binary files /dev/null and b/trainerbox/images/arrowLinks.png differ diff --git a/trainerbox/images/arrowRechts.png b/trainerbox/images/arrowRechts.png new file mode 100644 index 0000000..d427410 Binary files /dev/null and b/trainerbox/images/arrowRechts.png differ diff --git a/trainerbox/lib/main.dart b/trainerbox/lib/main.dart index 52f6e3e..cce94d1 100644 --- a/trainerbox/lib/main.dart +++ b/trainerbox/lib/main.dart @@ -2,12 +2,9 @@ import 'package:flutter/material.dart'; import 'package:firebase_core/firebase_core.dart'; import 'firebase_options.dart'; - void main() async { WidgetsFlutterBinding.ensureInitialized(); - await Firebase.initializeApp( - options: DefaultFirebaseOptions.currentPlatform, - ); + await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); runApp(const MyApp()); } @@ -28,9 +25,33 @@ class MyApp extends StatelessWidget { } } -class HomeScreen extends StatelessWidget { +class HomeScreen extends StatefulWidget { const HomeScreen({super.key}); + @override + State createState() => _HomeScreenState(); +} + +class _HomeScreenState extends State { + final PageController _pageController = PageController(); + int _currentPage = 0; + + @override + void initState() { + super.initState(); + _pageController.addListener(() { + setState(() { + _currentPage = _pageController.page?.round() ?? 0; + }); + }); + } + + @override + void dispose() { + _pageController.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { return Scaffold( @@ -51,7 +72,6 @@ class HomeScreen extends StatelessWidget { ), ), const SizedBox(height: 20), - // Next Training Card Container( height: 200, width: double.infinity, @@ -78,7 +98,6 @@ class HomeScreen extends StatelessWidget { ), ), const SizedBox(height: 20), - // Favorites Section const Text( 'Favoriten', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), @@ -106,7 +125,6 @@ class HomeScreen extends StatelessWidget { ), ), const SizedBox(height: 20), - // Suggestions Section const Text( 'Vorschläge', style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold), @@ -114,23 +132,65 @@ class HomeScreen extends StatelessWidget { const SizedBox(height: 10), SizedBox( height: 180, - child: PageView( - children: const [ - ExerciseCard( - title: 'Wurf', - category: 'Wurf', - icon: Icons.sports_handball, - ), - ExerciseCard( - title: 'Doppelpass', - category: 'Passen', - icon: Icons.sports_volleyball, - ), - ExerciseCard( - title: 'Torhüter Training', - category: 'Torhüter', - icon: Icons.sports_soccer, + child: Stack( + alignment: Alignment.center, + children: [ + PageView( + controller: _pageController, + children: const [ + ExerciseCard( + title: 'Wurf', + category: 'Wurf', + icon: Icons.sports_handball, + ), + ExerciseCard( + title: 'Doppelpass', + category: 'Passen', + icon: Icons.sports_volleyball, + ), + ExerciseCard( + title: 'Torhüter Training', + category: 'Torhüter', + icon: Icons.sports_soccer, + ), + ], ), + // Left Arrow + if (_currentPage > 0) + Positioned( + left: 0, + child: IconButton( + icon: Icon( + Icons.arrow_back_ios, + size: 40, + color: Theme.of(context).colorScheme.primary, + ), + onPressed: () { + _pageController.previousPage( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + }, + ), + ), + // Right Arrow + if (_currentPage < 2) + Positioned( + right: 0, + child: IconButton( + icon: Icon( + Icons.arrow_forward_ios, + size: 40, + color: Theme.of(context).colorScheme.primary, + ), + onPressed: () { + _pageController.nextPage( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + ); + }, + ), + ), ], ), ), diff --git a/trainerbox/macos/Flutter/GeneratedPluginRegistrant.swift b/trainerbox/macos/Flutter/GeneratedPluginRegistrant.swift index e46c39f..804ef2f 100644 --- a/trainerbox/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/trainerbox/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,8 +5,12 @@ import FlutterMacOS import Foundation +import cloud_firestore +import firebase_auth import firebase_core func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) + FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) } diff --git a/trainerbox/pubspec.lock b/trainerbox/pubspec.lock index 4016704..273684d 100644 --- a/trainerbox/pubspec.lock +++ b/trainerbox/pubspec.lock @@ -1,6 +1,14 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: + _flutterfire_internals: + dependency: transitive + description: + name: _flutterfire_internals + sha256: "37a42d06068e2fe3deddb2da079a8c4d105f241225ba27b7122b37e9865fd8f7" + url: "https://pub.dev" + source: hosted + version: "1.3.35" async: dependency: transitive description: @@ -33,6 +41,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.2" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + sha256: a0f161b92610e078b4962d7e6ebeb66dc9cce0ada3514aeee442f68165d78185 + url: "https://pub.dev" + source: hosted + version: "4.17.5" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + sha256: "6a55b319f8d33c307396b9104512e8130a61904528ab7bd8b5402678fca54b81" + url: "https://pub.dev" + source: hosted + version: "6.2.5" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + sha256: "89dfa1304d3da48b3039abbb2865e3d30896ef858e569a16804a99f4362283a9" + url: "https://pub.dev" + source: hosted + version: "3.12.5" collection: dependency: transitive description: @@ -57,14 +89,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.2" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + sha256: cfc2d970829202eca09e2896f0a5aa7c87302817ecc0bdfa954f026046bf10ba + url: "https://pub.dev" + source: hosted + version: "4.20.0" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + sha256: a0270e1db3b2098a14cb2a2342b3cd2e7e458e0c391b1f64f6f78b14296ec093 + url: "https://pub.dev" + source: hosted + version: "7.3.0" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + sha256: "64e067e763c6378b7e774e872f0f59f6812885e43020e25cde08f42e9459837b" + url: "https://pub.dev" + source: hosted + version: "5.12.0" firebase_core: dependency: "direct main" description: name: firebase_core - sha256: "017d17d9915670e6117497e640b2859e0b868026ea36bf3a57feb28c3b97debe" + sha256: "26de145bb9688a90962faec6f838247377b0b0d32cc0abecd9a4e43525fc856c" url: "https://pub.dev" source: hosted - version: "3.13.0" + version: "2.32.0" firebase_core_platform_interface: dependency: transitive description: @@ -77,10 +133,10 @@ packages: dependency: transitive description: name: firebase_core_web - sha256: "129a34d1e0fb62e2b488d988a1fc26cc15636357e50944ffee2862efe8929b23" + sha256: "362e52457ed2b7b180964769c1e04d1e0ea0259fdf7025fdfedd019d4ae2bd88" url: "https://pub.dev" source: hosted - version: "2.22.0" + version: "2.17.5" flutter: dependency: "direct main" description: flutter @@ -104,6 +160,14 @@ packages: description: flutter source: sdk version: "0.0.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" leak_tracker: dependency: transitive description: @@ -229,6 +293,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.7.4" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" vector_math: dependency: transitive description: @@ -249,10 +321,10 @@ packages: dependency: transitive description: name: web - sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "0.5.1" sdks: dart: ">=3.7.2 <4.0.0" - flutter: ">=3.22.0" + flutter: ">=3.18.0-18.0.pre.54" diff --git a/trainerbox/pubspec.yaml b/trainerbox/pubspec.yaml index 894115c..6aca7ce 100644 --- a/trainerbox/pubspec.yaml +++ b/trainerbox/pubspec.yaml @@ -34,7 +34,6 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.8 - firebase_core: ^3.13.0 dev_dependencies: flutter_test: @@ -58,9 +57,6 @@ flutter: # the material Icons class. uses-material-design: true - assets: - - images/training_bg.jpg - # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg diff --git a/trainerbox/windows/flutter/generated_plugin_registrant.cc b/trainerbox/windows/flutter/generated_plugin_registrant.cc index 1a82e7d..bf6d21a 100644 --- a/trainerbox/windows/flutter/generated_plugin_registrant.cc +++ b/trainerbox/windows/flutter/generated_plugin_registrant.cc @@ -6,9 +6,15 @@ #include "generated_plugin_registrant.h" +#include +#include #include void RegisterPlugins(flutter::PluginRegistry* registry) { + CloudFirestorePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("CloudFirestorePluginCApi")); + FirebaseAuthPluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FirebaseAuthPluginCApi")); FirebaseCorePluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("FirebaseCorePluginCApi")); } diff --git a/trainerbox/windows/flutter/generated_plugins.cmake b/trainerbox/windows/flutter/generated_plugins.cmake index fa8a39b..b83b40a 100644 --- a/trainerbox/windows/flutter/generated_plugins.cmake +++ b/trainerbox/windows/flutter/generated_plugins.cmake @@ -3,6 +3,8 @@ # list(APPEND FLUTTER_PLUGIN_LIST + cloud_firestore + firebase_auth firebase_core )