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(
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<DashboardPage> {
void _openImagePicker() {
showDialog<ImageSource>(
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);

@ -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);

Loading…
Cancel
Save