language switch added in drawer, and ui improvements

pull/46/head
Sikander Saleem 1 month ago
parent f04f3bcd9c
commit 57827549b8

@ -87,11 +87,12 @@ class _LandingPageState extends State<LandingPage> {
return Scaffold( return Scaffold(
backgroundColor: AppColors.bgScaffoldColor, backgroundColor: AppColors.bgScaffoldColor,
body: SingleChildScrollView( body: SingleChildScrollView(
padding: EdgeInsets.only(top: kToolbarHeight + 12.h, bottom: 24),
child: Column( child: Column(
spacing: 16.h,
children: [ children: [
Padding( Row(
padding: EdgeInsets.only(top: 50.0), spacing: 8.h,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
appState.isAuthenticated appState.isAuthenticated
@ -118,6 +119,7 @@ class _LandingPageState extends State<LandingPage> {
), ),
Row( Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
spacing: 12.h,
children: [ children: [
Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() { Utils.buildSvgWithAssets(icon: AppAssets.bell, height: 20, width: 20).onPress(() {
Navigator.of(context).push( Navigator.of(context).push(
@ -126,7 +128,7 @@ class _LandingPageState extends State<LandingPage> {
// page: LoginScreen(), // page: LoginScreen(),
), ),
); );
}).paddingSymmetrical(8.h, 0), }),
Utils.buildSvgWithAssets(icon: AppAssets.search_icon, height: 20, width: 20).onPress(() { Utils.buildSvgWithAssets(icon: AppAssets.search_icon, height: 20, width: 20).onPress(() {
Navigator.of(context).push( Navigator.of(context).push(
FadePage( FadePage(
@ -134,7 +136,7 @@ class _LandingPageState extends State<LandingPage> {
// page: LoginScreen(), // page: LoginScreen(),
), ),
); );
}).paddingSymmetrical(8.h, 0), }),
Utils.buildSvgWithAssets(icon: AppAssets.contact_icon, height: 20, width: 20).onPress(() { Utils.buildSvgWithAssets(icon: AppAssets.contact_icon, height: 20, width: 20).onPress(() {
Navigator.of(context).push( Navigator.of(context).push(
FadePage( FadePage(
@ -142,13 +144,11 @@ class _LandingPageState extends State<LandingPage> {
// page: LoginScreen(), // page: LoginScreen(),
), ),
); );
}).paddingSymmetrical(8.h, 0), }),
], ],
) )
], ],
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),
),
SizedBox(height: 16.h),
appState.isAuthenticated appState.isAuthenticated
? Column( ? Column(
children: [ children: [
@ -300,7 +300,6 @@ class _LandingPageState extends State<LandingPage> {
), ),
), ),
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 16.h),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
@ -314,7 +313,6 @@ class _LandingPageState extends State<LandingPage> {
), ),
], ],
).paddingSymmetrical(24.h, 0.h), ).paddingSymmetrical(24.h, 0.h),
SizedBox(height: 16.h),
SizedBox( SizedBox(
height: 325.h, height: 325.h,
child: Column( child: Column(
@ -348,9 +346,7 @@ class _LandingPageState extends State<LandingPage> {
], ],
), ),
), ),
SizedBox(height: 16.h),
appState.isAuthenticated ? HabibWalletCard() : SizedBox(), appState.isAuthenticated ? HabibWalletCard() : SizedBox(),
SizedBox(height: 16.h),
], ],
), ),
), ),

