1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-12-26 12:58:51 +00:00

Start to build specific Forez tour

This commit is contained in:
Pierre HUBERT 2021-04-23 18:11:17 +02:00
parent e78afa290c
commit 1fa4ed59d4
7 changed files with 91 additions and 52 deletions

View File

@ -0,0 +1,21 @@
import 'package:comunic/ui/routes/tour_route.dart';
import 'package:comunic/ui/widgets/tour/first_pane.dart';
import 'package:comunic/ui/widgets/tour/last_pane.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart';
/// Forez tour builder
///
/// Handles the presentation tour for the Forez flavor application
///
/// @author Pierre Hubert
List<Widget> buildTour(TourRouteState state) => [
FirstTourPane(
msgOne: tr(
"Welcome to #Forez, the central application dedicated to events planning in the Forez plain!"),
msgTwo: tr(
"Let's configure the application and present you some features!"),
),
LastTourPane(),
];

View File

@ -1,5 +1,6 @@
import 'dart:io';
import 'package:comunic/forez/forez_tour_builder.dart';
import 'package:comunic/main.dart';
import 'package:comunic/models/config.dart';
import 'package:comunic/utils/intl_utils.dart';
@ -29,6 +30,7 @@ void main() {
splashBackgroundColor: Colors.green.shade900,
appName: "#Forez",
appQuickDescription: tr("Events organisation in Forez plain"),
toursEntriesBuilder: buildTour,
));
HttpOverrides.global = new MyHttpOverride();

View File

