mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Start to build specific Forez tour
This commit is contained in:
		
							
								
								
									
										21
									
								
								lib/forez/forez_tour_builder.dart
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								lib/forez/forez_tour_builder.dart
									
									
									
									
									
										Normal 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(),
 | 
				
			||||||
 | 
					    ];
 | 
				
			||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
import 'dart:io';
 | 
					import 'dart:io';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import 'package:comunic/forez/forez_tour_builder.dart';
 | 
				
			||||||
import 'package:comunic/main.dart';
 | 
					import 'package:comunic/main.dart';
 | 
				
			||||||
import 'package:comunic/models/config.dart';
 | 
					import 'package:comunic/models/config.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
@@ -29,6 +30,7 @@ void main() {
 | 
				
			|||||||
    splashBackgroundColor: Colors.green.shade900,
 | 
					    splashBackgroundColor: Colors.green.shade900,
 | 
				
			||||||
    appName: "#Forez",
 | 
					    appName: "#Forez",
 | 
				
			||||||
    appQuickDescription: tr("Events organisation in Forez plain"),
 | 
					    appQuickDescription: tr("Events organisation in Forez plain"),
 | 
				
			||||||
 | 
					    toursEntriesBuilder: buildTour,
 | 
				
			||||||
  ));
 | 
					  ));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  HttpOverrides.global = new MyHttpOverride();
 | 
					  HttpOverrides.global = new MyHttpOverride();
 | 
				
			||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
import 'dart:ui';
 | 
					import 'dart:ui';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import 'package:comunic/ui/routes/tour_route.dart';
 | 
				
			||||||
import 'package:meta/meta.dart';
 | 
					import 'package:meta/meta.dart';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/// Application configuration model
 | 
					/// Application configuration model
 | 
				
			||||||
