Latest Code

merge-requests/1/merge
mirza.shafique 3 years ago
parent 416c79ca09
commit 88ad86146b

@ -57,158 +57,154 @@ class _DashboardPageState extends State<DashboardPage> {
return Scaffold( return Scaffold(
appBar: appBar(context, title: "Logo/Brand", isRemoveBackButton: true), appBar: appBar(context, title: "Logo/Brand", isRemoveBackButton: true),
drawer: showDrawer(context), drawer: showDrawer(context),
body: Container( body: Center(
child: Center( child: LocaleKeys.dashboard.tr().toText24(),
child: LocaleKeys.dashboard.tr().toText24(),
),
), ),
); );
} }
Widget showDrawer(BuildContext context) { Widget showDrawer(BuildContext context) {
return Drawer( return Drawer(
child: Container( child: Column(
child: Column( children: [
children: [ Stack(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);
}),
),
],
),
],
),
)
]),
Container( Container(
width: double.infinity, width: double.infinity,
color: MyColors.darkPrimaryColor.withOpacity(0.1), height: 200,
padding: EdgeInsets.all(20), color: MyColors.darkPrimaryColor.withOpacity(0.01),
child: Image.network(
ApiConsts.baseUrlServices + AppState().getUser.data!.userInfo!.userImageUrl.toString(),
),
),
Positioned(
top: 10,
right: 10,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Expanded( Column(
child: Column( children: [
mainAxisAlignment: MainAxisAlignment.start, Container(
crossAxisAlignment: CrossAxisAlignment.start, width: 40,
children: [ height: 40,
userName.toText20(isBold: true), decoration: BoxDecoration(
AppState().getUser.data!.userInfo!.roleName!.toText10(), color: Colors.grey[200],
], borderRadius: BorderRadius.circular(30),
), ),
), child: const Icon(
ShowFillButton( Icons.edit,
title: LocaleKeys.edit.tr(), color: MyColors.darkPrimaryColor,
fontSize: 12, ).onPress(() {
maxHeight: 35, _openImagePicker();
maxWidth: 70, // _handleURLButtonPress(context, ImageSourceType.camera);
onPressed: () { }),
navigateWithName(context, AppRoutes.editAccoundPage); ),
}, 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( ListTile(
Icons.notifications, leading: const Icon(
color: MyColors.darkPrimaryColor, Icons.notifications,
), color: MyColors.darkPrimaryColor,
title: LocaleKeys.notifications.tr().toText12(),
), ),
ListTile( title: LocaleKeys.notifications.tr().toText12(),
leading: Icon( ),
Icons.settings, ListTile(
color: MyColors.darkPrimaryColor, leading: const Icon(
), Icons.settings,
title: LocaleKeys.general.tr().toText12(), color: MyColors.darkPrimaryColor,
), ),
ListTile( title: LocaleKeys.general.tr().toText12(),
leading: Icon( ),
Icons.person, ListTile(
color: MyColors.darkPrimaryColor, leading: const Icon(
), Icons.person,
title: LocaleKeys.account.tr().toText12(), color: MyColors.darkPrimaryColor,
), ),
ListTile( title: LocaleKeys.account.tr().toText12(),
leading: Image.asset( ),
"assets/images/ic_world.png", ListTile(
width: 20, leading: Image.asset(
height: 20, "assets/images/ic_world.png",
color: MyColors.darkPrimaryColor, width: 20,
), height: 20,
title: LocaleKeys.english.tr().toText12(), color: MyColors.darkPrimaryColor,
onTap: () {
if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA")
context.setLocale(const Locale("en", "US"));
else
context.setLocale(const Locale('ar', 'SA'));
},
), ),
ListTile( title: LocaleKeys.english.tr().toText12(),
leading: Icon( onTap: () {
Icons.logout, if (EasyLocalization.of(context)?.currentLocale?.countryCode == "SA")
color: MyColors.darkPrimaryColor, context.setLocale(const Locale("en", "US"));
), else
title: LocaleKeys.signOut.tr().toText12(), context.setLocale(const Locale('ar', 'SA'));
onTap: () { },
pop(context); ),
navigateReplaceWithName(context, AppRoutes.registerSelection); 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<DashboardPage> {
void _openImagePicker() { void _openImagePicker() {
showDialog<ImageSource>( showDialog<ImageSource>(
context: context, context: context,
builder: (context) => AlertDialog(content: Text("Choose image source"), actions: [ builder: (context) => AlertDialog(
TextButton(child: Text("Camera"), onPressed: () => cameraImage()), content: const Text("Choose image source"),
TextButton(child: Text("Gallery"), onPressed: () => gallaryImage()), actions: [
]), TextButton(child: const Text("Camera"), onPressed: () => cameraImage()),
TextButton(child: const Text("Gallery"), onPressed: () => gallaryImage()),
],
),
// .then((ImageSource source) async { // .then((ImageSource source) async {
// if (source != null) { // if (source != null) {
// final pickedFile = await ImagePicker().getImage(source: source); // final pickedFile = await ImagePicker().getImage(source: source);

@ -8,6 +8,8 @@ import 'package:flutter/material.dart';
import '../../classes/colors.dart'; import '../../classes/colors.dart';
class SplashPage extends StatelessWidget { class SplashPage extends StatelessWidget {
const SplashPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
performTimer(context); performTimer(context);

Loading…
Cancel
Save