From 88ad86146b52a19898956c8c8d0933dc86432c20 Mon Sep 17 00:00:00 2001 From: "mirza.shafique" Date: Sun, 19 Mar 2023 09:13:17 +0300 Subject: [PATCH] Latest Code --- lib/pages/dashboard/dashboard_page.dart | 273 ++++++++++++------------ lib/pages/user/splash_page.dart | 2 + 2 files changed, 138 insertions(+), 137 deletions(-) diff --git a/lib/pages/dashboard/dashboard_page.dart b/lib/pages/dashboard/dashboard_page.dart index 734436b..2700aa3 100644 --- a/lib/pages/dashboard/dashboard_page.dart +++ b/lib/pages/dashboard/dashboard_page.dart @@ -57,158 +57,154 @@ class _DashboardPageState extends State { return Scaffold( appBar: appBar(context, title: "Logo/Brand", isRemoveBackButton: true), drawer: showDrawer(context), - body: Container( - child: Center( - child: LocaleKeys.dashboard.tr().toText24(), - ), + body: Center( + child: LocaleKeys.dashboard.tr().toText24(), ), ); } Widget showDrawer(BuildContext context) { return Drawer( - child: Container( - child: Column( - children: [ - Stack(children: [ - Container( - width: double.infinity, - height: 200, - color: MyColors.darkPrimaryColor.withOpacity(0.01), - child: Image.network( - ApiConsts.baseUrlServices + AppState().getUser.data!.userInfo!.userImageUrl.toString(), - ), - ), - Positioned( - top: 10, - right: 10, - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Column( - children: [ - Container( - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(30), - ), - child: Icon( - Icons.edit, - color: MyColors.darkPrimaryColor, - ).onPress(() { - _openImagePicker(); - // _handleURLButtonPress(context, ImageSourceType.camera); - }), - ), - 12.height, - Container( - width: 40, - height: 40, - decoration: BoxDecoration( - color: Colors.grey[200], - borderRadius: BorderRadius.circular(30), - ), - child: Icon( - Icons.delete, - color: Colors.red, - ).onPress(() async { - Utils.showLoading(context); - ImageResponse response = await UserApiClent().UpdateUserImage(""); - if (response.messageStatus == 1) { - Utils.showToast("Image is Deleted"); - setState(() { - AppState().getUser.data!.userInfo!.userImageUrl = response.data; - }); - } - Utils.hideLoading(context); - }), - ), - ], - ), - ], - ), - ) - ]), + child: Column( + children: [ + Stack(children: [ Container( width: double.infinity, - color: MyColors.darkPrimaryColor.withOpacity(0.1), - padding: EdgeInsets.all(20), + height: 200, + color: MyColors.darkPrimaryColor.withOpacity(0.01), + child: Image.network( + ApiConsts.baseUrlServices + AppState().getUser.data!.userInfo!.userImageUrl.toString(), + ), + ), + Positioned( + top: 10, + right: 10, child: Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - userName.toText20(isBold: true), - AppState().getUser.data!.userInfo!.roleName!.toText10(), - ], - ), - ), - ShowFillButton( - title: LocaleKeys.edit.tr(), - fontSize: 12, - maxHeight: 35, - maxWidth: 70, - onPressed: () { - navigateWithName(context, AppRoutes.editAccoundPage); - }, + Column( + children: [ + Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: BorderRadius.circular(30), + ), + child: const Icon( + Icons.edit, + color: MyColors.darkPrimaryColor, + ).onPress(() { + _openImagePicker(); + // _handleURLButtonPress(context, ImageSourceType.camera); + }), + ), + 12.height, + Container( + width: 40, + height: 40, + decoration: BoxDecoration( + color: Colors.grey[200], + borderRadius: BorderRadius.circular(30), + ), + child: const Icon( + Icons.delete, + color: Colors.red, + ).onPress(() async { + Utils.showLoading(context); + ImageResponse response = await UserApiClent().UpdateUserImage(""); + if (response.messageStatus == 1) { + Utils.showToast("Image is Deleted"); + setState(() { + AppState().getUser.data!.userInfo!.userImageUrl = response.data; + }); + } + Utils.hideLoading(context); + }), + ), + ], ), ], ), + ) + ]), + Container( + width: double.infinity, + color: MyColors.darkPrimaryColor.withOpacity(0.1), + padding: const EdgeInsets.all(20), + child: Row( + children: [ + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + userName.toText20(isBold: true), + AppState().getUser.data!.userInfo!.roleName!.toText10(), + ], + ), + ), + ShowFillButton( + title: LocaleKeys.edit.tr(), + fontSize: 12, + maxHeight: 35, + maxWidth: 70, + onPressed: () { + navigateWithName(context, AppRoutes.editAccoundPage); + }, + ), + ], ), - ListTile( - leading: Icon( - Icons.notifications, - color: MyColors.darkPrimaryColor, - ), - title: LocaleKeys.notifications.tr().toText12(), + ), + ListTile( + leading: const Icon( + Icons.notifications, + color: MyColors.darkPrimaryColor, ), - ListTile( - leading: Icon( - Icons.settings, - color: MyColors.darkPrimaryColor, - ), - title: LocaleKeys.general.tr().toText12(), + title: LocaleKeys.notifications.tr().toText12(), + ), + ListTile( + leading: const Icon( + Icons.settings, + color: MyColors.darkPrimaryColor, ), - ListTile( - leading: Icon( - Icons.person, - color: MyColors.darkPrimaryColor, - ), - title: LocaleKeys.account.tr().toText12(), + title: LocaleKeys.general.tr().toText12(), + ), + ListTile( + leading: const Icon( + Icons.person, + color: MyColors.darkPrimaryColor, ), - ListTile( - leading: Image.asset( - "assets/images/ic_world.png", - width: 20, - height: 20, - color: MyColors.darkPrimaryColor, - ), - title: LocaleKeys.english.tr().toText12(), - onTap: () { - if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA") - context.setLocale(const Locale("en", "US")); - else - context.setLocale(const Locale('ar', 'SA')); - }, + title: LocaleKeys.account.tr().toText12(), + ), + ListTile( + leading: Image.asset( + "assets/images/ic_world.png", + width: 20, + height: 20, + color: MyColors.darkPrimaryColor, ), - ListTile( - leading: Icon( - Icons.logout, - color: MyColors.darkPrimaryColor, - ), - title: LocaleKeys.signOut.tr().toText12(), - onTap: () { - pop(context); - navigateReplaceWithName(context, AppRoutes.registerSelection); - }, + title: LocaleKeys.english.tr().toText12(), + onTap: () { + if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA") + context.setLocale(const Locale("en", "US")); + else + context.setLocale(const Locale('ar', 'SA')); + }, + ), + ListTile( + leading: const Icon( + Icons.logout, + color: MyColors.darkPrimaryColor, ), - ], - ), + title: LocaleKeys.signOut.tr().toText12(), + onTap: () { + pop(context); + navigateReplaceWithName(context, AppRoutes.registerSelection); + }, + ), + ], ), ); } @@ -216,10 +212,13 @@ class _DashboardPageState extends State { void _openImagePicker() { showDialog( context: context, - builder: (context) => AlertDialog(content: Text("Choose image source"), actions: [ - TextButton(child: Text("Camera"), onPressed: () => cameraImage()), - TextButton(child: Text("Gallery"), onPressed: () => gallaryImage()), - ]), + builder: (context) => AlertDialog( + content: const Text("Choose image source"), + actions: [ + TextButton(child: const Text("Camera"), onPressed: () => cameraImage()), + TextButton(child: const Text("Gallery"), onPressed: () => gallaryImage()), + ], + ), // .then((ImageSource source) async { // if (source != null) { // final pickedFile = await ImagePicker().getImage(source: source); diff --git a/lib/pages/user/splash_page.dart b/lib/pages/user/splash_page.dart index 2a4c355..334c1cb 100644 --- a/lib/pages/user/splash_page.dart +++ b/lib/pages/user/splash_page.dart @@ -8,6 +8,8 @@ import 'package:flutter/material.dart'; import '../../classes/colors.dart'; class SplashPage extends StatelessWidget { + const SplashPage({Key? key}) : super(key: key); + @override Widget build(BuildContext context) { performTimer(context);