6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit d9b4836a
Changed files
comwell_key_app/lib/common/system_ui.dart | 13 ++++++++ comwell_key_app/lib/key/key_page.dart | 10 +++--- .../components/current_booking_list_item_view.dart | 3 +- comwell_key_app/lib/overview/overview_page.dart | 25 ++++---------- .../profile/components/profile_page_widget.dart | 6 ++-- .../lib/routing/go_router_observer.dart | 39 ++++++++++++++++++++++ 6 files changed, 68 insertions(+), 28 deletions(-)
Diff
diff --git a/comwell_key_app/lib/common/system_ui.dart b/comwell_key_app/lib/common/system_ui.dart
new file mode 100644
index 00000000..b41296aa
--- /dev/null
+++ b/comwell_key_app/lib/common/system_ui.dart
@@ -0,0 +1,13 @@
+import 'package:flutter/services.dart';
+import 'package:flutter/material.dart';
+
+const SystemUiOverlayStyle kDefaultSystemUiOverlayStyle = SystemUiOverlayStyle(
+ statusBarColor: Colors.transparent,
+ statusBarBrightness: Brightness.dark,
+ systemStatusBarContrastEnforced: false,
+ systemNavigationBarColor: Colors.transparent,
+ systemNavigationBarDividerColor: Colors.transparent,
+ systemNavigationBarContrastEnforced: false,
+ systemNavigationBarIconBrightness: Brightness.dark,
+ statusBarIconBrightness: Brightness.dark,
+);
\ No newline at end of file
diff --git a/comwell_key_app/lib/key/key_page.dart b/comwell_key_app/lib/key/key_page.dart
index affc8245..47e04896 100644
--- a/comwell_key_app/lib/key/key_page.dart
+++ b/comwell_key_app/lib/key/key_page.dart
@@ -3,6 +3,7 @@ import 'package:comwell_key_app/key/bloc/key_bloc.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:focus_detector/focus_detector.dart';
import 'package:go_router/go_router.dart';
@@ -13,16 +14,15 @@ class KeyPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
- context.read<KeyBloc>().add(const StartScanning());
+ //context.read<KeyBloc>().add(const StartScanning());
return BlocBuilder<KeyBloc, KeyState>(builder: (context, state) {
//if (state.status == KeyStatus.scanning || state.status != KeyStatus.openClosestReaderSuccess) {
return FocusDetector(
- child: SafeArea(
- child: Scaffold(
+ child: Scaffold(
backgroundColor: Colors.black,
body: Padding(
- padding: const EdgeInsets.all(8.0),
+ padding: const EdgeInsets.fromLTRB(8, 60, 10, 32),
child: Column(
children: [
Stack(
@@ -78,7 +78,7 @@ class KeyPage extends StatelessWidget {
),
),
),
- ),
+
onFocusGained: () {
context.read<KeyBloc>().add(SetRootOpeningTrigger());
},
diff --git a/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart b/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
index d6f5870a..ff41b1ad 100644
--- a/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
+++ b/comwell_key_app/lib/overview/components/current_booking_list_item_view.dart
@@ -26,7 +26,8 @@ class CurrentBookingListItem extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: InkWell(
onTap: () =>
- context.pushNamed(AppRoutes.bookingDetails.name, extra: booking),
+ //context.pushNamed(AppRoutes.bookingDetails.name, extra: booking),
+ context.pushNamed(AppRoutes.key.name),
child: Column(
children: [
ClipRRect(
diff --git a/comwell_key_app/lib/overview/overview_page.dart b/comwell_key_app/lib/overview/overview_page.dart
index 910d9db7..366b6474 100644
--- a/comwell_key_app/lib/overview/overview_page.dart
+++ b/comwell_key_app/lib/overview/overview_page.dart
@@ -5,6 +5,7 @@ import 'package:comwell_key_app/overview/components/current_bookings_tab_view.da
import 'package:comwell_key_app/overview/cubit/overview_cubit.dart';
import 'package:comwell_key_app/overview/models/bookings.dart';
import 'package:comwell_key_app/routing/app_routes.dart';
+import 'package:comwell_key_app/routing/go_router_observer.dart';
import 'package:comwell_key_app/themes/light_theme.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
@@ -26,28 +27,16 @@ class OverviewTabViewState extends State<OverviewPage>
@override
void initState() {
super.initState();
+
_tabController = TabController(length: 3, vsync: this);
final OverviewCubit overviewCubit = BlocProvider.of<OverviewCubit>(context);
overviewCubit.fetchBookings();
-
- // Set specific system UI overlay style for this page
- SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
- statusBarColor: Colors.transparent,
- statusBarBrightness: Brightness.dark,
- systemStatusBarContrastEnforced: false,
- systemNavigationBarColor: Colors.transparent,
- systemNavigationBarDividerColor: Colors.transparent,
- systemNavigationBarContrastEnforced: false,
- systemNavigationBarIconBrightness: Brightness.dark,
- statusBarIconBrightness: Brightness.dark,
- ));
}
- @override
- void dispose() {
- _tabController.dispose();
- super.dispose();
- }
+
+
+
+
@override
Widget build(BuildContext context) {
@@ -121,7 +110,7 @@ class OverviewTabViewState extends State<OverviewPage>
cancelled: [], current: [], past: [])),
],
Padding(
- padding: const EdgeInsets.only(top: 6.0, bottom: 8.0),
+ padding: const EdgeInsets.only(top: 16.0, bottom: 24.0),
child: OutlinedButton.icon(
onPressed: () async {
context.pushNamed(AppRoutes.findBooking.name);
diff --git a/comwell_key_app/lib/profile/components/profile_page_widget.dart b/comwell_key_app/lib/profile/components/profile_page_widget.dart
index 18b8246a..02bccea3 100644
--- a/comwell_key_app/lib/profile/components/profile_page_widget.dart
+++ b/comwell_key_app/lib/profile/components/profile_page_widget.dart
@@ -24,11 +24,10 @@ class ProfilePageWidget extends StatelessWidget {
final user = cubit.state.user;
final isActive = cubit.state.user!.clubLevel != '';
- return SafeArea(
- child: Column(
+ return Column(
children: [
Padding(
- padding: const EdgeInsets.only(top: 20),
+ padding: const EdgeInsets.only(top: 60, right: 10),
child: Container(
alignment: Alignment.centerRight,
child: RoundIconButton(
@@ -210,7 +209,6 @@ class ProfilePageWidget extends StatelessWidget {
),
),
],
- ),
);
}
}
diff --git a/comwell_key_app/lib/routing/go_router_observer.dart b/comwell_key_app/lib/routing/go_router_observer.dart
index b581c6d4..76068a45 100644
--- a/comwell_key_app/lib/routing/go_router_observer.dart
+++ b/comwell_key_app/lib/routing/go_router_observer.dart
@@ -1,12 +1,38 @@
import 'package:comwell_key_app/tracking/comwell_tracking.dart';
import 'package:comwell_key_app/utils/locator.dart';
import 'package:flutter/material.dart';
+import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
+import 'package:comwell_key_app/common/system_ui.dart';
+import 'package:flutter/foundation.dart';
+import 'dart:io' show Platform;
+
+final Map<String, SystemUiOverlayStyle> routeSystemUiStyles = {
+ 'overview': kDefaultSystemUiOverlayStyle,
+ // Example custom style for login page:
+ 'login': const SystemUiOverlayStyle(
+ statusBarColor: Colors.black,
+ systemNavigationBarColor: Colors.black,
+ statusBarIconBrightness: Brightness.light,
+ systemNavigationBarIconBrightness: Brightness.light,
+ ),
+ // Custom style for key page:
+ 'key': const SystemUiOverlayStyle(
+ statusBarColor: Colors.black,
+ systemNavigationBarColor: Colors.black,
+ statusBarIconBrightness: Brightness.light,
+ systemNavigationBarIconBrightness: Brightness.light,
+ ),
+ // Add more custom styles as needed
+};
class GoRouterObserver extends NavigatorObserver {
+
+
@override
void didPush(Route<dynamic> route, Route<dynamic>? previousRoute) {
debugPrint('DidPush: $route');
+ _setSystemUiForRoute(route);
final routeName = route.settings.name ?? 'Unknown';
locator<ComwellTracking>()
.trackScreenView('$routeName - page', getPath(routeName));
@@ -14,6 +40,9 @@ class GoRouterObserver extends NavigatorObserver {
@override
void didPop(Route<dynamic> route, Route<dynamic>? previousRoute) {
+ if (previousRoute != null) {
+ _setSystemUiForRoute(previousRoute);
+ }
final parentRouteName = previousRoute?.settings.name ?? 'Unknown';
final trackInfo = '$parentRouteName - page';
final trackPath = getPath(parentRouteName);
@@ -30,8 +59,18 @@ class GoRouterObserver extends NavigatorObserver {
void didReplace({Route<dynamic>? newRoute, Route<dynamic>? oldRoute}) {
debugPrint('DidReplace: $newRoute');
}
+ void _setSystemUiForRoute(Route<dynamic> route) {
+ // Only apply custom system UI styles on Android
+ if (!Platform.isAndroid) return;
+
+ final routeName = route.settings.name ?? '';
+ final style = routeSystemUiStyles[routeName] ?? kDefaultSystemUiOverlayStyle;
+ SystemChrome.setSystemUIOverlayStyle(style);
+ }
}
+
+
String getPath(String routeName) {
switch (routeName) {
case 'overview':