From 532d2412e39336c7c99aab56a69ccff7ff789733 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Sat, 17 Apr 2021 19:29:22 +0200 Subject: [PATCH] Fix overflow --- lib/ui/routes/TourRoute.dart | 20 +++-------------- lib/ui/routes/push_notifications_route.dart | 25 +++++++++------------ 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/lib/ui/routes/TourRoute.dart b/lib/ui/routes/TourRoute.dart index 7063507..86c942f 100644 --- a/lib/ui/routes/TourRoute.dart +++ b/lib/ui/routes/TourRoute.dart @@ -269,23 +269,9 @@ class _PresentationPane extends StatelessWidget { style: TextStyle(fontSize: 20), ), Spacer(flex: 1), - child(context), - Spacer(flex: 1), - _hasAction - ? OutlinedButton( - onPressed: () => onActionTap(context), - child: Text( - actionTitle, - style: TextStyle(color: Colors.white), - ), - ) - : Opacity( - opacity: 0, - child: OutlinedButton( - onPressed: null, - child: Text(""), - ), - ), + ConstrainedBox( + constraints: BoxConstraints(maxHeight: 300), + child: SingleChildScrollView(child: child(context))), Spacer(flex: 1), ], ); diff --git a/lib/ui/routes/push_notifications_route.dart b/lib/ui/routes/push_notifications_route.dart index 97e836a..92fadca 100644 --- a/lib/ui/routes/push_notifications_route.dart +++ b/lib/ui/routes/push_notifications_route.dart @@ -46,11 +46,6 @@ class _PushNotificationsConfigurationRouteState Spacer(), Icon(Icons.notifications_none, color: Colors.white), Spacer(), - Text( - tr("Comunic can send you notifications to your device when the application is closed if you want."), - textAlign: TextAlign.center, - ), - Spacer(), PushNotificationsConfigurationWidget( key: _key, onConfigured: () => (Navigator.of(context).pop()), @@ -118,10 +113,14 @@ class PushNotificationsConfigurationWidgetState constraints: BoxConstraints(maxWidth: 300), child: Column( children: [ + Text( + tr("Comunic can send you push notifications to your device."), + textAlign: TextAlign.center, + ), + SizedBox(height: 10), _NotificationOption( title: tr("Use Google services (recommended)"), - description: tr( - "Use the Google Play services to send you notifications. This option is less privacy-friendly, but it will work on most phones and will save your battery life."), + description: tr("Save your battery life."), option: PushNotificationsStatus.FIREBASE, current: currStatus, available: srvConfig.notificationsPolicy.hasFirebase, @@ -132,8 +131,7 @@ class PushNotificationsConfigurationWidgetState ), _NotificationOption( title: tr("Use independent notifications service"), - description: tr( - "Configure Comunic to use our own self-hosted notifications service. This option is much more privacy-friendly, but it will drain your battery."), + description: tr("Protect more your privacy."), option: PushNotificationsStatus.INDEPENDENT, current: currStatus, available: @@ -145,8 +143,6 @@ class PushNotificationsConfigurationWidgetState ), _NotificationOption( title: tr("Do not send notification"), - description: tr( - "Disable notifications service. You will always be able to change it from application settings."), option: PushNotificationsStatus.DISABLED, current: currStatus, available: true, @@ -214,13 +210,12 @@ class _NotificationOption extends StatelessWidget { const _NotificationOption({ Key key, @required this.title, - @required this.description, + this.description, @required this.option, @required this.current, @required this.available, @required this.onChanged, }) : assert(title != null), - assert(description != null), assert(option != null), assert(current != null), assert(available != null), @@ -242,7 +237,9 @@ class _NotificationOption extends StatelessWidget { fillColor: MaterialStateProperty.all(Colors.white), ), title: Text(title, style: TextStyle(color: Colors.white)), - subtitle: Text(description, style: TextStyle(color: Colors.white)), + subtitle: description == null + ? null + : Text(description, style: TextStyle(color: Colors.white)), contentPadding: EdgeInsets.all(0), onTap: () => onChanged(option), ),