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

feat: Edge to edge mode on Android #5378

Merged
merged 1 commit into from
Jun 15, 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
13 changes: 13 additions & 0 deletions packages/smooth_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ Future<void> launchSmoothApp({
WidgetsFlutterBinding.ensureInitialized();
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);

_enableEdgeToEdgeMode();

if (kReleaseMode) {
await AnalyticsHelper.initSentry(
appRunner: () => runApp(const SmoothApp()));
Expand All @@ -89,6 +91,17 @@ Future<void> launchSmoothApp({
}
}

void _enableEdgeToEdgeMode() {
if (Platform.isAndroid) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
),
);
}
}

class SmoothApp extends StatefulWidget {
const SmoothApp();

Expand Down
127 changes: 65 additions & 62 deletions packages/smooth_app/lib/pages/onboarding/consent_analytics_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand All @@ -24,72 +26,73 @@ class ConsentAnalyticsPage extends StatelessWidget {
final AppLocalizations appLocalizations = AppLocalizations.of(context);
return ColoredBox(
color: backgroundColor,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: LARGE_SPACE),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SvgPicture.asset(
'assets/onboarding/analytics.svg',
width: screenSize.width * .50,
package: AppHelper.APP_PACKAGE,
),
const SizedBox(height: LARGE_SPACE),
AutoSizeText(
appLocalizations.consent_analytics_title,
maxLines: 2,
style: Theme.of(context)
.textTheme
.displayLarge!
.apply(color: const Color.fromARGB(255, 51, 51, 51)),
textAlign: TextAlign.center,
),
const SizedBox(height: SMALL_SPACE),
AutoSizeText(
appLocalizations.consent_analytics_body1,
maxLines: 3,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
const SizedBox(height: SMALL_SPACE),
AutoSizeText(
appLocalizations.consent_analytics_body2,
maxLines: 3,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
],
child: SafeArea(
bottom: Platform.isAndroid,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: LARGE_SPACE),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
SvgPicture.asset(
'assets/onboarding/analytics.svg',
width: screenSize.width * .50,
package: AppHelper.APP_PACKAGE,
),
const SizedBox(height: LARGE_SPACE),
AutoSizeText(
appLocalizations.consent_analytics_title,
maxLines: 2,
style: Theme.of(context).textTheme.displayLarge!.apply(
color: const Color.fromARGB(255, 51, 51, 51)),
textAlign: TextAlign.center,
),
const SizedBox(height: SMALL_SPACE),
AutoSizeText(
appLocalizations.consent_analytics_body1,
maxLines: 3,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
const SizedBox(height: SMALL_SPACE),
AutoSizeText(
appLocalizations.consent_analytics_body2,
maxLines: 3,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
],
),
),
),
),
),
OnboardingBottomBar(
rightButton: _buildButton(
context,
appLocalizations.refuse_button_label,
false,
const Color(0xFFA08D84),
Colors.white,
),
leftButton: _buildButton(
context,
appLocalizations.authorize_button_label,
true,
Colors.white,
Colors.black,
OnboardingBottomBar(
rightButton: _buildButton(
context,
appLocalizations.refuse_button_label,
false,
const Color(0xFFA08D84),
Colors.white,
),
leftButton: _buildButton(
context,
appLocalizations.authorize_button_label,
true,
Colors.white,
Colors.black,
),
backgroundColor: backgroundColor,
semanticsHorizontalOrder: false,
),
backgroundColor: backgroundColor,
semanticsHorizontalOrder: false,
),
],
],
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class _KnowledgePanelPageTemplateState
product: _product,
onboardingMode: true,
);
return Container(
return ColoredBox(
color: widget.backgroundColor,
child: SafeArea(
bottom: Platform.isAndroid,
Expand Down
117 changes: 60 additions & 57 deletions packages/smooth_app/lib/pages/onboarding/permissions_page.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import 'dart:io';

import 'package:auto_size_text/auto_size_text.dart';
import 'package:flutter/material.dart' hide Listener;
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -46,64 +48,65 @@ class _PermissionsPageState extends State<PermissionsPage> {
},
child: ColoredBox(
color: widget.backgroundColor,
child: Column(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: LARGE_SPACE),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LayoutBuilder(builder:
(BuildContext context, BoxConstraints constraints) {
return SizedBox.square(
dimension: constraints.maxWidth * 0.5,
child: Transform.rotate(
angle: -0.2,
child: const animations.BarcodeAnimation(),
),
);
}),
const SizedBox(height: LARGE_SPACE),
AutoSizeText(
appLocalizations.permissions_page_title,
maxLines: 2,
style: Theme.of(context)
.textTheme
.displayLarge!
.apply(color: const Color.fromARGB(255, 51, 51, 51)),
textAlign: TextAlign.center,
),
const SizedBox(height: SMALL_SPACE),
AutoSizeText(
appLocalizations.permissions_page_body1,
maxLines: 2,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
const SizedBox(height: MEDIUM_SPACE),
AutoSizeText(
appLocalizations.permissions_page_body2,
maxLines: 3,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
],
child: SafeArea(
bottom: Platform.isAndroid,
child: Column(
children: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: LARGE_SPACE),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
LayoutBuilder(builder:
(BuildContext context, BoxConstraints constraints) {
return SizedBox.square(
dimension: constraints.maxWidth * 0.5,
child: Transform.rotate(
angle: -0.2,
child: const animations.BarcodeAnimation(),
),
);
}),
const SizedBox(height: LARGE_SPACE),
AutoSizeText(
appLocalizations.permissions_page_title,
maxLines: 2,
style: Theme.of(context).textTheme.displayLarge!.apply(
color: const Color.fromARGB(255, 51, 51, 51)),
textAlign: TextAlign.center,
),
const SizedBox(height: SMALL_SPACE),
AutoSizeText(
appLocalizations.permissions_page_body1,
maxLines: 2,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
const SizedBox(height: MEDIUM_SPACE),
AutoSizeText(
appLocalizations.permissions_page_body2,
maxLines: 3,
textAlign: TextAlign.center,
style: WellSpacedTextHelper.TEXT_STYLE_WITH_WELL_SPACED,
),
],
),
),
)),
OnboardingBottomBar(
rightButton: _IgnoreButton(
onPermissionIgnored: () => _moveToNextScreen(context),
),
leftButton: _AskPermissionButton(
onPermissionIgnored: () => _moveToNextScreen(context),
),
),
)),
OnboardingBottomBar(
rightButton: _IgnoreButton(
onPermissionIgnored: () => _moveToNextScreen(context),
),
leftButton: _AskPermissionButton(
onPermissionIgnored: () => _moveToNextScreen(context),
),
backgroundColor: widget.backgroundColor,
semanticsHorizontalOrder: false,
)
],
backgroundColor: widget.backgroundColor,
semanticsHorizontalOrder: false,
)
],
),
),
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ReinventionPage extends StatelessWidget {
final Size screenSize = MediaQuery.sizeOf(context);
final double animHeight = 352.0 * screenSize.width / 375.0;

return Container(
return ColoredBox(
color: backgroundColor,
child: SafeArea(
bottom: false,
Expand Down
Loading