bug fixing

faiz_dev
Faiz Hashmi 2 days ago
parent 39571be9c6
commit 9b956574ae

@ -44,6 +44,7 @@ import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
import 'package:provider/provider.dart';
import 'package:sizer/sizer.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:toastification/toastification.dart';
import 'config/provider_routes.dart';
Future<void> main() async {
@ -174,15 +175,17 @@ class MyApp extends StatelessWidget {
PostParamsModel(languageID: EasyLocalization.of(context)?.locale.languageCode == "ar" ? 1 : 2),
);
// ThemeData data = AppTheme.getTheme(isArabic: EasyLocalization.of(context)?.locale.languageCode == "ar");
return MaterialApp(
theme: AppTheme.getTheme(isArabic: EasyLocalization.of(context)?.locale.languageCode == "ar"),
debugShowCheckedModeBanner: false,
navigatorKey: navigatorKey,
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
initialRoute: AppRoutes.initialRoute,
routes: ProviderAppRoutes.routes,
return ToastificationWrapper(
child: MaterialApp(
theme: AppTheme.getTheme(isArabic: EasyLocalization.of(context)?.locale.languageCode == "ar"),
debugShowCheckedModeBanner: false,
navigatorKey: navigatorKey,
localizationsDelegates: context.localizationDelegates,
supportedLocales: context.supportedLocales,
locale: context.locale,
initialRoute: AppRoutes.initialRoute,
routes: ProviderAppRoutes.routes,
),
);
},
);

