mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 12:59:21 +00:00
Start to update tour route
This commit is contained in:
parent
a022e8bfd1
commit
46f9c917b5
@ -1,4 +1,5 @@
|
|||||||
import 'package:comunic/models/api_request.dart';
|
import 'package:comunic/models/api_request.dart';
|
||||||
|
import 'package:comunic/models/config.dart';
|
||||||
import 'package:comunic/ui/dialogs/record_audio_dialog.dart';
|
import 'package:comunic/ui/dialogs/record_audio_dialog.dart';
|
||||||
import 'package:comunic/ui/routes/image_editor_route.dart';
|
import 'package:comunic/ui/routes/image_editor_route.dart';
|
||||||
import 'package:comunic/utils/files_utils.dart';
|
import 'package:comunic/utils/files_utils.dart';
|
||||||
@ -202,6 +203,7 @@ class _BottomSheetPickOption extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Container(
|
Widget build(BuildContext context) => Container(
|
||||||
|
color: config().splashBackgroundColor,
|
||||||
height: 255,
|
height: 255,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
@ -209,8 +211,9 @@ class _BottomSheetPickOption extends StatelessWidget {
|
|||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: options.length,
|
itemCount: options.length,
|
||||||
itemBuilder: (c, i) => ListTile(
|
itemBuilder: (c, i) => ListTile(
|
||||||
leading: Icon(options[i].icon),
|
leading: Icon(options[i].icon, color: Colors.white),
|
||||||
title: Text(options[i].label),
|
title: Text(options[i].label,
|
||||||
|
style: TextStyle(color: Colors.white)),
|
||||||
onTap: () => onOptionSelected(options[i].value),
|
onTap: () => onOptionSelected(options[i].value),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -2,10 +2,12 @@ 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/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/routes/settings/account_image_settings.dart';
|
|
||||||
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
|
||||||
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
import 'package:comunic/ui/widgets/async_screen_widget.dart';
|
||||||
import 'package:comunic/ui/widgets/login_routes_theme.dart';
|
import 'package:comunic/ui/widgets/login_routes_theme.dart';
|
||||||
|
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/utils/account_utils.dart';
|
import 'package:comunic/utils/account_utils.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';
|
||||||
@ -39,24 +41,13 @@ class _TourRouteState extends State<TourRoute> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Widget> get _list => [
|
List<Widget> get _list => [
|
||||||
_FirstPane(),
|
FirstTourPane(),
|
||||||
|
|
||||||
// Account image
|
// Account image
|
||||||
_PresentationPane(
|
AccountImageTourPane(user: currUser),
|
||||||
iconWidget: AccountImageWidget(user: currUser, width: 50),
|
|
||||||
title: tr("Account image"),
|
|
||||||
text: tr(
|
|
||||||
"Account image allow to quickly recognize people.\n\nYou can decide to define one now!"),
|
|
||||||
actionTitle: tr("Upload an account image"),
|
|
||||||
onActionTap: (ctx) async {
|
|
||||||
await uploadNewAccountImage(context);
|
|
||||||
_defaultIndex = DefaultTabController.of(ctx).index;
|
|
||||||
await key.currentState.refresh();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
|
|
||||||
// Notifications
|
// Notifications
|
||||||
_PresentationPane(
|
PresentationPane(
|
||||||
icon: Icons.notifications,
|
icon: Icons.notifications,
|
||||||
title: tr("Push notifications"),
|
title: tr("Push notifications"),
|
||||||
child: (c) => PushNotificationsConfigurationWidget(
|
child: (c) => PushNotificationsConfigurationWidget(
|
||||||
@ -68,31 +59,31 @@ class _TourRouteState extends State<TourRoute> {
|
|||||||
onTapNext: (c) => _pushNotificationsKey.currentState.submit(),
|
onTapNext: (c) => _pushNotificationsKey.currentState.submit(),
|
||||||
),
|
),
|
||||||
|
|
||||||
_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!"),
|
||||||
),
|
),
|
||||||
_LastPane(),
|
LastTourPane(),
|
||||||
];
|
];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -130,8 +121,8 @@ class __RouteBodyState extends State<_RouteBody> {
|
|||||||
|
|
||||||
bool get _isLastPane => _controller.index >= widget.panes.length - 1;
|
bool get _isLastPane => _controller.index >= widget.panes.length - 1;
|
||||||
|
|
||||||
_PresentationPane get _currPane =>
|
PresentationPane get _currPane =>
|
||||||
widget.panes[_controller.index] is _PresentationPane
|
widget.panes[_controller.index] is PresentationPane
|
||||||
? widget.panes[_controller.index]
|
? widget.panes[_controller.index]
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
@ -195,132 +186,3 @@ class __RouteBodyState extends State<_RouteBody> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PresentationPane extends StatelessWidget {
|
|
||||||
final IconData icon;
|
|
||||||
final Widget iconWidget;
|
|
||||||
final String title;
|
|
||||||
final String text;
|
|
||||||
final Function(BuildContext) child;
|
|
||||||
final String actionTitle;
|
|
||||||
final Function(BuildContext) onActionTap;
|
|
||||||
final bool canGoNext;
|
|
||||||
final Future<bool> Function(BuildContext) onTapNext;
|
|
||||||
|
|
||||||
const _PresentationPane({
|
|
||||||
Key key,
|
|
||||||
this.icon,
|
|
||||||
this.iconWidget,
|
|
||||||
@required this.title,
|
|
||||||
this.text,
|
|
||||||
this.child,
|
|
||||||
this.actionTitle,
|
|
||||||
this.onActionTap,
|
|
||||||
this.canGoNext = true,
|
|
||||||
this.onTapNext,
|
|
||||||
}) : assert(icon != null || iconWidget != null),
|
|
||||||
assert(title != null),
|
|
||||||
assert(text != null || child != null),
|
|
||||||
super(key: key);
|
|
||||||
|
|
||||||
bool get _hasAction => actionTitle != null && onActionTap != null;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
if (text != null)
|
|
||||||
return Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Spacer(flex: 3),
|
|
||||||
icon != null ? Icon(icon, color: Colors.white, size: 50) : iconWidget,
|
|
||||||
Spacer(flex: 1),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: TextStyle(fontSize: 20),
|
|
||||||
),
|
|
||||||
Spacer(flex: 1),
|
|
||||||
_FixedSizeTextArea(text),
|
|
||||||
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(""),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Spacer(flex: 3),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
children: <Widget>[
|
|
||||||
Spacer(flex: 1),
|
|
||||||
icon != null ? Icon(icon, color: Colors.white, size: 50) : iconWidget,
|
|
||||||
Spacer(flex: 1),
|
|
||||||
Text(
|
|
||||||
title,
|
|
||||||
style: TextStyle(fontSize: 20),
|
|
||||||
),
|
|
||||||
Spacer(flex: 1),
|
|
||||||
ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxHeight: 300),
|
|
||||||
child: SingleChildScrollView(child: child(context))),
|
|
||||||
Spacer(flex: 1),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FirstPane extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: <Widget>[
|
|
||||||
Spacer(flex: 3),
|
|
||||||
Text(
|
|
||||||
"Comunic",
|
|
||||||
style: TextStyle(fontSize: 25),
|
|
||||||
),
|
|
||||||
Spacer(flex: 2),
|
|
||||||
_FixedSizeTextArea(tr(
|
|
||||||
"Welcome to Comunic, the social network that respect your privacy !")),
|
|
||||||
Spacer(flex: 1),
|
|
||||||
_FixedSizeTextArea(tr(
|
|
||||||
"Let's configure a few things and present you some features of the network...")),
|
|
||||||
Spacer(flex: 3),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _LastPane extends StatelessWidget {
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Center(
|
|
||||||
child: Text(
|
|
||||||
tr("The application is yours"),
|
|
||||||
style: TextStyle(fontSize: 25),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class _FixedSizeTextArea extends StatelessWidget {
|
|
||||||
final String text;
|
|
||||||
|
|
||||||
const _FixedSizeTextArea(this.text);
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) => ConstrainedBox(
|
|
||||||
constraints: BoxConstraints(maxWidth: 300),
|
|
||||||
child: Text(text, textAlign: TextAlign.justify),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
19
lib/ui/widgets/tour/account_image_tour_pane.dart
Normal file
19
lib/ui/widgets/tour/account_image_tour_pane.dart
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import 'package:comunic/models/user.dart';
|
||||||
|
import 'package:comunic/ui/routes/settings/account_image_settings.dart';
|
||||||
|
import 'package:comunic/ui/widgets/account_image_widget.dart';
|
||||||
|
import 'package:comunic/ui/widgets/tour/presentation_pane.dart';
|
||||||
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class AccountImageTourPane extends PresentationPane {
|
||||||
|
AccountImageTourPane({@required User user})
|
||||||
|
: super(
|
||||||
|
iconWidget: AccountImageWidget(user: user, width: 50),
|
||||||
|
title: tr("Account image"),
|
||||||
|
text: tr(
|
||||||
|
"Account image allow to quickly recognize people.\n\nYou can decide to define one now!"),
|
||||||
|
actionTitle: tr("Upload an account image"),
|
||||||
|
onActionTap: (ctx) async {
|
||||||
|
await uploadNewAccountImage(ctx);
|
||||||
|
});
|
||||||
|
}
|
30
lib/ui/widgets/tour/first_pane.dart
Normal file
30
lib/ui/widgets/tour/first_pane.dart
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
import 'package:comunic/ui/widgets/tour/fixed_tour_size_text_area.dart';
|
||||||
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// First tour pane
|
||||||
|
///
|
||||||
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
|
class FirstTourPane extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
Spacer(flex: 3),
|
||||||
|
Text(
|
||||||
|
"Comunic",
|
||||||
|
style: TextStyle(fontSize: 25),
|
||||||
|
),
|
||||||
|
Spacer(flex: 2),
|
||||||
|
FixedTourSizeTextArea(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...")),
|
||||||
|
Spacer(flex: 3),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
16
lib/ui/widgets/tour/fixed_tour_size_text_area.dart
Normal file
16
lib/ui/widgets/tour/fixed_tour_size_text_area.dart
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
/// Fixed tour size text area
|
||||||
|
///
|
||||||
|
/// @author Pierre Hubert
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class FixedTourSizeTextArea extends StatelessWidget {
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
const FixedTourSizeTextArea(this.text);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) => ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxWidth: 300),
|
||||||
|
child: Text(text, textAlign: TextAlign.justify),
|
||||||
|
);
|
||||||
|
}
|
18
lib/ui/widgets/tour/last_pane.dart
Normal file
18
lib/ui/widgets/tour/last_pane.dart
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// Last tour pane
|
||||||
|
///
|
||||||
|
/// @author Pierre Hubert
|
||||||
|
|
||||||
|
class LastTourPane extends StatelessWidget {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
tr("The application is yours"),
|
||||||
|
style: TextStyle(fontSize: 25),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
87
lib/ui/widgets/tour/presentation_pane.dart
Normal file
87
lib/ui/widgets/tour/presentation_pane.dart
Normal file
@ -0,0 +1,87 @@
|
|||||||
|
/// Application presentation tour pane
|
||||||
|
///
|
||||||
|
/// @author Pierre Hubert
|
||||||
|
import 'package:comunic/ui/widgets/tour/fixed_tour_size_text_area.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class PresentationPane extends StatelessWidget {
|
||||||
|
final IconData icon;
|
||||||
|
final Widget iconWidget;
|
||||||
|
final String title;
|
||||||
|
final String text;
|
||||||
|
final Function(BuildContext) child;
|
||||||
|
final String actionTitle;
|
||||||
|
final Function(BuildContext) onActionTap;
|
||||||
|
final bool canGoNext;
|
||||||
|
final Future<bool> Function(BuildContext) onTapNext;
|
||||||
|
|
||||||
|
const PresentationPane({
|
||||||
|
Key key,
|
||||||
|
this.icon,
|
||||||
|
this.iconWidget,
|
||||||
|
@required this.title,
|
||||||
|
this.text,
|
||||||
|
this.child,
|
||||||
|
this.actionTitle,
|
||||||
|
this.onActionTap,
|
||||||
|
this.canGoNext = true,
|
||||||
|
this.onTapNext,
|
||||||
|
}) : assert(icon != null || iconWidget != null),
|
||||||
|
assert(title != null),
|
||||||
|
assert(text != null || child != null),
|
||||||
|
super(key: key);
|
||||||
|
|
||||||
|
bool get _hasAction => actionTitle != null && onActionTap != null;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (text != null)
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Spacer(flex: 3),
|
||||||
|
icon != null ? Icon(icon, color: Colors.white, size: 50) : iconWidget,
|
||||||
|
Spacer(flex: 1),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
Spacer(flex: 1),
|
||||||
|
FixedTourSizeTextArea(text),
|
||||||
|
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(""),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Spacer(flex: 3),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
children: <Widget>[
|
||||||
|
Spacer(flex: 1),
|
||||||
|
icon != null ? Icon(icon, color: Colors.white, size: 50) : iconWidget,
|
||||||
|
Spacer(flex: 1),
|
||||||
|
Text(
|
||||||
|
title,
|
||||||
|
style: TextStyle(fontSize: 20),
|
||||||
|
),
|
||||||
|
Spacer(flex: 1),
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(maxHeight: 300),
|
||||||
|
child: SingleChildScrollView(child: child(context))),
|
||||||
|
Spacer(flex: 1),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user