arabic fonts, logout, subscription app state.

master_new_changes
Aamir.Muhammad 2 years ago
parent b7d3e4ab72
commit cb04d4a2fb

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -566,7 +566,8 @@
"defineLicenses": "تحديد التراخيص", "defineLicenses": "تحديد التراخيص",
"logOut": "تسجيل الخروج", "logOut": "تسجيل الخروج",
"customer": "العميل", "customer": "العميل",
"accept": "قبول" "accept": "قبول",
"amountVAR": "كمية"

@ -567,5 +567,6 @@
"defineLicenses": "Define Licenses", "defineLicenses": "Define Licenses",
"logOut": "Log Out", "logOut": "Log Out",
"customer": "Customer", "customer": "Customer",
"accept": "Accept" "accept": "Accept",
"amountVAR": "Amount"
} }

@ -1,5 +1,6 @@
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:mc_common_app/models/general_models/post_params_model.dart'; import 'package:mc_common_app/models/general_models/post_params_model.dart';
import 'package:mc_common_app/models/subscriptions_models/provider_subscription_model.dart';
import 'package:mc_common_app/models/user_models/user.dart'; import 'package:mc_common_app/models/user_models/user.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
@ -44,4 +45,12 @@ class AppState {
set setCurrentLocation(v) => currentLocation = v; set setCurrentLocation(v) => currentLocation = v;
LatLng get getCurrentLocation => currentLocation; LatLng get getCurrentLocation => currentLocation;
List<ProviderSubscriptionModel>? _providerSubscription;
List<ProviderSubscriptionModel> get getproviderSubscription => _providerSubscription!;
set setproviderSubscription(List<ProviderSubscriptionModel> value) {
_providerSubscription = value;
}
} }

@ -291,4 +291,5 @@ class MyLocales {
class MyFonts { class MyFonts {
static const poppinsFont = "packages/mc_common_app/Poppins"; static const poppinsFont = "packages/mc_common_app/Poppins";
static const gessTwoFont = "packages/mc_common_app/GessTwo";
} }

@ -582,7 +582,8 @@ class CodegenLoader extends AssetLoader{
"defineLicenses": "تحديد التراخيص", "defineLicenses": "تحديد التراخيص",
"logOut": "تسجيل الخروج", "logOut": "تسجيل الخروج",
"customer": "العميل", "customer": "العميل",
"accept": "قبول" "accept": "قبول",
"amountVAR": "كمية"
}; };
static const Map<String,dynamic> en_US = { static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In", "firstTimeLogIn": "First Time Log In",
@ -1153,7 +1154,8 @@ static const Map<String,dynamic> en_US = {
"defineLicenses": "Define Licenses", "defineLicenses": "Define Licenses",
"logOut": "Log Out", "logOut": "Log Out",
"customer": "Customer", "customer": "Customer",
"accept": "Accept" "accept": "Accept",
"amountVAR": "Amount"
}; };
static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US}; static const Map<String, Map<String,dynamic>> mapLocales = {"ar_SA": ar_SA, "en_US": en_US};
} }

@ -546,5 +546,6 @@ abstract class LocaleKeys {
static const logOut = 'logOut'; static const logOut = 'logOut';
static const customer = 'customer'; static const customer = 'customer';
static const accept = 'accept'; static const accept = 'accept';
static const amountVAR = 'amountVAR';
} }

@ -5,14 +5,14 @@ import 'colors.dart';
class AppTheme { class AppTheme {
static getTheme({required isArabic}) { static getTheme({required isArabic}) {
return ThemeData( return ThemeData(
fontFamily: !isArabic ? MyFonts.poppinsFont : null, fontFamily: !isArabic ? MyFonts.poppinsFont : MyFonts.gessTwoFont,
primaryColor: primaryColor, primaryColor: primaryColor,
useMaterial3: false, useMaterial3: false,
primaryTextTheme: const TextTheme( primaryTextTheme: const TextTheme(
titleLarge: TextStyle(color: Colors.white), titleLarge: TextStyle(color: Colors.white),
), colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.orange).copyWith(background: Colors.white), ),
colorScheme: ColorScheme.fromSwatch(primarySwatch: Colors.orange).copyWith(background: Colors.white),
); );
} }
} }

