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.
68 lines
2.2 KiB
Dart
68 lines
2.2 KiB
Dart
import 'package:car_customer_app/extensions/int_extensions.dart';
|
|
import 'package:car_customer_app/extensions/string_extensions.dart';
|
|
import 'package:car_customer_app/generated/locale_keys.g.dart';
|
|
import 'package:car_customer_app/view_models/user_view_model.dart';
|
|
import 'package:car_customer_app/widgets/app_bar.dart';
|
|
import 'package:car_customer_app/widgets/show_fill_button.dart';
|
|
import 'package:car_customer_app/widgets/txt_field.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class ChangePasswordPage extends StatefulWidget {
|
|
const ChangePasswordPage({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<ChangePasswordPage> createState() => _ChangePasswordPageState();
|
|
}
|
|
|
|
class _ChangePasswordPageState extends State<ChangePasswordPage> {
|
|
String newPassword = "";
|
|
String currentPassword = '';
|
|
|
|
late UserVM userVM;
|
|
|
|
@override
|
|
void initState() {
|
|
userVM = Provider.of<UserVM>(context, listen: false);
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: appBar(context, title: LocaleKeys.changePassword.tr()),
|
|
body: SingleChildScrollView(
|
|
child: Container(
|
|
// width: double.infinity,
|
|
// height: double.infinity,
|
|
padding: EdgeInsets.all(40),
|
|
child: Column(
|
|
children: [
|
|
LocaleKeys.enterNewPassword.tr().toText(height: 23 / 24, fontSize: 24, letterSpacing: -1.44,),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.enterOldPassword.tr(),
|
|
onChanged: (v) => currentPassword = v,
|
|
),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.enterNewPassword.tr(),
|
|
onChanged: (v) => newPassword = v,
|
|
),
|
|
20.height,
|
|
ShowFillButton(
|
|
title: LocaleKeys.confirm.tr(),
|
|
maxWidth: double.infinity,
|
|
onPressed: () async {
|
|
await userVM.changeUserPassword(context, newPassword, currentPassword);
|
|
},
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|