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.
224 lines
10 KiB
Dart
224 lines
10 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
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/extensions/int_extensions.dart';
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
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';
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
class SettingOptionsLanguage extends StatefulWidget {
|
|
const SettingOptionsLanguage({super.key});
|
|
|
|
@override
|
|
State<SettingOptionsLanguage> createState() => _SettingOptionsLanguageState();
|
|
}
|
|
|
|
class _SettingOptionsLanguageState extends State<SettingOptionsLanguage> {
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: CustomAppBar(
|
|
title: LocaleKeys.more.tr(),
|
|
isRemoveBackButton: false,
|
|
isDrawerEnabled: false,
|
|
onBackButtonTapped: () => Navigator.pop(context),
|
|
),
|
|
body: Column(
|
|
children: [
|
|
// (AppState().currentAppType == AppType.provider)
|
|
// ?
|
|
Expanded(
|
|
child: ListView(
|
|
shrinkWrap: true,
|
|
padding: EdgeInsets.zero,
|
|
children: [
|
|
Column(
|
|
children: [
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: const Icon(Icons.quickreply_outlined, size: 20),
|
|
titleText: LocaleKeys.requests.tr(),
|
|
needBorderBelow: true,
|
|
onTap: () {
|
|
context.read<DashboardVmCustomer>().onNavbarTapped(4);
|
|
Navigator.pop(context);
|
|
}),
|
|
if (AppState().currentAppType == AppType.customer) ...[
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: const Icon(Icons.favorite, size: 20),
|
|
titleText: LocaleKeys.favoriteList.tr(),
|
|
needBorderBelow: true,
|
|
onTap: () => navigateWithName(context, AppRoutes.favoriteListView),
|
|
),
|
|
],
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: const Icon(Icons.settings, size: 20),
|
|
titleText: LocaleKeys.settings.tr(),
|
|
needBorderBelow: true,
|
|
onTap: () {},
|
|
//navigateWithName(context, AppRoutes.settingOptionsInviteFriends),
|
|
),
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: const Icon(Icons.question_mark_outlined, size: 20),
|
|
titleText: LocaleKeys.help.tr(),
|
|
needBorderBelow: true,
|
|
onTap: () => navigateWithName(context, AppRoutes.settingOptionsHelp),
|
|
),
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: const Icon(Icons.person, size: 20),
|
|
titleText: LocaleKeys.account.tr(),
|
|
needBorderBelow: false,
|
|
onTap: () {
|
|
navigateWithName(context, AppRoutes.profileView);
|
|
// context.read<DashboardVmCustomer>().onNavbarTapped(4);
|
|
// Navigator.pop(context);
|
|
}),
|
|
],
|
|
).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: () {
|
|
context.read<UserVM>().changeLanguage(context);
|
|
Future.delayed(Duration(seconds: 1), () {
|
|
setState(() {});
|
|
});
|
|
},
|
|
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0),
|
|
10.height,
|
|
(AppState().currentAppType == AppType.provider)
|
|
? Column(
|
|
children: [
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: SizedBox(
|
|
width: 16,
|
|
height: 16,
|
|
child: SvgPicture.asset(
|
|
MyAssets.icStar,
|
|
color: MyColors.primaryColor,
|
|
),
|
|
),
|
|
titleText: LocaleKeys.mySubscription.tr(),
|
|
subTitle: AppState().getproviderSubscription.first.subscriptionName ?? "Silver",
|
|
isForLanguage: false,
|
|
needBorderBelow: true,
|
|
onTap: () {
|
|
navigateWithName(context, AppRoutes.mySubscriptionsPage);
|
|
},
|
|
),
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: SizedBox(
|
|
width: 16,
|
|
height: 16,
|
|
child: SvgPicture.asset(
|
|
MyAssets.icGroupStar,
|
|
// color: MyColors.primaryColor,
|
|
),
|
|
),
|
|
titleText: LocaleKeys.subscriptions.tr(),
|
|
subTitle: null,
|
|
isForLanguage: false,
|
|
needBorderBelow: true,
|
|
onTap: () {
|
|
navigateWithName(context, AppRoutes.subscriptionsPage);
|
|
},
|
|
),
|
|
CustomSettingOptionsTile(
|
|
leadingWidget: SizedBox(
|
|
width: 16,
|
|
height: 16,
|
|
child: SvgPicture.asset(
|
|
MyAssets.icGroupStar,
|
|
// color: MyColors.primaryColor,
|
|
),
|
|
),
|
|
titleText: LocaleKeys.defineLicenses.tr(),
|
|
subTitle: null,
|
|
isForLanguage: false,
|
|
needBorderBelow: false,
|
|
onTap: () {
|
|
navigateWithName(context, AppRoutes.providerLicensePage);
|
|
},
|
|
),
|
|
// CustomSettingOptionsTile(
|
|
// leadingWidget: SizedBox(
|
|
// width: 16,
|
|
// height: 16,
|
|
// child: SvgPicture.asset(
|
|
// MyAssets.providersIcon,
|
|
// // color: MyColors.primaryColor,
|
|
// ),
|
|
// ),
|
|
// titleText: "Users",
|
|
// subTitle: null,
|
|
// isForLanguage: false,
|
|
// needBorderBelow: false,
|
|
// onTap: () {
|
|
// navigateWithName(context, AppRoutes.dealerUser, arguments: AppState().getUser.data!.userInfo!.id.toString());
|
|
// },
|
|
// )
|
|
],
|
|
).toWhiteContainer(width: double.infinity, pading: const EdgeInsets.all(12), borderRadius: 0)
|
|
: const SizedBox(),
|
|
(AppState().currentAppType == AppType.provider) ? 10.height : const SizedBox(),
|
|
],
|
|
)),
|
|
// : Expanded(
|
|
// child: ListView(
|
|
// children: [
|
|
// Column(
|
|
// children: [
|
|
// CustomSettingOptionsTile(
|
|
// leadingWidget: const Icon(Icons.person, size: 20),
|
|
// titleText: "My Requests",
|
|
// needBorderBelow: true,
|
|
// onTap: () {
|
|
// context.read<DashboardVmCustomer>().onNavbarTapped(4);
|
|
// Navigator.pop(context);
|
|
// }),
|
|
// CustomSettingOptionsTile(leadingWidget: const Icon(Icons.favorite, size: 20), titleText: "Favorite list", needBorderBelow: true, onTap: () {}),
|
|
// CustomSettingOptionsTile(
|
|
// leadingWidget: const Icon(Icons.settings, size: 20), titleText: "Settings", onTap: () => navigateWithName(context, AppRoutes.settingOptionsInviteFriends)),
|
|
// ],
|
|
// ).toContainer(width: double.infinity, isShadowEnabled: true, paddingAll: 10, margin: const EdgeInsets.fromLTRB(24, 24, 24, 0), borderRadius: 0),
|
|
// CustomSettingOptionsTile(leadingWidget: const Icon(Icons.translate, size: 20), titleText: "Language", isForLanguage: true, onTap: () {})
|
|
// .toContainer(width: double.infinity, isShadowEnabled: true, paddingAll: 10, marginAll: 21, borderRadius: 0),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
(AppState().currentAppType == AppType.provider) ? Text(LocaleKeys.provider.tr()) : Text(LocaleKeys.customer.tr()),
|
|
Row(
|
|
children: [
|
|
Expanded(
|
|
child: ShowFillButton(
|
|
borderColor: MyColors.redColor,
|
|
txtColor: MyColors.redColor,
|
|
isFilled: false,
|
|
fontSize: 16,
|
|
maxHeight: 55,
|
|
title: LocaleKeys.logOut.tr(),
|
|
onPressed: () {
|
|
context.read<UserVM>().logout(context);
|
|
},
|
|
),
|
|
),
|
|
],
|
|
).paddingAll(0),
|
|
],
|
|
).paddingAll(21),
|
|
);
|
|
}
|
|
}
|