@ -359,7 +359,7 @@ class AppointmentsVM extends BaseVM {
myAppointments = await appointmentRepo.getMyAppointmentsForCustomersByFilters(); myAppointments = await appointmentRepo.getMyAppointmentsForCustomersByFilters();
// myFilteredAppointments = myAppointments; // myFilteredAppointments = myAppointments;
myUpComingAppointments = myAppointments.where((element) => element.appointmentStatusEnum == AppointmentStatusEnum.booked).toList(); myUpComingAppointments = myAppointments.where((element) => element.appointmentStatusEnum == AppointmentStatusEnum.booked || element.appointmentStatusEnum == AppointmentStatusEnum.confirmed ).toList();
setState(ViewState.idle); setState(ViewState.idle);
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments); applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments);
notifyListeners(); notifyListeners();

@ -178,6 +178,7 @@ class SubscriptionsVM extends BaseVM {
setState(ViewState.busy); setState(ViewState.busy);
if (mySubscriptionsBySp.isEmpty) { if (mySubscriptionsBySp.isEmpty) {
mySubscriptionsBySp = await subscriptionRepo.getProviderSubscription(serviceProviderID: serviceProviderID); mySubscriptionsBySp = await subscriptionRepo.getProviderSubscription(serviceProviderID: serviceProviderID);
AppState().setproviderSubscription = mySubscriptionsBySp;
} }
setState(ViewState.idle); setState(ViewState.idle);
} }

