arabic fonts, logout, subscription app state.

master_new_changes
Aamir.Muhammad 1 year ago
parent b7d3e4ab72
commit cb04d4a2fb

Binary file not shown.

Binary file not shown.

Binary file not shown.

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

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

@ -1,5 +1,6 @@
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/subscriptions_models/provider_subscription_model.dart';
import 'package:mc_common_app/models/user_models/user.dart';
import 'package:mc_common_app/utils/enums.dart';
@ -44,4 +45,12 @@ class AppState {
set setCurrentLocation(v) => currentLocation = v;
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 {
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": "تحديد التراخيص",
"logOut": "تسجيل الخروج",
"customer": "العميل",
"accept": "قبول"
"accept": "قبول",
"amountVAR": "كمية"
};
static const Map<String,dynamic> en_US = {
"firstTimeLogIn": "First Time Log In",
@ -1153,7 +1154,8 @@ static const Map<String,dynamic> en_US = {
"defineLicenses": "Define Licenses",
"logOut": "Log Out",
"customer": "Customer",
"accept": "Accept"
"accept": "Accept",
"amountVAR": "Amount"
};
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 customer = 'customer';
static const accept = 'accept';
static const amountVAR = 'amountVAR';
}

@ -5,14 +5,14 @@ import 'colors.dart';
class AppTheme {
static getTheme({required isArabic}) {
return ThemeData(
fontFamily: !isArabic ? MyFonts.poppinsFont : null,
fontFamily: !isArabic ? MyFonts.poppinsFont : MyFonts.gessTwoFont,
primaryColor: primaryColor,
useMaterial3: false,
primaryTextTheme: const TextTheme(
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();
// 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);
applyFilterOnAppointmentsVM(appointmentStatusEnum: AppointmentStatusEnum.allAppointments);
notifyListeners();

@ -178,6 +178,7 @@ class SubscriptionsVM extends BaseVM {
setState(ViewState.busy);
if (mySubscriptionsBySp.isEmpty) {
mySubscriptionsBySp = await subscriptionRepo.getProviderSubscription(serviceProviderID: serviceProviderID);
AppState().setproviderSubscription = mySubscriptionsBySp;
}
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 confirmPassword,
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 {
if (loginType == "3" || loginType == "4") {
//Utils.showLoading(context);
//Utils.showLoading(context);
LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, loginType!);
if (user.messageStatus == 1) {
Response response2 = await userRepo.loginV2OTPVerify(user.data!.userToken ?? "", "9999");
@ -377,17 +378,17 @@ class UserVM extends BaseVM {
SharedPrefManager.setData(jsonEncode(user.data!.userInfo!.toJson()));
navigateReplaceWithName(context, AppRoutes.dashboard);
} else {
Utils.showToast(LocaleKeys.onlyCustomerApp.tr());
Utils.showToast(LocaleKeys.onlyCustomerApp.tr());
}
}
} else {
Utils.showToast(verifiedUser.message ?? "");
Utils.showToast(verifiedUser.message ?? "");
}
}
} else {
// Utils.showLoading(context);
// Utils.showLoading(context);
LoginPasswordRespModel user = await userRepo.loginV2OTP(userToken, "1");
// Utils.hideLoading(context);
// Utils.hideLoading(context);
if (user.messageStatus == 1) {
showMDialog(context, child: OtpDialog(
onClick: (String code) async {
@ -518,8 +519,8 @@ class UserVM extends BaseVM {
type == ClassType.NUMBER && countryCode != null
? countryCode + phoneNum
: type == ClassType.NUMBER && countryCode == null
? phoneNum
: phoneNum,
? phoneNum
: phoneNum,
password);
Utils.hideLoading(context);
LoginPasswordRespModel user = LoginPasswordRespModel.fromJson(jsonDecode(response.body));
@ -527,8 +528,8 @@ class UserVM extends BaseVM {
SharedPrefManager.setPhoneOrEmail(type == ClassType.NUMBER && countryCode != null
? countryCode + phoneNum
: type == ClassType.NUMBER && countryCode == null
? phoneNum
: phoneNum);
? phoneNum
: phoneNum);
SharedPrefManager.setUserPassword(password);
navigateReplaceWithName(context, AppRoutes.loginMethodSelection, arguments: user.data!.userToken);
} else {
@ -639,4 +640,17 @@ class UserVM extends BaseVM {
_loginOtherAccount = true;
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(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
LocaleKeys.amount
LocaleKeys.amountVAR
.tr()
.toText(fontSize: 16, isBold: true),
Row(

@ -24,24 +24,23 @@ class CustomerAppointmentSliderWidget extends StatelessWidget {
Widget getCorouselWidget(AppType appType, AppointmentsVM appointmentsVM) {
return CarouselSlider.builder(
options: CarouselOptions(
height: 110,
height: appType == AppType.provider ? 110 : 140,
viewportFraction: 1.0,
enlargeCenterPage: false,
enableInfiniteScroll: false,
),
itemCount: appointmentsVM.myUpComingAppointments.length,
itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) =>
BuildAppointmentContainerForCustomer(
isForHome: true,
appointmentListModel: appointmentsVM.myUpComingAppointments[itemIndex],
onTapped: () {
if (appType == AppType.provider) {
onAppointmentClick!(appointmentsVM.myUpComingAppointments[itemIndex]);
} else {
navigateWithName(context, AppRoutes.appointmentDetailView, arguments: appointmentsVM.myUpComingAppointments[itemIndex]);
}
},
),
itemBuilder: (BuildContext context, int itemIndex, int pageViewIndex) => BuildAppointmentContainerForCustomer(
isForHome: appType == AppType.provider,
appointmentListModel: appointmentsVM.myUpComingAppointments[itemIndex],
onTapped: () {
if (appType == AppType.provider) {
onAppointmentClick!(appointmentsVM.myUpComingAppointments[itemIndex]);
} else {
navigateWithName(context, AppRoutes.appointmentDetailView, arguments: appointmentsVM.myUpComingAppointments[itemIndex]);
}
},
),
);
}
@ -179,7 +178,7 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
List<Widget> servicesList = List.generate(
2,
(index) => showServices(appointmentListModel.appointmentServicesList![index].providerServiceDescription, MyAssets.modificationsIcon),
(index) => showServices(appointmentListModel.appointmentServicesList![index].providerServiceDescription, MyAssets.modificationsIcon),
);
if (appointmentListModel.appointmentServicesList!.length > 1) {
@ -205,17 +204,17 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
children: [
isForHome != null && isForHome!
? Image.asset(
MyAssets.bnCar,
width: 56,
height: 56,
fit: BoxFit.fill,
).toCircle(borderRadius: 100)
MyAssets.bnCar,
width: 56,
height: 56,
fit: BoxFit.fill,
).toCircle(borderRadius: 100)
: Image.asset(
MyAssets.bnCar,
width: 80,
height: 85,
fit: BoxFit.cover,
),
MyAssets.bnCar,
width: 80,
height: 85,
fit: BoxFit.cover,
),
8.width,
Expanded(
child: Column(
@ -237,31 +236,31 @@ class BuildAppointmentContainerForCustomer extends StatelessWidget {
9.height,
isForHome != null && isForHome!
? Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
"Appointment Details".toText(
color: MyColors.primaryColor,
isUnderLine: true,
isBold: true,
fontSize: 14,
),
const Icon(Icons.arrow_forward),
],
)
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.end,
children: [
"Appointment Details".toText(
color: MyColors.primaryColor,
isUnderLine: true,
isBold: true,
fontSize: 14,
),
const Icon(Icons.arrow_forward),
],
)
: Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Column(
children: buildServicesFromAppointment(appointmentListModel: appointmentListModel!),
crossAxisAlignment: CrossAxisAlignment.end,
children: [
Expanded(
child: Column(
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/navigator.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/widgets/button/show_fill_button.dart';
import 'package:mc_common_app/widgets/common_widgets/app_bar.dart';
@ -40,8 +41,7 @@ class SettingOptionsLanguage extends StatelessWidget {
Column(
children: [
CustomSettingOptionsTile(
leadingWidget:
const Icon(Icons.quickreply_outlined, size: 20),
leadingWidget: const Icon(Icons.quickreply_outlined, size: 20),
titleText: LocaleKeys.requests.tr(),
needBorderBelow: true,
onTap: () {
@ -56,12 +56,10 @@ class SettingOptionsLanguage extends StatelessWidget {
//navigateWithName(context, AppRoutes.settingOptionsInviteFriends),
),
CustomSettingOptionsTile(
leadingWidget:
const Icon(Icons.question_mark_outlined, size: 20),
leadingWidget: const Icon(Icons.question_mark_outlined, size: 20),
titleText: LocaleKeys.help.tr(),
needBorderBelow: true,
onTap: () =>
navigateWithName(context, AppRoutes.settingOptionsHelp),
onTap: () => navigateWithName(context, AppRoutes.settingOptionsHelp),
),
CustomSettingOptionsTile(
leadingWidget: const Icon(Icons.person, size: 20),
@ -73,29 +71,25 @@ class SettingOptionsLanguage extends StatelessWidget {
// Navigator.pop(context);
}),
],
).toWhiteContainer(
width: double.infinity,
pading: const EdgeInsets.all(12),
borderRadius: 0),
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0),
10.height,
CustomSettingOptionsTile(
leadingWidget: const Icon(Icons.translate, size: 20),
titleText: LocaleKeys.language.tr(),
isForLanguage: true,
onTap: () {
if (EasyLocalization.of(context)
?.currentLocale
?.countryCode ==
"SA") {
context.setLocale(const Locale("en", "US"));
} else {
context.setLocale(const Locale('ar', 'SA'));
}
// if (EasyLocalization.of(context)
// ?.currentLocale
// ?.countryCode ==
// "SA") {
// context.setLocale(const Locale("en", "US"));
// } else {
// context.setLocale(const Locale('ar', 'SA'));
// }
context.read<UserVM>().changeLanguage(context);
},
).toWhiteContainer(
width: double.infinity,
pading: const EdgeInsets.all(12),
borderRadius: 0),
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0),
10.height,
(AppState().currentAppType == AppType.provider)
? Column(
@ -114,8 +108,7 @@ class SettingOptionsLanguage extends StatelessWidget {
isForLanguage: false,
needBorderBelow: true,
onTap: () {
navigateWithName(
context, AppRoutes.mySubscriptionsPage);
navigateWithName(context, AppRoutes.mySubscriptionsPage);
},
),
CustomSettingOptionsTile(
@ -132,8 +125,7 @@ class SettingOptionsLanguage extends StatelessWidget {
isForLanguage: false,
needBorderBelow: true,
onTap: () {
navigateWithName(
context, AppRoutes.subscriptionsPage);
navigateWithName(context, AppRoutes.subscriptionsPage);
},
),
CustomSettingOptionsTile(
@ -150,19 +142,13 @@ class SettingOptionsLanguage extends StatelessWidget {
isForLanguage: false,
needBorderBelow: false,
onTap: () {
navigateWithName(
context, AppRoutes.providerLicensePage);
navigateWithName(context, AppRoutes.providerLicensePage);
},
)
],
).toWhiteContainer(
width: double.infinity,
pading: const EdgeInsets.all(12),
borderRadius: 0)
: SizedBox(),
(AppState().currentAppType == AppType.provider)
? 10.height
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0)
: SizedBox(),
(AppState().currentAppType == AppType.provider) ? 10.height : SizedBox(),
],
)),
// : Expanded(
@ -188,9 +174,7 @@ class SettingOptionsLanguage extends StatelessWidget {
// ],
// ),
// ),
(AppState().currentAppType == AppType.provider)
? Text(LocaleKeys.provider.tr())
: Text(LocaleKeys.customer.tr()),
(AppState().currentAppType == AppType.provider) ? Text(LocaleKeys.provider.tr()) : Text(LocaleKeys.customer.tr()),
Row(
children: [
Expanded(
@ -201,7 +185,9 @@ class SettingOptionsLanguage extends StatelessWidget {
fontSize: 16,
maxHeight: 55,
title: LocaleKeys.logOut.tr(),
onPressed: () {},
onPressed: () {
context.read<UserVM>().logout(context);
},
),
),
],

@ -73,10 +73,15 @@ flutter:
- assets/icons/
- assets/icons/payments/
- assets/images/
- assets/fonts/Poppins-Medium.ttf
- assets/fonts/
fonts:
- family: Poppins
fonts:
- 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