|
|
|
|
@ -1,3 +1,4 @@
|
|
|
|
|
import 'package:mc_common_app/classes/app_state.dart';
|
|
|
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
|
|
|
import 'package:mc_common_app/config/routes.dart';
|
|
|
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
|
|
|
@ -9,6 +10,7 @@ import 'package:mc_common_app/utils/navigator.dart';
|
|
|
|
|
import 'package:mc_common_app/view_models/user_view_model.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/button/show_fill_button.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/dropdown/dropdow_field.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
|
import 'package:mc_common_app/widgets/txt_field.dart';
|
|
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
|
@ -25,17 +27,29 @@ class CompleteProfilePage extends StatefulWidget {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
String? firstName = "", lastName = "", email = "", confirmPassword = "";
|
|
|
|
|
String? firstName = "",
|
|
|
|
|
lastName = "",
|
|
|
|
|
email = "",
|
|
|
|
|
confirmPassword = "";
|
|
|
|
|
late String password = "";
|
|
|
|
|
bool isChecked = false;
|
|
|
|
|
late UserVM userVM;
|
|
|
|
|
DropValue? city;
|
|
|
|
|
DropValue? gender;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
userVM = Provider.of<UserVM>(context, listen: false);
|
|
|
|
|
getcities();
|
|
|
|
|
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getcities() async {
|
|
|
|
|
print("Country ID = " + AppState().getUserRegisterCountrySelection.id.toString());
|
|
|
|
|
await userVM.getAllCitiesForUser(AppState().getUserRegisterCountrySelection.id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return Scaffold(
|
|
|
|
|
@ -53,20 +67,20 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
children: [
|
|
|
|
|
6.height,
|
|
|
|
|
LocaleKeys.completeProfile.tr().toText(
|
|
|
|
|
height: 23 / 24,
|
|
|
|
|
fontSize: 24,
|
|
|
|
|
letterSpacing: -1.44,
|
|
|
|
|
),
|
|
|
|
|
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,
|
|
|
|
|
),
|
|
|
|
|
color: MyColors.lightTextColor,
|
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
height: 23 / 24,
|
|
|
|
|
letterSpacing: -0.48,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
@ -85,6 +99,32 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
Container(
|
|
|
|
|
padding: const EdgeInsets.only(right: 0, left: 0, top: 0, bottom: 0),
|
|
|
|
|
child: Builder(builder: (context) {
|
|
|
|
|
List<DropValue> userGender = [];
|
|
|
|
|
userGender.add(DropValue(1.toInt(), "${LocaleKeys.userMale.tr()}", "", isEnabled: true));
|
|
|
|
|
userGender.add(DropValue(2.toInt(), "${LocaleKeys.userFemale.tr()}", "", isEnabled: true));
|
|
|
|
|
// for (var element in userVM.userCities!.data!) {
|
|
|
|
|
// if (AppState().getUser.data != null) {
|
|
|
|
|
// if (AppState().getUser.data!.userInfo!.cityId == element.id) {
|
|
|
|
|
// city = DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", "");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
return DropdownField(
|
|
|
|
|
(DropValue value) {
|
|
|
|
|
gender = value;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
list: userGender,
|
|
|
|
|
dropdownValue: gender != null && gender != -1 ? DropValue(gender!.id, gender!.value, "") : null,
|
|
|
|
|
hint: gender != null && gender != -1 ? gender!.value : "${LocaleKeys.userGender.tr()} *",
|
|
|
|
|
// errorValue: adVM.vehicleCountryId.errorValue,
|
|
|
|
|
);
|
|
|
|
|
})),
|
|
|
|
|
12.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: LocaleKeys.email.tr(),
|
|
|
|
|
value: email,
|
|
|
|
|
@ -95,6 +135,32 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
12.height,
|
|
|
|
|
userVM.userCities != null
|
|
|
|
|
? Container(
|
|
|
|
|
padding: const EdgeInsets.only(right: 0, left: 0, top: 0, bottom: 0),
|
|
|
|
|
child: Builder(builder: (context) {
|
|
|
|
|
List<DropValue> userCityDrop = [];
|
|
|
|
|
for (var element in userVM.userCities!.data!) {
|
|
|
|
|
if (AppState().getUser.data != null) {
|
|
|
|
|
if (AppState().getUser.data!.userInfo!.cityId == element.id) {
|
|
|
|
|
city = DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", "");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
userCityDrop.add(DropValue(element.id?.toInt() ?? 0, element.cityName ?? "", ""));
|
|
|
|
|
}
|
|
|
|
|
return DropdownField(
|
|
|
|
|
(DropValue value) {
|
|
|
|
|
city = value;
|
|
|
|
|
setState(() {});
|
|
|
|
|
},
|
|
|
|
|
list: userCityDrop,
|
|
|
|
|
dropdownValue: city != null && city != -1 ? DropValue(city!.id, city!.value, "") : null,
|
|
|
|
|
hint: city != null && city != -1 ? city!.value : "${LocaleKeys.city.tr()} *",
|
|
|
|
|
// errorValue: adVM.vehicleCountryId.errorValue,
|
|
|
|
|
);
|
|
|
|
|
}))
|
|
|
|
|
: SizedBox(),
|
|
|
|
|
12.height,
|
|
|
|
|
TxtField(
|
|
|
|
|
hint: LocaleKeys.createPass.tr(),
|
|
|
|
|
isPasswordEnabled: true,
|
|
|
|
|
@ -175,12 +241,12 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
if (!userVM.completeProfilePageCheckbox) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
bool validateStatus = userVM.dataValidation(
|
|
|
|
|
password: password,
|
|
|
|
|
firstName: firstName,
|
|
|
|
|
lastName: lastName,
|
|
|
|
|
email: email,
|
|
|
|
|
);
|
|
|
|
|
bool validateStatus = userVM.dataValidation(password: password,
|
|
|
|
|
firstName: firstName,
|
|
|
|
|
lastName: lastName,
|
|
|
|
|
email: email,
|
|
|
|
|
city: city,
|
|
|
|
|
gender: gender);
|
|
|
|
|
if (validateStatus) {
|
|
|
|
|
userVM.performCompleteProfile(
|
|
|
|
|
context,
|
|
|
|
|
@ -191,6 +257,8 @@ class _CompleteProfilePageState extends State<CompleteProfilePage> {
|
|
|
|
|
email: email!,
|
|
|
|
|
userId: widget.user.data!.userId ?? "",
|
|
|
|
|
isNeedToPassToken: widget.user.data!.isNeedToPassToken,
|
|
|
|
|
cityID: city!.id.toString(),
|
|
|
|
|
genderID: gender!.id.toString(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|