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.
165 lines
5.8 KiB
Dart
165 lines
5.8 KiB
Dart
import 'package:car_customer_app/theme/colors.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/models/user/register_user.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 CompleteProfilePage extends StatefulWidget {
|
|
final RegisterUserRespModel user;
|
|
|
|
const CompleteProfilePage(this.user, {Key? key}) : super(key: key);
|
|
|
|
@override
|
|
State<CompleteProfilePage> createState() => _CompleteProfilePageState();
|
|
}
|
|
|
|
class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
String? firstName = "", lastName = "", email = "", confirmPassword = "";
|
|
late String password = "";
|
|
bool isChecked = false;
|
|
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.signUp.tr(),
|
|
),
|
|
body: SizedBox(
|
|
width: double.infinity,
|
|
height: double.infinity,
|
|
child: SingleChildScrollView(
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(20),
|
|
child: Column(
|
|
children: [
|
|
6.height,
|
|
LocaleKeys.completeProfile.tr().toText(height: 23 / 24, fontSize: 24, letterSpacing: -1.44,),
|
|
12.height,
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20),
|
|
child: LocaleKeys.profileMsg.tr().toText(
|
|
color: MyColors.lightTextColor,
|
|
textAlign: TextAlign.center,
|
|
fontSize: 14,
|
|
height: 23 / 24,
|
|
letterSpacing: -0.48,
|
|
),
|
|
),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.firstName.tr(),
|
|
value: firstName,
|
|
onChanged: (v) {
|
|
firstName = v;
|
|
},
|
|
),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.surname.tr(),
|
|
value: lastName,
|
|
onChanged: (v) {
|
|
lastName = v;
|
|
},
|
|
),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.email.tr(),
|
|
value: email,
|
|
// isButtonEnable: email!.length > 0 ? true : false,
|
|
buttonTitle: LocaleKeys.verify.tr(),
|
|
onChanged: (v) {
|
|
email = v;
|
|
},
|
|
),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.createPass.tr(),
|
|
isPasswordEnabled: true,
|
|
maxLines: 1,
|
|
value: password,
|
|
onChanged: (v) {
|
|
password = v;
|
|
},
|
|
),
|
|
12.height,
|
|
TxtField(
|
|
hint: LocaleKeys.confirmPass.tr(),
|
|
isPasswordEnabled: true,
|
|
maxLines: 1,
|
|
value: confirmPassword,
|
|
onChanged: (v) {
|
|
confirmPassword = v;
|
|
},
|
|
),
|
|
50.height,
|
|
Row(
|
|
children: [
|
|
Consumer(builder: (BuildContext context, UserVM userVM, Widget? child) {
|
|
return Checkbox(
|
|
value: userVM.completeProfilePageCheckbox,
|
|
activeColor: Colors.blue,
|
|
onChanged: (value) {
|
|
userVM.updateCompleteProfilePageCheckbox(value!);
|
|
},
|
|
);
|
|
}),
|
|
Expanded(
|
|
child: Column(
|
|
children: [
|
|
LocaleKeys.termsOfService.tr().toText(fontSize: 12),
|
|
LocaleKeys.terms.tr().toText(fontSize: 12, color: MyColors.darkPrimaryColor),
|
|
],
|
|
),
|
|
),
|
|
Theme(
|
|
data: ThemeData(unselectedWidgetColor: Colors.transparent),
|
|
child: Checkbox(
|
|
value: false,
|
|
onChanged: (_) {},
|
|
),
|
|
)
|
|
],
|
|
),
|
|
16.height,
|
|
ShowFillButton(
|
|
title: LocaleKeys.save.tr(),
|
|
maxWidth: double.infinity,
|
|
onPressed: () {
|
|
bool validateStatus = userVM.dataValidation(password: password, firstName: firstName, lastName: lastName, email: email);
|
|
if (validateStatus) {
|
|
userVM.performCompleteProfile(
|
|
context,
|
|
password: password,
|
|
confirmPassword: confirmPassword!,
|
|
firstName: firstName!,
|
|
lastName: lastName!,
|
|
email: email!,
|
|
userId: widget.user.data!.userId ?? "",
|
|
);
|
|
}
|
|
}),
|
|
16.height,
|
|
],
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|