@ -1,3 +1,4 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_swiper_view/flutter_swiper_view.dart'; import 'package:flutter_swiper_view/flutter_swiper_view.dart';
import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart';
@ -12,8 +13,10 @@ import 'package:hmg_patient_app_new/presentation/habib_wallet/habib_wallet_page.
import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart'; import 'package:hmg_patient_app_new/presentation/habib_wallet/recharge_wallet_page.dart';
import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/presentation/lab/collapsing_list_view.dart';
import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/app_language_change.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart'; import 'package:hmg_patient_app_new/widgets/chip/app_custom_chip_widget.dart';
import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart'; import 'package:hmg_patient_app_new/widgets/routes/custom_page_route.dart';
import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart'; import 'package:hmg_patient_app_new/widgets/transitions/fade_page.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -137,7 +140,9 @@ class _ProfileSettingsState extends State<ProfileSettings> {
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true), decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
child: Column( child: Column(
children: [ children: [
actionItem(AppAssets.language_change, "Language".needTranslation, () {}, trailingLabel: "English".needTranslation), actionItem(AppAssets.language_change, "Language".needTranslation, () {
showCommonBottomSheetWithoutHeight(context, title: "Application Language".needTranslation, child: AppLanguageChange(), callBackFunc: () {}, isFullScreen: false);
}, trailingLabel: Utils.appState.isArabic() ? "العربية".needTranslation : "English".needTranslation),
1.divider, 1.divider,
actionItem(AppAssets.accessibility, "Accessibility".needTranslation, () {}), actionItem(AppAssets.accessibility, "Accessibility".needTranslation, () {}),
1.divider, 1.divider,
@ -208,7 +213,10 @@ class _ProfileSettingsState extends State<ProfileSettings> {
activeColor: AppColors.successColor, activeColor: AppColors.successColor,
activeTrackColor: AppColors.successColor.withValues(alpha: .15), activeTrackColor: AppColors.successColor.withValues(alpha: .15),
) )
: Utils.buildSvgWithAssets(icon: isExternalLink ? AppAssets.externalLink : AppAssets.arrow_forward), : Transform.scale(
scaleX: Utils.appState.isArabic() ? -1 : 1,
child: Utils.buildSvgWithAssets(icon: isExternalLink ? AppAssets.externalLink : AppAssets.arrow_forward),
)
], ],
).paddingOnly(left: 16, right: 16).onPress(onPress), ).paddingOnly(left: 16, right: 16).onPress(onPress),
); );

@ -0,0 +1,87 @@
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/extensions/int_extensions.dart';
import 'package:hmg_patient_app_new/extensions/string_extensions.dart';
import 'package:hmg_patient_app_new/extensions/widget_extensions.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/theme/colors.dart';
import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart';
class AppLanguageChange extends StatefulWidget {
AppLanguageChange({Key? key}) : super(key: key);
@override
_AppLanguageChangeState createState() {
return _AppLanguageChangeState();
}
}
class _AppLanguageChangeState extends State<AppLanguageChange> {
String? selectedValue;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
selectedValue ??= context.locale.languageCode;
return Column(
spacing: 24.h,
children: [
Container(
padding: EdgeInsets.only(top: 4, bottom: 4),
decoration: RoundedRectangleBorder().toSmoothCornerDecoration(color: AppColors.whiteColor, borderRadius: 24.h, hasShadow: true),
child: Column(
children: [
languageItem("English".needTranslation, "en"),
1.divider,
languageItem("العربية".needTranslation, "ar"),
],
),
),
CustomButton(
text: LocaleKeys.save.tr(),
onPressed: () {
context.setLocale(selectedValue == 'en' ? Locale('en', 'US') : Locale('ar', 'SA')).then((val) {
Navigator.pop(context);
});
}),
],
);
}
Widget languageItem(String title, String _value) {
return SizedBox(
height: 72,
child: Row(
spacing: 8.h,
children: [
Radio(
value: _value,
groupValue: selectedValue,
activeColor: AppColors.errorColor,
onChanged: (value) {
setState(() {
selectedValue = _value;
});
},
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
),
title.toText16(weight: FontWeight.w500, textOverflow: TextOverflow.ellipsis, maxlines: 1).expanded,
],
).paddingOnly(left: 16, right: 16).onPress(() {
setState(() {
selectedValue = _value;
});
}),
);
}
}

@ -109,11 +109,11 @@ void showCommonBottomSheetWithoutHeight(
required Widget child, required Widget child,
required VoidCallback callBackFunc, required VoidCallback callBackFunc,
String title = "", String title = "",
bool isCloseButtonVisible = true, bool isCloseButtonVisible = true,
bool isFullScreen = true, bool isFullScreen = true,
bool isDismissible = true, bool isDismissible = true,
Widget? titleWidget,}) { Widget? titleWidget,
}) {
showModalBottomSheet<String>( showModalBottomSheet<String>(
sheetAnimationStyle: AnimationStyle( sheetAnimationStyle: AnimationStyle(
duration: Duration(milliseconds: 500), // Custom animation duration duration: Duration(milliseconds: 500), // Custom animation duration

Loading…
Cancel
Save