mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +01:00
76 lines
2.6 KiB
Dart
76 lines
2.6 KiB
Dart
import 'package:fluffychat/controllers/sign_up_password_controller.dart';
|
|
|
|
import 'package:fluffychat/views/widgets/one_page_card.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
|
|
|
class SignUpPasswordView extends StatelessWidget {
|
|
final SignUpPasswordController controller;
|
|
|
|
const SignUpPasswordView(
|
|
this.controller, {
|
|
Key key,
|
|
}) : super(key: key);
|
|
|
|
@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),
|
|
),
|
|
),
|
|
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),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|