1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 00:05:16 +00:00

Start to update tour route

This commit is contained in:
2021-04-23 13:43:24 +02:00
parent a022e8bfd1
commit 46f9c917b5
7 changed files with 189 additions and 154 deletions

View 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);
});
}

View 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),
],
);
}
}

View 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),
);
}

View 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),
),
);
}
}

View 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),
],
);
}
}