You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
2.7 KiB
Dart
76 lines
2.7 KiB
Dart
2 years ago
|
import 'package:flutter/material.dart';
|
||
|
|
||
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||
|
|
||
|
import 'package:fluffychat/pages/settings_password/settings_password.dart';
|
||
|
import 'package:fluffychat/widgets/layouts/max_width_body.dart';
|
||
|
|
||
|
class SettingsPasswordView extends StatelessWidget {
|
||
|
final SettingsPasswordController controller;
|
||
|
const SettingsPasswordView(this.controller, {super.key});
|
||
|
|
||
|
@override
|
||
|
Widget build(BuildContext context) {
|
||
|
return Scaffold(
|
||
|
appBar: AppBar(title: Text(L10n.of(context)!.changePassword)),
|
||
|
body: ListTileTheme(
|
||
|
iconColor: Theme.of(context).colorScheme.onBackground,
|
||
|
child: MaxWidthBody(
|
||
|
child: Padding(
|
||
|
padding: const EdgeInsets.all(16.0),
|
||
|
child: Column(
|
||
|
children: [
|
||
|
TextField(
|
||
|
controller: controller.oldPasswordController,
|
||
|
obscureText: true,
|
||
|
autocorrect: false,
|
||
|
autofocus: true,
|
||
|
readOnly: controller.loading,
|
||
|
decoration: InputDecoration(
|
||
|
hintText: L10n.of(context)!.pleaseEnterYourCurrentPassword,
|
||
|
errorText: controller.oldPasswordError,
|
||
|
),
|
||
|
),
|
||
|
const Divider(height: 32),
|
||
|
TextField(
|
||
|
controller: controller.newPassword1Controller,
|
||
|
obscureText: true,
|
||
|
autocorrect: false,
|
||
|
readOnly: controller.loading,
|
||
|
decoration: InputDecoration(
|
||
|
hintText: L10n.of(context)!.newPassword,
|
||
|
errorText: controller.newPassword1Error,
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(height: 16),
|
||
|
TextField(
|
||
|
controller: controller.newPassword2Controller,
|
||
|
obscureText: true,
|
||
|
autocorrect: false,
|
||
|
readOnly: controller.loading,
|
||
|
decoration: InputDecoration(
|
||
|
hintText: L10n.of(context)!.repeatPassword,
|
||
|
errorText: controller.newPassword2Error,
|
||
|
),
|
||
|
),
|
||
|
const SizedBox(height: 16),
|
||
|
SizedBox(
|
||
|
width: double.infinity,
|
||
|
child: ElevatedButton.icon(
|
||
|
onPressed:
|
||
|
controller.loading ? null : controller.changePassword,
|
||
|
icon: const Icon(Icons.send_outlined),
|
||
|
label: controller.loading
|
||
|
? const LinearProgressIndicator()
|
||
|
: Text(L10n.of(context)!.changePassword),
|
||
|
),
|
||
|
),
|
||
|
],
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
),
|
||
|
);
|
||
|
}
|
||
|
}
|