@ -1,5 +1,6 @@
import 'dart:ui';
import 'package:comunic/ui/routes/tour_route.dart';
import 'package:meta/meta.dart';
/// Application configuration model
@ -18,6 +19,9 @@ class Config {
final String appName;
final String appQuickDescription;
// Entries for the welcome tour
final TourEntriesBuilder toursEntriesBuilder;
const Config({
@required this.apiServerName,
@required this.apiServerUri,
@ -26,6 +30,7 @@ class Config {
this.splashBackgroundColor = defaultColor,
this.appName = "Comunic",
this.appQuickDescription,
this.toursEntriesBuilder,
}) : assert(apiServerName != null),
assert(apiServerUri != null),
assert(apiServerSecure != null),

View File

@ -1,4 +1,3 @@
import 'package:comunic/ui/routes/TourRoute.dart';
import 'package:comunic/ui/routes/settings/account_image_settings.dart';
import 'package:comunic/ui/routes/settings/account_privacy_settings.dart';
import 'package:comunic/ui/routes/settings/account_security_settings.dart';
@ -6,6 +5,7 @@ import 'package:comunic/ui/routes/settings/application_settings.dart';
import 'package:comunic/ui/routes/settings/custom_emojies_account_settings.dart';
import 'package:comunic/ui/routes/settings/general_account_settings.dart';
import 'package:comunic/ui/routes/settings/notifications_settings.dart';
import 'package:comunic/ui/routes/tour_route.dart';
import 'package:comunic/ui/widgets/settings/header_spacer_section.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';

View File

@ -1,5 +1,6 @@
import 'package:comunic/helpers/preferences_helper.dart';
import 'package:comunic/helpers/users_helper.dart';
import 'package:comunic/models/config.dart';
import 'package:comunic/models/user.dart';
import 'package:comunic/ui/routes/push_notifications_route.dart';
import 'package:comunic/ui/widgets/async_screen_widget.dart';
@ -22,14 +23,16 @@ import 'package:flutter/material.dart';
Future<void> showTour(BuildContext context) async => await Navigator.of(context)
.push(MaterialPageRoute(builder: (c) => TourRoute()));
typedef TourEntriesBuilder = List<Widget> Function(TourRouteState);
class TourRoute extends StatefulWidget {
@override
_TourRouteState createState() => _TourRouteState();
TourRouteState createState() => TourRouteState();
}
class _TourRouteState extends State<TourRoute> {
final key = GlobalKey<AsyncScreenWidgetState>();
final _pushNotificationsKey =
class TourRouteState extends State<TourRoute> {
final _key = GlobalKey<AsyncScreenWidgetState>();
final pushNotificationsKey =
GlobalKey<PushNotificationsConfigurationWidgetState>();
User currUser;
@ -43,58 +46,60 @@ class _TourRouteState extends State<TourRoute> {
void setStateKeepCurrentIndex(BuildContext cxt) async {
_defaultIndex = DefaultTabController.of(cxt).index;
await key.currentState.refresh();
await _key.currentState.refresh();
}
List<Widget> get _list => [
FirstTourPane(),
List<Widget> get _list => config().toursEntriesBuilder != null
? config().toursEntriesBuilder(this)
: [
FirstTourPane(),
// Account image
AccountImageTourPane(
user: currUser,
onUpdated: setStateKeepCurrentIndex,
),
// Account image
AccountImageTourPane(
user: currUser,
onUpdated: setStateKeepCurrentIndex,
),
// Notifications
TourNotificationsPane(
pushNotificationsKey: _pushNotificationsKey,
onConfigured: () => setState(() {}),
onChanged: () => setState(() {}),
),
// Notifications
TourNotificationsPane(
pushNotificationsKey: pushNotificationsKey,
onConfigured: () => setState(() {}),
onChanged: () => setState(() {}),
),
PresentationPane(
icon: Icons.group_add,
title: tr("Friends"),
text: tr(
"You can search the people you know and ask them to become your friends!\n\nThis will help you to reach them to exchange information!"),
),
PresentationPane(
icon: Icons.question_answer,
title: tr("Conversations"),
text: tr(
"With Comunic, you can have conversations with all your friends.\n\nIt is also possible to make video calls!"),
),
PresentationPane(
icon: Icons.group,
title: tr("Groups"),
text: tr(
"You can join groups where people share the same interests as you!\n\nIt is also easy to create your own groups!"),
),
PresentationPane(
icon: Icons.lock,
title: tr("Privacy"),
text: tr(
"Your data is YOUR DATA. We will never use it or sell it.\n\nIf you do not trust us, you can always check out our source code to verify it!"),
),
LastTourPane(),
];
PresentationPane(
icon: Icons.group_add,
title: tr("Friends"),
text: tr(
"You can search the people you know and ask them to become your friends!\n\nThis will help you to reach them to exchange information!"),
),
PresentationPane(
icon: Icons.question_answer,
title: tr("Conversations"),
text: tr(
"With Comunic, you can have conversations with all your friends.\n\nIt is also possible to make video calls!"),
),
PresentationPane(
icon: Icons.group,
title: tr("Groups"),
text: tr(
"You can join groups where people share the same interests as you!\n\nIt is also easy to create your own groups!"),
),
PresentationPane(
icon: Icons.lock,
title: tr("Privacy"),
text: tr(
"Your data is YOUR DATA. We will never use it or sell it.\n\nIf you do not trust us, you can always check out our source code to verify it!"),
),
LastTourPane(),
];
@override
Widget build(BuildContext context) => LoginRoutesTheme(
child: Scaffold(
body: SafeArea(
child: AsyncScreenWidget(
key: key,
key: _key,
onReload: _init,
errorMessage: tr("Failed to load tour!"),
onBuild: () => DefaultTabController(

View File

@ -6,10 +6,10 @@ import 'package:comunic/helpers/version_helper.dart';
import 'package:comunic/helpers/websocket_helper.dart';
import 'package:comunic/models/config.dart';
import 'package:comunic/ui/dialogs/deprecation_dialog.dart';
import 'package:comunic/ui/routes/TourRoute.dart';
import 'package:comunic/ui/routes/main_route/main_route.dart';
import 'package:comunic/ui/routes/main_route/smartphone_route.dart';
import 'package:comunic/ui/routes/main_route/tablet_route.dart';
import 'package:comunic/ui/routes/tour_route.dart';
import 'package:comunic/ui/routes/welcome_route.dart';
import 'package:comunic/ui/widgets/login_routes_theme.dart';
import 'package:comunic/ui/widgets/safe_state.dart';

View File

@ -1,3 +1,4 @@
import 'package:comunic/models/config.dart';
import 'package:comunic/ui/widgets/tour/fixed_tour_size_text_area.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart';
@ -7,6 +8,11 @@ import 'package:flutter/material.dart';
/// @author Pierre Hubert
class FirstTourPane extends StatelessWidget {
final String msgOne;
final String msgTwo;
const FirstTourPane({Key key, this.msgOne, this.msgTwo}) : super(key: key);
@override
Widget build(BuildContext context) {
return Column(
@ -14,15 +20,15 @@ class FirstTourPane extends StatelessWidget {
children: <Widget>[
Spacer(flex: 3),
Text(
"Comunic",
config().appName,
style: TextStyle(fontSize: 25),
),
Spacer(flex: 2),
FixedTourSizeTextArea(tr(
"Welcome to Comunic, the social network that respect your privacy!")),
FixedTourSizeTextArea(msgOne ??
tr("Welcome to Comunic, the social network that respect your privacy!")),
Spacer(flex: 1),
FixedTourSizeTextArea(tr(
"Let's configure a few things and present you some features of the network...")),
FixedTourSizeTextArea(msgTwo ??
tr("Let's configure a few things and present you some features of the network...")),
Spacer(flex: 3),
],
);