@ -163,7 +163,8 @@ class UserVM extends BaseVM {
} }
} }
Future<void> performCompleteProfile(BuildContext context, { Future<void> performCompleteProfile(
BuildContext context, {
required String password, required String password,
required String confirmPassword, required String confirmPassword,
required String firstName, required String firstName,
@ -350,7 +351,7 @@ class UserVM extends BaseVM {
Future<void> performBasicOtpLoginSelectionPage(BuildContext context, {required String userToken, required AppType appType, String? loginType}) async { Future<void> performBasicOtpLoginSelectionPage(BuildContext context, {required String userToken, required AppType appType, String? loginType}) async {
if (loginType == "3" || loginType == "4") { if (loginType == "3" || loginType == "4") {
//Utils.showLoading(context); //Utils.showLoading(context);
LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, loginType!); LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, loginType!);
if (user.messageStatus == 1) { if (user.messageStatus == 1) {
Response response2 = await userRepo.loginV2OTPVerify(user.data!.userToken ?? "", "9999"); Response response2 = await userRepo.loginV2OTPVerify(user.data!.userToken ?? "", "9999");
@ -377,17 +378,17 @@ class UserVM extends BaseVM {
SharedPrefManager.setData(jsonEncode(user.data!.userInfo!.toJson())); SharedPrefManager.setData(jsonEncode(user.data!.userInfo!.toJson()));
navigateReplaceWithName(context, AppRoutes.dashboard); navigateReplaceWithName(context, AppRoutes.dashboard);
} else { } else {
Utils.showToast(LocaleKeys.onlyCustomerApp.tr()); Utils.showToast(LocaleKeys.onlyCustomerApp.tr());
} }
} }
} else { } else {
Utils.showToast(verifiedUser.message ?? ""); Utils.showToast(verifiedUser.message ?? "");
} }
} }
} else { } else {
// Utils.showLoading(context); // Utils.showLoading(context);
LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, "1"); LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, "1");
// Utils.hideLoading(context); // Utils.hideLoading(context);
if (user.messageStatus == 1) { if (user.messageStatus == 1) {
showMDialog(context, child: OtpDialog( showMDialog(context, child: OtpDialog(
onClick: (String code) async { onClick: (String code) async {
@ -518,8 +519,8 @@ class UserVM extends BaseVM {
type == ClassType.NUMBER && countryCode != null type == ClassType.NUMBER && countryCode != null
? countryCode + phoneNum ? countryCode + phoneNum
: type == ClassType.NUMBER && countryCode == null : type == ClassType.NUMBER && countryCode == null
? phoneNum ? phoneNum
: phoneNum, : phoneNum,
password); password);
Utils.hideLoading(context); Utils.hideLoading(context);
LoginPasswordRespModel user = LoginPasswordRespModel.fromJson(jsonDecode(response.body)); LoginPasswordRespModel user = LoginPasswordRespModel.fromJson(jsonDecode(response.body));
@ -527,8 +528,8 @@ class UserVM extends BaseVM {
SharedPrefManager.setPhoneOrEmail(type == ClassType.NUMBER && countryCode != null SharedPrefManager.setPhoneOrEmail(type == ClassType.NUMBER && countryCode != null
? countryCode + phoneNum ? countryCode + phoneNum
: type == ClassType.NUMBER && countryCode == null : type == ClassType.NUMBER && countryCode == null
? phoneNum ? phoneNum
: phoneNum); : phoneNum);
SharedPrefManager.setUserPassword(password); SharedPrefManager.setUserPassword(password);
navigateReplaceWithName(context, AppRoutes.loginMethodSelection, arguments: user.data!.userToken); navigateReplaceWithName(context, AppRoutes.loginMethodSelection, arguments: user.data!.userToken);
} else { } else {
@ -639,4 +640,17 @@ class UserVM extends BaseVM {
_loginOtherAccount = true; _loginOtherAccount = true;
navigateReplaceWithName(context, AppRoutes.loginWithPassword); navigateReplaceWithName(context, AppRoutes.loginWithPassword);
} }
void changeLanguage(BuildContext context) {
if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA") {
context.setLocale(const Locale("en", "US"));
} else {
context.setLocale(const Locale('ar', 'SA'));
}
notifyListeners();
}
void logout(BuildContext context) {
navigateReplaceWithNameUntilRoute(context, AppRoutes.loginWithPassword);
}
} }

@ -219,7 +219,7 @@ class ReviewAppointment extends StatelessWidget {
return Column( return Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
LocaleKeys.amount LocaleKeys.amountVAR
.tr() .tr()
.toText(fontSize: 16, isBold: true), .toText(fontSize: 16, isBold: true),
Row( Row(

@ -24,24 +24,23 @@ class CustomerAppointmentSliderWidget extends StatelessWidget {
Widget getCorouselWidget(AppType appType, AppointmentsVM appointmentsVM) { Widget getCorouselWidget(AppType appType, AppointmentsVM appointmentsVM) {
return CarouselSlider.builder( return CarouselSlider.builder(
options: CarouselOptions( options: CarouselOptions(
height: 110, height: appType == AppType.provider ? 110 : 140,
viewportFraction: 1.0, viewportFraction: 1.0,
enlargeCenterPage: false, enlargeCenterPage: false,
enableInfiniteScroll: false, enableInfiniteScroll: false,
), ),
itemCount: appointmentsVM.myUpComingAppointments.length, itemCount: appointmentsVM.myUpComingAppointments.length,
itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => BuildAppointmentContainerForCustomer(
BuildAppointmentContainerForCustomer( isForHome: appType == AppType.provider,
isForHome: true, appointmentListModel: appointmentsVM.myUpComingAppointments[itemIndex],
appointmentListModel: appointmentsVM.myUpComingAppointments[itemIndex], onTapped: () {
onTapped: () { if (appType == AppType.provider) {
if (appType == AppType.provider) { onAppointmentClick!(appointmentsVM.myUpComingAppointments[itemIndex]);
onAppointmentClick!(appointmentsVM.myUpComingAppointments[itemIndex]); } else {
} else { navigateWithName(context, AppRoutes.appointmentDetailView, arguments: appointmentsVM.myUpComingAppointments[itemIndex]);
navigateWithName(context, AppRoutes.appointmentDetailView, arguments: appointmentsVM.myUpComingAppointments[itemIndex]); }
} },
}, ),
),
); );
} }
@ -179,7 +178,7 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
List<Widget> servicesList = List.generate( List<Widget> servicesList = List.generate(
2, 2,
(index) => showServices(appointmentListModel.appointmentServicesList![index].providerServiceDescription, MyAssets.modificationsIcon), (index) => showServices(appointmentListModel.appointmentServicesList![index].providerServiceDescription, MyAssets.modificationsIcon),
); );
if (appointmentListModel.appointmentServicesList!.length > 1) { if (appointmentListModel.appointmentServicesList!.length > 1) {
@ -205,17 +204,17 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
children: [ children: [
isForHome != null && isForHome! isForHome != null && isForHome!
? Image.asset( ? Image.asset(
MyAssets.bnCar, MyAssets.bnCar,
width: 56, width: 56,
height: 56, height: 56,
fit: BoxFit.fill, fit: BoxFit.fill,
).toCircle(borderRadius: 100) ).toCircle(borderRadius: 100)
: Image.asset( : Image.asset(
MyAssets.bnCar, MyAssets.bnCar,
width: 80, width: 80,
height: 85, height: 85,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
8.width, 8.width,
Expanded( Expanded(
child: Column( child: Column(
@ -237,31 +236,31 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
9.height, 9.height,
isForHome != null && isForHome! isForHome != null && isForHome!
? Row( ? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
"Appointment Details".toText( "Appointment Details".toText(
color: MyColors.primaryColor, color: MyColors.primaryColor,
isUnderLine: true, isUnderLine: true,
isBold: true, isBold: true,
fontSize: 14, fontSize: 14,
), ),
const Icon(Icons.arrow_forward), const Icon(Icons.arrow_forward),
], ],
) )
: Row( : Row(
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Expanded( Expanded(
child: Column( child: Column(
children: buildServicesFromAppointment(appointmentListModel: appointmentListModel!), children: buildServicesFromAppointment(appointmentListModel: appointmentListModel!),
),
),
const Icon(
Icons.arrow_forward,
),
],
), ),
),
const Icon(
Icons.arrow_forward,
),
],
),
], ],
), ),
), ),

@ -10,6 +10,7 @@ import 'package:mc_common_app/theme/colors.dart';
import 'package:mc_common_app/utils/enums.dart'; import 'package:mc_common_app/utils/enums.dart';
import 'package:mc_common_app/utils/navigator.dart'; import 'package:mc_common_app/utils/navigator.dart';
import 'package:mc_common_app/view_models/dashboard_view_model_customer.dart'; import 'package:mc_common_app/view_models/dashboard_view_model_customer.dart';
import 'package:mc_common_app/view_models/user_view_model.dart';
import 'package:mc_common_app/views/setting_options/widgets/custom_setting_options_tile.dart'; import 'package:mc_common_app/views/setting_options/widgets/custom_setting_options_tile.dart';
import 'package:mc_common_app/widgets/button/show_fill_button.dart'; import 'package:mc_common_app/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart'; import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
@ -40,8 +41,7 @@ class SettingOptionsLanguage extends StatelessWidget {
Column( Column(
children: [ children: [
CustomSettingOptionsTile( CustomSettingOptionsTile(
leadingWidget: leadingWidget: const Icon(Icons.quickreply_outlined, size: 20),
const Icon(Icons.quickreply_outlined, size: 20),
titleText: LocaleKeys.requests.tr(), titleText: LocaleKeys.requests.tr(),
needBorderBelow: true, needBorderBelow: true,
onTap: () { onTap: () {
@ -56,12 +56,10 @@ class SettingOptionsLanguage extends StatelessWidget {
//navigateWithName(context, AppRoutes.settingOptionsInviteFriends), //navigateWithName(context, AppRoutes.settingOptionsInviteFriends),
), ),
CustomSettingOptionsTile( CustomSettingOptionsTile(
leadingWidget: leadingWidget: const Icon(Icons.question_mark_outlined, size: 20),
const Icon(Icons.question_mark_outlined, size: 20),
titleText: LocaleKeys.help.tr(), titleText: LocaleKeys.help.tr(),
needBorderBelow: true, needBorderBelow: true,
onTap: () => onTap: () => navigateWithName(context, AppRoutes.settingOptionsHelp),
navigateWithName(context, AppRoutes.settingOptionsHelp),
), ),
CustomSettingOptionsTile( CustomSettingOptionsTile(
leadingWidget: const Icon(Icons.person, size: 20), leadingWidget: const Icon(Icons.person, size: 20),
@ -73,29 +71,25 @@ class SettingOptionsLanguage extends StatelessWidget {
// Navigator.pop(context); // Navigator.pop(context);
}), }),
], ],
).toWhiteContainer( ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0),
width: double.infinity,
pading: const EdgeInsets.all(12),
borderRadius: 0),
10.height, 10.height,
CustomSettingOptionsTile( CustomSettingOptionsTile(
leadingWidget: const Icon(Icons.translate, size: 20), leadingWidget: const Icon(Icons.translate, size: 20),
titleText: LocaleKeys.language.tr(), titleText: LocaleKeys.language.tr(),
isForLanguage: true, isForLanguage: true,
onTap: () { onTap: () {
if (EasyLocalization.of(context) // if (EasyLocalization.of(context)
?.currentLocale // ?.currentLocale
?.countryCode == // ?.countryCode ==
"SA") { // "SA") {
context.setLocale(const Locale("en", "US")); // context.setLocale(const Locale("en", "US"));
} else { // } else {
context.setLocale(const Locale('ar', 'SA')); // context.setLocale(const Locale('ar', 'SA'));
} // }
context.read<UserVM>().changeLanguage(context);
}, },
).toWhiteContainer( ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0),
width: double.infinity,
pading: const EdgeInsets.all(12),
borderRadius: 0),
10.height, 10.height,
(AppState().currentAppType == AppType.provider) (AppState().currentAppType == AppType.provider)
? Column( ? Column(
@ -114,8 +108,7 @@ class SettingOptionsLanguage extends StatelessWidget {
isForLanguage: false, isForLanguage: false,
needBorderBelow: true, needBorderBelow: true,
onTap: () { onTap: () {
navigateWithName( navigateWithName(context, AppRoutes.mySubscriptionsPage);
context, AppRoutes.mySubscriptionsPage);
}, },
), ),
CustomSettingOptionsTile( CustomSettingOptionsTile(
@ -132,8 +125,7 @@ class SettingOptionsLanguage extends StatelessWidget {
isForLanguage: false, isForLanguage: false,
needBorderBelow: true, needBorderBelow: true,
onTap: () { onTap: () {
navigateWithName( navigateWithName(context, AppRoutes.subscriptionsPage);
context, AppRoutes.subscriptionsPage);
}, },
), ),
CustomSettingOptionsTile( CustomSettingOptionsTile(
@ -150,19 +142,13 @@ class SettingOptionsLanguage extends StatelessWidget {
isForLanguage: false, isForLanguage: false,
needBorderBelow: false, needBorderBelow: false,
onTap: () { onTap: () {
navigateWithName( navigateWithName(context, AppRoutes.providerLicensePage);
context, AppRoutes.providerLicensePage);
}, },
) )
], ],
).toWhiteContainer( ).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0)
width: double.infinity,
pading: const EdgeInsets.all(12),
borderRadius: 0)
: SizedBox(),
(AppState().currentAppType == AppType.provider)
? 10.height
: SizedBox(), : SizedBox(),
(AppState().currentAppType == AppType.provider) ? 10.height : SizedBox(),
], ],
)), )),
// : Expanded( // : Expanded(
@ -188,9 +174,7 @@ class SettingOptionsLanguage extends StatelessWidget {
// ], // ],
// ), // ),
// ), // ),
(AppState().currentAppType == AppType.provider) (AppState().currentAppType == AppType.provider) ? Text(LocaleKeys.provider.tr()) : Text(LocaleKeys.customer.tr()),
? Text(LocaleKeys.provider.tr())
: Text(LocaleKeys.customer.tr()),
Row( Row(
children: [ children: [
Expanded( Expanded(
@ -201,7 +185,9 @@ class SettingOptionsLanguage extends StatelessWidget {
fontSize: 16, fontSize: 16,
maxHeight: 55, maxHeight: 55,
title: LocaleKeys.logOut.tr(), title: LocaleKeys.logOut.tr(),
onPressed: () {}, onPressed: () {
context.read<UserVM>().logout(context);
},
), ),
), ),
], ],

@ -73,10 +73,15 @@ flutter:
- assets/icons/ - assets/icons/
- assets/icons/payments/ - assets/icons/payments/
- assets/images/ - assets/images/
- assets/fonts/Poppins-Medium.ttf - assets/fonts/
fonts: fonts:
- family: Poppins - family: Poppins
fonts: fonts:
- asset: assets/fonts/Poppins-Medium.ttf - asset: assets/fonts/Poppins-Medium.ttf
- family: GessTwo
fonts:
- asset: assets/fonts/GESS-Two-Light.otf
- asset: assets/fonts/GESS-Two-Bold.otf
- asset: assets/fonts/GESS-Two-Medium.otf

Loading…
Cancel
Save