@ -118,9 +118,30 @@ class _AppointmentPageState extends State<AppointmentPage> {
),
] else ...[
if (appointmentsVM.myFilteredAppointmentsForProvider.isEmpty)
EmptyWidget(
spacerWidget: const SizedBox(height: 25),
text: LocaleKeys.noAppointmentFound.tr(),
Column(
children: [
const SizedBox(height: 25),
EmptyWidget(
spacerWidget: const SizedBox(height: 25),
text: appointmentsVM.appointmentFiltersCounter > 0 ? "No appointments that match your search" : LocaleKeys.noAppointmentFound.tr(),
),
if (appointmentsVM.appointmentFiltersCounter > 0) ...[
const SizedBox(height: 16),
GestureDetector(
onTap: () {
appointmentsVM.clearAppointmentFilters();
},
child: const Text(
"Clear Filters",
style: TextStyle(
color: MyColors.darkPrimaryColor,
fontSize: 16,
fontWeight: FontWeight.w600,
),
),
),
],
],
)
else ...[
ListView.separated(

@ -1,140 +1,175 @@
import 'dart:async';
import 'package:easy_localization/easy_localization.dart';
import 'package:car_provider_app/generated/locale_keys.g.dart';
import 'package:flutter/material.dart';
import 'package:mc_common_app/extensions/int_extensions.dart';
import 'package:mc_common_app/extensions/string_extensions.dart';
import 'package:mc_common_app/generated/locale_keys.g.dart';
import 'package:mc_common_app/models/user_models/country.dart';
import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/utils/utils.dart';
import 'package:mc_common_app/view_models/user_view_model.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/txt_field.dart';
import 'package:provider/provider.dart';
class AddPhoneNumWidget extends StatefulWidget {
const AddPhoneNumWidget({Key? key}) : super(key: key);
@override
State<AddPhoneNumWidget> createState() => _AddPhoneNumWidgetState();
}
class _AddPhoneNumWidgetState extends State<AddPhoneNumWidget> {
String phoneNum = "", countryCode = "";
late UserVM userVM;
Country? _country;
@override
void initState() {
super.initState();
scheduleMicrotask(() {
userVM = Provider.of(context, listen: false);
getCountryList();
});
}
getCountryList() async {
_country = await userVM.getAllCountries();
setState(() {});
}
@override
Widget build(BuildContext context) {
return Padding(
padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
child: Container(
width: double.infinity,
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
"Enter Phone Number".toText(fontSize: 16, isBold: true),
8.height,
getCountry(context),
8.height,
TxtField(
keyboardType: TextInputType.phone,
hint: "546758594",
value: phoneNum,
isSidePaddingZero: true,
onChanged: (v) {
phoneNum = v;
},
),
16.height,
Row(
children: [
Expanded(
child: ShowFillButton(
title: "Cancel",
backgroundColor: MyColors.greyButtonColor,
txtColor: Colors.black,
onPressed: () {
pop(context);
},
),
),
12.width,
Expanded(
child: ShowFillButton(
title: LocaleKeys.sendOTP.tr(),
onPressed: () {
//User Role: Dealer|Manager for a branch
FocusScope.of(context).unfocus();
if (validation()) {
userVM.performBasicOtpRegisterPage(context, countryCode: countryCode, phoneNum: phoneNum, role: 7, isNeedToPassToken: true, reloadPage: () {
pop(context);
});
}
},
),
),
],
)
],
),
),
);
}
Widget getCountry(BuildContext context) {
if (_country != null) {
List<DropValue> dropList = [];
_country!.data?.forEach((element) {
dropList.add(DropValue(element.id ?? 0, "${element.countryName ?? ""} ${element.countryCode ?? ""}", element.countryCode ?? ""));
});
return DropdownField(
(DropValue value) {
countryCode = value.subValue;
},
list: dropList,
hint: countryCode.isNotEmpty ? countryCode.toString() : LocaleKeys.selectCountryCode.tr(),
);
} else {
return const Center(
child: CircularProgressIndicator(),
);
}
}
bool validation() {
bool isValid = true;
if (countryCode.isEmpty) {
Utils.showToast(LocaleKeys.selectCountryCode.tr());
//("Please select Country Code");
isValid = false;
} else if (phoneNum.isEmpty) {
Utils.showToast(LocaleKeys.addPhoneNo.tr());
//("Please add Phone No");
isValid = false;
}
return isValid;
}
}
// import 'dart:async';
//
// import 'package:easy_localization/easy_localization.dart';
// import 'package:flutter/material.dart';
// import 'package:mc_common_app/extensions/int_extensions.dart';
// import 'package:mc_common_app/extensions/string_extensions.dart';
// import 'package:mc_common_app/generated/locale_keys.g.dart';
// import 'package:mc_common_app/models/user_models/country.dart';
// import 'package:mc_common_app/theme/colors.dart';
// import 'package:mc_common_app/utils/navigator.dart';
// import 'package:mc_common_app/utils/utils.dart';
// import 'package:mc_common_app/view_models/user_view_model.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/txt_field.dart';
// import 'package:provider/provider.dart';
//
// class AddPhoneNumWidget extends StatefulWidget {
// const AddPhoneNumWidget({Key? key}) : super(key: key);
//
// @override
// State<AddPhoneNumWidget> createState() => _AddPhoneNumWidgetState();
// }
//
// class _AddPhoneNumWidgetState extends State<AddPhoneNumWidget> {
// String phoneNum = "", countryCode = "";
// late UserVM userVM;
// Country? _country;
//
// @override
// void initState() {
// super.initState();
//
// scheduleMicrotask(() {
// userVM = Provider.of(context, listen: false);
// getCountryList();
// });
// }
//
// getCountryList() async {
// _country = await userVM.getAllCountries();
// setState(() {});
// }
//
// @override
// Widget build(BuildContext context) {
// return Padding(
// padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom),
// child: Container(
// width: double.infinity,
// padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// mainAxisAlignment: MainAxisAlignment.start,
// mainAxisSize: MainAxisSize.min,
// children: [
// "Enter Phone Number".toText(fontSize: 16, isBold: true),
// 8.height,
// getCountry(context),
// 8.height,
// TxtField(
// keyboardType: TextInputType.phone,
// hint: "Phone without country code",
// value: phoneNum,
// isSidePaddingZero: true,
// onChanged: (v) {
// // Remove any spaces, dashes, or parentheses
// String cleanedValue = v.replaceAll(RegExp(r'[\s\-\(\)]'), '');
//
// // Remove leading + if present
// if (cleanedValue.startsWith('+')) {
// cleanedValue = cleanedValue.substring(1);
// }
//
// // If country code is selected, remove it from the input if user entered it
// if (countryCode.isNotEmpty) {
// String codeWithoutPlus = countryCode.replaceAll('+', '');
//
// // Check if the cleaned value starts with the country code
// if (cleanedValue.startsWith(codeWithoutPlus)) {
// cleanedValue = cleanedValue.substring(codeWithoutPlus.length);
// }
//
// // Also check for common variations (e.g., 00966 instead of +966)
// if (cleanedValue.startsWith('00$codeWithoutPlus')) {
// cleanedValue = cleanedValue.substring(codeWithoutPlus.length + 2);
// } else if (cleanedValue.startsWith('00')) {
// // Remove 00 prefix if present
// cleanedValue = cleanedValue.substring(2);
// // Check again if it starts with country code after removing 00
// if (cleanedValue.startsWith(codeWithoutPlus)) {
// cleanedValue = cleanedValue.substring(codeWithoutPlus.length);
// }
// }
// }
//
// // Remove leading zeros (but keep at least one digit if that's all there is)
// while (cleanedValue.length > 1 && cleanedValue.startsWith('0')) {
// cleanedValue = cleanedValue.substring(1);
// }
//
// phoneNum = cleanedValue;
// setState(() {}); // Update UI to show cleaned value
// },
// ),
// 16.height,
// Row(
// children: [
// Expanded(
// child: ShowFillButton(
// title: "Cancel",
// backgroundColor: MyColors.greyButtonColor,
// txtColor: Colors.black,
// onPressed: () {
// pop(context);
// },
// ),
// ),
// 12.width,
// Expanded(
// child: ShowFillButton(
// title: LocaleKeys.sendOTP.tr(),
// onPressed: () {
// //User Role: Dealer|Manager for a branch
// FocusScope.of(context).unfocus();
// if (validation()) {
// userVM.performBasicOtpRegisterPage(context, countryCode: countryCode, phoneNum: phoneNum, role: 7, isNeedToPassToken: true, reloadPage: () {
// pop(context);
// });
// }
// },
// ),
// ),
// ],
// )
// ],
// ),
// ),
// );
// }
//
// Widget getCountry(BuildContext context) {
// if (_country != null) {
// List<DropValue> dropList = [];
// _country!.data?.forEach((element) {
// dropList.add(DropValue(element.id ?? 0, "${element.countryName ?? ""} ${element.countryCode ?? ""}", element.countryCode ?? ""));
// });
// return DropdownField(
// (DropValue value) {
// countryCode = value.subValue;
// },
// list: dropList,
// hint: countryCode.isNotEmpty ? countryCode.toString() : LocaleKeys.selectCountryCode.tr(),
// );
// } else {
// return const Center(
// child: CircularProgressIndicator(),
// );
// }
// }
//
// bool validation() {
// bool isValid = true;
// if (countryCode.isEmpty) {
// Utils.showToast(LocaleKeys.selectCountryCode.tr());
// //("Please select Country Code");
// isValid = false;
// } else if (phoneNum.isEmpty) {
// Utils.showToast(LocaleKeys.addPhoneNo.tr());
// //("Please add Phone No");
// isValid = false;
// }
// return isValid;
// }
// }

@ -22,7 +22,7 @@ class AssignDealerUserSheet extends StatefulWidget {
VoidCallback callBackFunc;
bool? isFromBranch;
AssignDealerUserSheet({required this.branchId, required this.callBackFunc, this.isFromBranch, Key? key}) : super(key: key);
AssignDealerUserSheet({required this.branchId, required this.callBackFunc, this.isFromBranch, super.key});
@override
State<AssignDealerUserSheet> createState() => _AssignDealerUserSheetState();

@ -106,7 +106,7 @@ class _CreateServicesPage3State extends State<CreateServicesPage3> {
},
dropdownValue: category,
list: serviceVM.categoryDropList,
hint: category != null ? category!.value : LocaleKeys.selectServiceCategory.tr(),
hint: LocaleKeys.selectServiceCategory.tr(),
),
if (widget.branchModel!.isForEdit) ...[
22.height,

@ -34,20 +34,15 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
dependency_overrides:
web: ^1.0.0
# mc_common_app:
## git: https://gitlab.com/mirza.shafique/car_common_app.git
# path: C:/Users/mirza.shafique/AndroidStudioProjects/mc_common_app
mc_common_app:
# path: D:\Development\car_common_app
path: /Users/faizhashmi/Development/Projects/MyProjects/CloudSolutions/car_common_app
# path: /Volumes/Data/Projects/Flutter/car_common_app
# path: /Users/aamir/StudioProjects/car_common_app
# path: D:\Development\car_common_app
# path: /Users/faizhashmi/Development/Projects/MyProjects/CloudSolutions/car_common_app
path: /Volumes/Data/Projects/Flutter_Projects/car_common_app
# path: /Users/aamir/StudioProjects/car_common_app

Loading…
Cancel
Save