@@ -18,6 +19,9 @@ class Config {
 | 
				
			|||||||
  final String appName;
 | 
					  final String appName;
 | 
				
			||||||
  final String appQuickDescription;
 | 
					  final String appQuickDescription;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Entries for the welcome tour
 | 
				
			||||||
 | 
					  final TourEntriesBuilder toursEntriesBuilder;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const Config({
 | 
					  const Config({
 | 
				
			||||||
    @required this.apiServerName,
 | 
					    @required this.apiServerName,
 | 
				
			||||||
    @required this.apiServerUri,
 | 
					    @required this.apiServerUri,
 | 
				
			||||||
@@ -26,6 +30,7 @@ class Config {
 | 
				
			|||||||
    this.splashBackgroundColor = defaultColor,
 | 
					    this.splashBackgroundColor = defaultColor,
 | 
				
			||||||
    this.appName = "Comunic",
 | 
					    this.appName = "Comunic",
 | 
				
			||||||
    this.appQuickDescription,
 | 
					    this.appQuickDescription,
 | 
				
			||||||
 | 
					    this.toursEntriesBuilder,
 | 
				
			||||||
  })  : assert(apiServerName != null),
 | 
					  })  : assert(apiServerName != null),
 | 
				
			||||||
        assert(apiServerUri != null),
 | 
					        assert(apiServerUri != null),
 | 
				
			||||||
        assert(apiServerSecure != null),
 | 
					        assert(apiServerSecure != null),
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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_image_settings.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/settings/account_privacy_settings.dart';
 | 
					import 'package:comunic/ui/routes/settings/account_privacy_settings.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/settings/account_security_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/custom_emojies_account_settings.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/settings/general_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/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/ui/widgets/settings/header_spacer_section.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:comunic/utils/ui_utils.dart';
 | 
					import 'package:comunic/utils/ui_utils.dart';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
import 'package:comunic/helpers/preferences_helper.dart';
 | 
					import 'package:comunic/helpers/preferences_helper.dart';
 | 
				
			||||||
import 'package:comunic/helpers/users_helper.dart';
 | 
					import 'package:comunic/helpers/users_helper.dart';
 | 
				
			||||||
 | 
					import 'package:comunic/models/config.dart';
 | 
				
			||||||
import 'package:comunic/models/user.dart';
 | 
					import 'package:comunic/models/user.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/push_notifications_route.dart';
 | 
					import 'package:comunic/ui/routes/push_notifications_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/widgets/async_screen_widget.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)
 | 
					Future<void> showTour(BuildContext context) async => await Navigator.of(context)
 | 
				
			||||||
    .push(MaterialPageRoute(builder: (c) => TourRoute()));
 | 
					    .push(MaterialPageRoute(builder: (c) => TourRoute()));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					typedef TourEntriesBuilder = List<Widget> Function(TourRouteState);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TourRoute extends StatefulWidget {
 | 
					class TourRoute extends StatefulWidget {
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  _TourRouteState createState() => _TourRouteState();
 | 
					  TourRouteState createState() => TourRouteState();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class _TourRouteState extends State<TourRoute> {
 | 
					class TourRouteState extends State<TourRoute> {
 | 
				
			||||||
  final key = GlobalKey<AsyncScreenWidgetState>();
 | 
					  final _key = GlobalKey<AsyncScreenWidgetState>();
 | 
				
			||||||
  final _pushNotificationsKey =
 | 
					  final pushNotificationsKey =
 | 
				
			||||||
      GlobalKey<PushNotificationsConfigurationWidgetState>();
 | 
					      GlobalKey<PushNotificationsConfigurationWidgetState>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  User currUser;
 | 
					  User currUser;
 | 
				
			||||||
@@ -43,58 +46,60 @@ class _TourRouteState extends State<TourRoute> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  void setStateKeepCurrentIndex(BuildContext cxt) async {
 | 
					  void setStateKeepCurrentIndex(BuildContext cxt) async {
 | 
				
			||||||
    _defaultIndex = DefaultTabController.of(cxt).index;
 | 
					    _defaultIndex = DefaultTabController.of(cxt).index;
 | 
				
			||||||
    await key.currentState.refresh();
 | 
					    await _key.currentState.refresh();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  List<Widget> get _list => [
 | 
					  List<Widget> get _list => config().toursEntriesBuilder != null
 | 
				
			||||||
        FirstTourPane(),
 | 
					      ? config().toursEntriesBuilder(this)
 | 
				
			||||||
 | 
					      : [
 | 
				
			||||||
 | 
					          FirstTourPane(),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Account image
 | 
					          // Account image
 | 
				
			||||||
        AccountImageTourPane(
 | 
					          AccountImageTourPane(
 | 
				
			||||||
          user: currUser,
 | 
					            user: currUser,
 | 
				
			||||||
          onUpdated: setStateKeepCurrentIndex,
 | 
					            onUpdated: setStateKeepCurrentIndex,
 | 
				
			||||||
        ),
 | 
					          ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Notifications
 | 
					          // Notifications
 | 
				
			||||||
        TourNotificationsPane(
 | 
					          TourNotificationsPane(
 | 
				
			||||||
          pushNotificationsKey: _pushNotificationsKey,
 | 
					            pushNotificationsKey: pushNotificationsKey,
 | 
				
			||||||
          onConfigured: () => setState(() {}),
 | 
					            onConfigured: () => setState(() {}),
 | 
				
			||||||
          onChanged: () => setState(() {}),
 | 
					            onChanged: () => setState(() {}),
 | 
				
			||||||
        ),
 | 
					          ),
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        PresentationPane(
 | 
					          PresentationPane(
 | 
				
			||||||
          icon: Icons.group_add,
 | 
					            icon: Icons.group_add,
 | 
				
			||||||
          title: tr("Friends"),
 | 
					            title: tr("Friends"),
 | 
				
			||||||
          text: tr(
 | 
					            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!"),
 | 
					                "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(
 | 
					          PresentationPane(
 | 
				
			||||||
          icon: Icons.question_answer,
 | 
					            icon: Icons.question_answer,
 | 
				
			||||||
          title: tr("Conversations"),
 | 
					            title: tr("Conversations"),
 | 
				
			||||||
          text: tr(
 | 
					            text: tr(
 | 
				
			||||||
              "With Comunic, you can have conversations with all your friends.\n\nIt is also possible to make video calls!"),
 | 
					                "With Comunic, you can have conversations with all your friends.\n\nIt is also possible to make video calls!"),
 | 
				
			||||||
        ),
 | 
					          ),
 | 
				
			||||||
        PresentationPane(
 | 
					          PresentationPane(
 | 
				
			||||||
          icon: Icons.group,
 | 
					            icon: Icons.group,
 | 
				
			||||||
          title: tr("Groups"),
 | 
					            title: tr("Groups"),
 | 
				
			||||||
          text: tr(
 | 
					            text: tr(
 | 
				
			||||||
              "You can join groups where people share the same interests as you!\n\nIt is also easy to create your own groups!"),
 | 
					                "You can join groups where people share the same interests as you!\n\nIt is also easy to create your own groups!"),
 | 
				
			||||||
        ),
 | 
					          ),
 | 
				
			||||||
        PresentationPane(
 | 
					          PresentationPane(
 | 
				
			||||||
          icon: Icons.lock,
 | 
					            icon: Icons.lock,
 | 
				
			||||||
          title: tr("Privacy"),
 | 
					            title: tr("Privacy"),
 | 
				
			||||||
          text: tr(
 | 
					            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!"),
 | 
					                "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(),
 | 
					          LastTourPane(),
 | 
				
			||||||
      ];
 | 
					        ];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) => LoginRoutesTheme(
 | 
					  Widget build(BuildContext context) => LoginRoutesTheme(
 | 
				
			||||||
        child: Scaffold(
 | 
					        child: Scaffold(
 | 
				
			||||||
          body: SafeArea(
 | 
					          body: SafeArea(
 | 
				
			||||||
            child: AsyncScreenWidget(
 | 
					            child: AsyncScreenWidget(
 | 
				
			||||||
              key: key,
 | 
					              key: _key,
 | 
				
			||||||
              onReload: _init,
 | 
					              onReload: _init,
 | 
				
			||||||
              errorMessage: tr("Failed to load tour!"),
 | 
					              errorMessage: tr("Failed to load tour!"),
 | 
				
			||||||
              onBuild: () => DefaultTabController(
 | 
					              onBuild: () => DefaultTabController(
 | 
				
			||||||
@@ -6,10 +6,10 @@ import 'package:comunic/helpers/version_helper.dart';
 | 
				
			|||||||
import 'package:comunic/helpers/websocket_helper.dart';
 | 
					import 'package:comunic/helpers/websocket_helper.dart';
 | 
				
			||||||
import 'package:comunic/models/config.dart';
 | 
					import 'package:comunic/models/config.dart';
 | 
				
			||||||
import 'package:comunic/ui/dialogs/deprecation_dialog.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/main_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/routes/main_route/smartphone_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/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/routes/welcome_route.dart';
 | 
				
			||||||
import 'package:comunic/ui/widgets/login_routes_theme.dart';
 | 
					import 'package:comunic/ui/widgets/login_routes_theme.dart';
 | 
				
			||||||
import 'package:comunic/ui/widgets/safe_state.dart';
 | 
					import 'package:comunic/ui/widgets/safe_state.dart';
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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/ui/widgets/tour/fixed_tour_size_text_area.dart';
 | 
				
			||||||
import 'package:comunic/utils/intl_utils.dart';
 | 
					import 'package:comunic/utils/intl_utils.dart';
 | 
				
			||||||
import 'package:flutter/material.dart';
 | 
					import 'package:flutter/material.dart';
 | 
				
			||||||
@@ -7,6 +8,11 @@ import 'package:flutter/material.dart';
 | 
				
			|||||||
/// @author Pierre Hubert
 | 
					/// @author Pierre Hubert
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class FirstTourPane extends StatelessWidget {
 | 
					class FirstTourPane extends StatelessWidget {
 | 
				
			||||||
 | 
					  final String msgOne;
 | 
				
			||||||
 | 
					  final String msgTwo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  const FirstTourPane({Key key, this.msgOne, this.msgTwo}) : super(key: key);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  @override
 | 
					  @override
 | 
				
			||||||
  Widget build(BuildContext context) {
 | 
					  Widget build(BuildContext context) {
 | 
				
			||||||
    return Column(
 | 
					    return Column(
 | 
				
			||||||
@@ -14,15 +20,15 @@ class FirstTourPane extends StatelessWidget {
 | 
				
			|||||||
      children: <Widget>[
 | 
					      children: <Widget>[
 | 
				
			||||||
        Spacer(flex: 3),
 | 
					        Spacer(flex: 3),
 | 
				
			||||||
        Text(
 | 
					        Text(
 | 
				
			||||||
          "Comunic",
 | 
					          config().appName,
 | 
				
			||||||
          style: TextStyle(fontSize: 25),
 | 
					          style: TextStyle(fontSize: 25),
 | 
				
			||||||
        ),
 | 
					        ),
 | 
				
			||||||
        Spacer(flex: 2),
 | 
					        Spacer(flex: 2),
 | 
				
			||||||
        FixedTourSizeTextArea(tr(
 | 
					        FixedTourSizeTextArea(msgOne ??
 | 
				
			||||||
            "Welcome to Comunic, the social network that respect your privacy!")),
 | 
					            tr("Welcome to Comunic, the social network that respect your privacy!")),
 | 
				
			||||||
        Spacer(flex: 1),
 | 
					        Spacer(flex: 1),
 | 
				
			||||||
        FixedTourSizeTextArea(tr(
 | 
					        FixedTourSizeTextArea(msgTwo ??
 | 
				
			||||||
            "Let's configure a few things and present you some features of the network...")),
 | 
					            tr("Let's configure a few things and present you some features of the network...")),
 | 
				
			||||||
        Spacer(flex: 3),
 | 
					        Spacer(flex: 3),
 | 
				
			||||||
      ],
 | 
					      ],
 | 
				
			||||||
    );
 | 
					    );
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user