mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-26 06:49:22 +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/ui/widgets/dialogs/cancel_dialog_button.dart';
|
||||
import 'package:comunic/ui/widgets/safe_state.dart';
|
||||
import 'package:comunic/utils/input_utils.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
@ -27,6 +28,8 @@ class ResetPasswordRoute extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
enum _SelectedOption { NONE }
|
||||
|
||||
class _ResetPasswordBody extends StatefulWidget {
|
||||
@override
|
||||
_ResetPasswordBodyState createState() => _ResetPasswordBodyState();
|
||||
@ -47,6 +50,8 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
||||
/// Step 2 - Offer options
|
||||
bool _hasSecurityQuestions;
|
||||
|
||||
var _selectedOption = _SelectedOption.NONE;
|
||||
|
||||
void _setLoading(bool loading) => setState(() => _loading = loading);
|
||||
|
||||
@override
|
||||
@ -54,12 +59,18 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
||||
if (_loading) return buildCenteredProgressBar();
|
||||
|
||||
if (_emailAddress == null) return _buildEnterEmailAddressScreen();
|
||||
|
||||
switch (_selectedOption) {
|
||||
case _SelectedOption.NONE:
|
||||
return _buildOptionsScreen();
|
||||
}
|
||||
}
|
||||
|
||||
Widget _buildEnterEmailAddressScreen() {
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Text(tr("Please enter your email address to reset your password:")),
|
||||
TextField(
|
||||
controller: _emailController,
|
||||
onChanged: (s) => setState(() {}),
|
||||
@ -108,4 +119,31 @@ class _ResetPasswordBodyState extends SafeState<_ResetPasswordBody> {
|
||||
_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