2021-04-15 13:03:14 +02:00
|
|
|
import 'package:fluffychat/views/sign_up_password.dart';
|
2021-04-12 17:40:45 +02:00
|
|
|
|
2021-04-24 09:29:17 +02:00
|
|
|
import 'package:fluffychat/views/widgets/layouts/one_page_card.dart';
|
2021-04-12 17:40:45 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
|
2021-04-15 13:03:14 +02:00
|
|
|
class SignUpPasswordUI extends StatelessWidget {
|
2021-04-12 17:40:45 +02:00
|
|
|
final SignUpPasswordController controller;
|
|
|
|
|
2021-04-15 13:03:14 +02:00
|
|
|
const SignUpPasswordUI(this.controller, {Key key}) : super(key: key);
|
2021-04-12 17:40:45 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return OnePageCard(
|
|
|
|
child: Scaffold(
|
|
|
|
appBar: AppBar(
|
|
|
|
elevation: 0,
|
|
|
|
leading: controller.loading ? Container() : BackButton(),
|
|
|
|
title: Text(
|
|
|
|
L10n.of(context).chooseAStrongPassword,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
body: ListView(
|
|
|
|
children: <Widget>[
|
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
child: TextField(
|
|
|
|
controller: controller.passwordController,
|
|
|
|
obscureText: !controller.showPassword,
|
|
|
|
autofocus: true,
|
|
|
|
readOnly: controller.loading,
|
|
|
|
autocorrect: false,
|
|
|
|
onSubmitted: (_) => controller.signUpAction,
|
|
|
|
autofillHints:
|
|
|
|
controller.loading ? null : [AutofillHints.newPassword],
|
|
|
|
decoration: InputDecoration(
|
|
|
|
prefixIcon: Icon(Icons.lock_outlined),
|
|
|
|
hintText: '****',
|
|
|
|
errorText: controller.passwordError,
|
|
|
|
suffixIcon: IconButton(
|
|
|
|
tooltip: L10n.of(context).showPassword,
|
|
|
|
icon: Icon(controller.showPassword
|
|
|
|
? Icons.visibility_off_outlined
|
|
|
|
: Icons.visibility_outlined),
|
|
|
|
onPressed: controller.toggleShowPassword,
|
|
|
|
),
|
|
|
|
labelText: L10n.of(context).password),
|
|
|
|
),
|
|
|
|
),
|
2021-05-13 12:18:50 +02:00
|
|
|
Padding(
|
|
|
|
padding: const EdgeInsets.all(12.0),
|
|
|
|
child: TextField(
|
|
|
|
controller: controller.emailController,
|
|
|
|
readOnly: controller.loading,
|
|
|
|
autocorrect: false,
|
|
|
|
keyboardType: TextInputType.emailAddress,
|
|
|
|
onSubmitted: (_) => controller.signUpAction,
|
|
|
|
decoration: InputDecoration(
|
|
|
|
prefixIcon: Icon(Icons.mail_outline_outlined),
|
|
|
|
errorText: controller.emailError,
|
|
|
|
hintText: 'email@example.com',
|
|
|
|
labelText: L10n.of(context).optionalAddEmail),
|
|
|
|
),
|
|
|
|
),
|
2021-04-12 17:40:45 +02:00
|
|
|
SizedBox(height: 12),
|
|
|
|
Hero(
|
|
|
|
tag: 'loginButton',
|
|
|
|
child: Padding(
|
|
|
|
padding: EdgeInsets.symmetric(horizontal: 12),
|
|
|
|
child: ElevatedButton(
|
|
|
|
onPressed:
|
|
|
|
controller.loading ? null : controller.signUpAction,
|
|
|
|
child: controller.loading
|
|
|
|
? LinearProgressIndicator()
|
|
|
|
: Text(
|
|
|
|
L10n.of(context).createAccountNow.toUpperCase(),
|
|
|
|
style: TextStyle(color: Colors.white, fontSize: 16),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|