mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 21:09:21 +00:00
Show first option
This commit is contained in:
parent
6e274cae11
commit
91e7dd4019
@ -1,4 +1,5 @@
|
|||||||
import 'package:comunic/helpers/account_helper.dart';
|
import 'package:comunic/helpers/account_helper.dart';
|
||||||
|
import 'package:comunic/ui/widgets/dialogs/cancel_dialog_button.dart';
|
||||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||||
import 'package:comunic/utils/input_utils.dart';
|
import 'package:comunic/utils/input_utils.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
@ -27,6 +28,8 @@ class ResetPasswordRoute extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum _SelectedOption { NONE }
|
||||||
|
|
||||||
class _ResetPasswordBody extends StatefulWidget {
|
class _ResetPasswordBody extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
_ResetPasswordBodyState createState() => _ResetPasswordBodyState();
|
_ResetPasswordBodyState createState() => _ResetPasswordBodyState();
|
||||||
@ -47,6 +50,8 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
|||||||
/// Step 2 - Offer options
|
/// Step 2 - Offer options
|
||||||
bool _hasSecurityQuestions;
|
bool _hasSecurityQuestions;
|
||||||
|
|
||||||
|
var _selectedOption = _SelectedOption.NONE;
|
||||||
|
|
||||||
void _setLoading(bool loading) => setState(() => _loading = loading);
|
void _setLoading(bool loading) => setState(() => _loading = loading);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -54,12 +59,18 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
|||||||
if (_loading) return buildCenteredProgressBar();
|
if (_loading) return buildCenteredProgressBar();
|
||||||
|
|
||||||
if (_emailAddress == null) return _buildEnterEmailAddressScreen();
|
if (_emailAddress == null) return _buildEnterEmailAddressScreen();
|
||||||
|
|
||||||
|
switch (_selectedOption) {
|
||||||
|
case _SelectedOption.NONE:
|
||||||
|
return _buildOptionsScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildEnterEmailAddressScreen() {
|
Widget _buildEnterEmailAddressScreen() {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Text(tr("Please enter your email address to reset your password:")),
|
||||||
TextField(
|
TextField(
|
||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
onChanged: (s) => setState(() {}),
|
onChanged: (s) => setState(() {}),
|
||||||
@ -108,4 +119,31 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
|||||||
_setLoading(false);
|
_setLoading(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Offer the user the options he has to reset his account
|
||||||
|
Widget _buildOptionsScreen() => Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
children: <Widget>[
|
||||||
|
Text(tr("Here are your options to reset your account:")),
|
||||||
|
Container(height: 15),
|
||||||
|
OutlineButton.icon(
|
||||||
|
onPressed: _openSendEmailDialog,
|
||||||
|
icon: Icon(Icons.email),
|
||||||
|
label: Text(tr("Send us an email to ask for help")),
|
||||||
|
),
|
||||||
|
Container(height: 15),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
/// Show a dialog with our email address
|
||||||
|
void _openSendEmailDialog() {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (c) => AlertDialog(
|
||||||
|
title: Text("Contact us"),
|
||||||
|
content: Text(tr("You can reach us at contact@communiquons.org")),
|
||||||
|
actions: <Widget>[CancelDialogButton()],
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user