From e17661c0abcc575fdb654053e5c92b9f0d7b873e Mon Sep 17 00:00:00 2001 From: laurent Date: Thu, 17 Apr 2025 16:05:14 +0200 Subject: [PATCH] =?UTF-8?q?App=20Homescreen=20Swipe=20+=20arrows=20hinzuge?= =?UTF-8?q?f=C3=BCgt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trainerbox/images/arrowLinks.png | Bin 0 -> 1640 bytes trainerbox/images/arrowRechts.png | Bin 0 -> 1692 bytes trainerbox/lib/main.dart | 108 ++++++++++++++---- .../Flutter/GeneratedPluginRegistrant.swift | 4 + trainerbox/pubspec.lock | 86 ++++++++++++-- trainerbox/pubspec.yaml | 4 - .../flutter/generated_plugin_registrant.cc | 6 + .../windows/flutter/generated_plugins.cmake | 2 + 8 files changed, 175 insertions(+), 35 deletions(-) create mode 100644 trainerbox/images/arrowLinks.png create mode 100644 trainerbox/images/arrowRechts.png diff --git a/trainerbox/images/arrowLinks.png b/trainerbox/images/arrowLinks.png new file mode 100644 index 0000000000000000000000000000000000000000..f7e0bd0a6b2782c37693a9ffee8124c9a9b8d39e GIT binary patch literal 1640 zcmWladpy%?9LJx{%8=Vs%yoGkN19u%r?940G95B^Crs|jCHJGr%)R82y9$TXMVMQ< z(Ja!)rASeVWh4^T+A$i=Z-0E>-{pNdSPf?MVU&%2ZJx zcS7vJ`3^uyBJ!k1GypO^qJXg??)pO_I_9{0j8jBlOuTPY0Emx|*AEFl7wzX88K55# z6?A>sQW=09d|QIGbHa`9pS-e)TvS=ymGbgfz9uTITJfybsEL;3KUot}PR1V!irs_g zPwceX#`N!*o=?5mj=g9w)Im6{?QSQ5@Y-u6H^$d=3)YFC4c3hA{}>ndCFZjyV{m!c zc-}H%Uf4B0V41m@M0poPL8tFdoV2(S)_!ja-hf!%vE^E^Px|6=mCIzu?KAWjv1WV5 z)067P91~=E^~r&oO{ZDd$0b1*H`auxg=cgxtK2Iaq?LQ!SBN~^o8&5op$d<4(H=N2mx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iVoLj zK%ZV$zJ+@yV4ds*zRN@VbZJM003oyX&_FiX8H1)1Mr~=po4g-`4jZr_%qQCjRHC4% zj72dM-_h;Kv7?J;Q#)@LPH+3IId$#f%j%ygv-WeU9k}h~GIYI_8_rbL_C)sE z@b)d5Bba8I6pQ0A+8I2MdKKIFdvwL7O3`4bu5u{H3ORSh0`WCJ;5OxcA|Oyx8+We= zo9uRKU89tTP^FRKHb9roz_ma3XyQr}>^1vLG3fyj==ld$PHp4USDyGM;dsEL`{uy3 zedhAR=9SljZLb>*YB`lUNKQc09o8BVOXJ;Sv-u&_Vnff>aCO(jgayC!{pc3sFkPXH zUh6(~Lpn?xzS9bBj}&_JD#q1eo@iWolX54?m7B&4GqtXwfzKA)C_W%;B!eRWzg~T- zL6P@<3mTU|LQWE_tdTezqkNY{6thsMr!Yo`x3T){u&*3HKOchYvN~!ZB7u`LaOS64 zPl_`IT$I{6rjzE@98MF3sKD1kk4(Y69eq`=xq7@##qsY$+v15ITH0Z@r75 zP{wGvORHz^L~-KlgbHJ}2!T(dJ`em$U3>{CvXrM#$Aes#FkPDQL{rdrH@FUvJH4Y( zo_c8|ADGE^$LjLb^($;(7P})>ho|mUPgM&TLTby*`9Gf<8@Ml5m2*sakJTlwD+m93 zIkdT0Tsl`5f|$vzImn4h<*7al5{}}9xkw12Z>g> zHD&kPKS*LXCciP0d-r!b-246dA@-*?{Z6uauPSNeRL@Rfhi69G>bn~&(zJQ|bpFUD z0r%!zsrSaC?j-3a>ze5w8g14m$5Qn8&nl@dcciFD6cbZx$-UoYt$)jm{Hg$RxZ{hV S=D`{GqW~r&n10JQPVj$fuI)4c literal 0 HcmV?d00001 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 )