From 306271cfb563ba204a7543b8123d022de9f9b762 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 23 Apr 2021 14:05:06 +0200 Subject: [PATCH] Update notifications pane --- lib/ui/routes/TourRoute.dart | 15 +++------ .../widgets/tour/tour_notifications_pane.dart | 32 +++++++++++++++++++ 2 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 lib/ui/widgets/tour/tour_notifications_pane.dart diff --git a/lib/ui/routes/TourRoute.dart b/lib/ui/routes/TourRoute.dart index 0d79c4f..f31ddfa 100644 --- a/lib/ui/routes/TourRoute.dart +++ b/lib/ui/routes/TourRoute.dart @@ -8,6 +8,7 @@ import 'package:comunic/ui/widgets/tour/account_image_tour_pane.dart'; import 'package:comunic/ui/widgets/tour/first_pane.dart'; import 'package:comunic/ui/widgets/tour/last_pane.dart'; import 'package:comunic/ui/widgets/tour/presentation_pane.dart'; +import 'package:comunic/ui/widgets/tour/tour_notifications_pane.dart'; import 'package:comunic/utils/account_utils.dart'; import 'package:comunic/utils/intl_utils.dart'; import 'package:flutter/material.dart'; @@ -55,16 +56,10 @@ class _TourRouteState extends State { ), // Notifications - PresentationPane( - icon: Icons.notifications, - title: tr("Push notifications"), - child: (c) => PushNotificationsConfigurationWidget( - key: _pushNotificationsKey, - onConfigured: () => setState(() {}), - onChanged: () => setState(() {}), - ), - canGoNext: _pushNotificationsKey?.currentState?.canSubmit ?? false, - onTapNext: (c) => _pushNotificationsKey.currentState.submit(), + TourNotificationsPane( + pushNotificationsKey: _pushNotificationsKey, + onConfigured: () => setState(() {}), + onChanged: () => setState(() {}), ), PresentationPane( diff --git a/lib/ui/widgets/tour/tour_notifications_pane.dart b/lib/ui/widgets/tour/tour_notifications_pane.dart new file mode 100644 index 0000000..fc4ac9f --- /dev/null +++ b/lib/ui/widgets/tour/tour_notifications_pane.dart @@ -0,0 +1,32 @@ +import 'package:comunic/ui/routes/push_notifications_route.dart'; +import 'package:comunic/ui/widgets/tour/presentation_pane.dart'; +import 'package:comunic/utils/intl_utils.dart'; +import 'package:flutter/material.dart'; + +/// Tour notifications pane +/// +/// Invite the user to configure push notifications for its device +/// +/// @author Pierre Hubert + +class TourNotificationsPane extends PresentationPane { + TourNotificationsPane({ + Key key, + @required + GlobalKey + pushNotificationsKey, + @required Function() onConfigured, + @required Function() onChanged, + }) : assert(pushNotificationsKey != null), + super( + icon: Icons.notifications, + title: tr("Push notifications"), + child: (c) => PushNotificationsConfigurationWidget( + key: pushNotificationsKey, + onConfigured: onConfigured, + onChanged: onChanged, + ), + canGoNext: pushNotificationsKey?.currentState?.canSubmit ?? false, + onTapNext: (c) => pushNotificationsKey.currentState.submit(), + ); +}