Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement edge to edge on android #1086

Merged
merged 5 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/features/app/widgets/base_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/material.dart';

// Package imports:
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

// Project imports:
Expand Down Expand Up @@ -84,7 +85,7 @@ class _BaseScaffoldState extends State<BaseScaffold> {
});
});
}

@override
Widget build(BuildContext context) => Scaffold(
body: Scaffold(
Expand All @@ -106,6 +107,8 @@ class _BaseScaffoldState extends State<BaseScaffold> {
);

Widget bodyPortraitMode() {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);

return SafeArea(
top: false,
bottom: widget._safeArea,
Expand All @@ -124,6 +127,8 @@ class _BaseScaffoldState extends State<BaseScaffold> {
}

Widget bodyLandscapeMode() {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.leanBack);

return Stack(
children: [
Row(
Expand Down
13 changes: 13 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import 'package:calendar_view/calendar_view.dart';
import 'package:feedback/feedback.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:provider/provider.dart';
Expand Down Expand Up @@ -64,6 +65,7 @@ class ETSMobile extends StatelessWidget {

@override
Widget build(BuildContext context) {
addEdgeToEdgeEffect();
final RemoteConfigService remoteConfigService =
locator<RemoteConfigService>();
final bool outage = remoteConfigService.outage;
Expand Down Expand Up @@ -111,4 +113,15 @@ class ETSMobile extends StatelessWidget {
}),
);
}

void addEdgeToEdgeEffect() {
SystemChrome.setSystemUIOverlayStyle(const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
systemNavigationBarContrastEnforced: false,
systemNavigationBarIconBrightness: Brightness.dark,
statusBarColor: Colors.transparent,
statusBarBrightness: Brightness.light,
statusBarIconBrightness: Brightness.dark,
));
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: The 4th generation of ÉTSMobile, the main gateway between the Éco
# pub.dev using `pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 4.54.1
version: 4.55.0

environment:
sdk: '>=3.3.0 <4.0.0'
Expand Down
Loading