|
|
|
|
@ -2,6 +2,7 @@ import 'package:easy_localization/src/public_ext.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/svg.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/config/routes.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_extensions.dart';
|
|
|
|
|
@ -14,6 +15,16 @@ import 'package:provider/provider.dart';
|
|
|
|
|
class MenusWidget extends StatelessWidget {
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
Widget disabledWidget = Container(
|
|
|
|
|
width: double.infinity,
|
|
|
|
|
height: double.infinity,
|
|
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(10), color: Colors.grey.withOpacity(0.6)),
|
|
|
|
|
child: const Icon(
|
|
|
|
|
Icons.lock_outline,
|
|
|
|
|
color: MyColors.grey57Color,
|
|
|
|
|
size: 40,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
List<int> namesColor = [0xff125765, 0xff239D8F, 0xff2BB8A8, 0xff1D92AA];
|
|
|
|
|
|
|
|
|
|
return Consumer<DashboardProviderModel>(
|
|
|
|
|
@ -29,109 +40,141 @@ class MenusWidget extends StatelessWidget {
|
|
|
|
|
? MenuShimmer().onPress(() {
|
|
|
|
|
data.fetchWorkListCounter(context, showLoading: true);
|
|
|
|
|
})
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[0]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.workList.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[0]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
LocaleKeys.workList.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.workListCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
),
|
|
|
|
|
if (AppState().isDisclosureEnabled) ...[disabledWidget]
|
|
|
|
|
],
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (AppState().isDisclosureEnabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.workList);
|
|
|
|
|
}),
|
|
|
|
|
data.isMissingSwipeLoading
|
|
|
|
|
? MenuShimmer().onPress(() {
|
|
|
|
|
data.fetchWorkListCounter(context);
|
|
|
|
|
})
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[1]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[1]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
LocaleKeys.missingSwipes.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
),
|
|
|
|
|
if (AppState().isDisclosureEnabled) ...[disabledWidget]
|
|
|
|
|
],
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (AppState().isDisclosureEnabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.missingSwipes.tr(), "HMG_OTL_MISSING_SWIPE_EIT_SS"));
|
|
|
|
|
}),
|
|
|
|
|
data.isLeaveTicketBalanceLoading
|
|
|
|
|
? MenuShimmer().onPress(() {
|
|
|
|
|
data.fetchWorkListCounter(context);
|
|
|
|
|
})
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[2]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[2]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
LocaleKeys.leaveBalance.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.leaveBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
),
|
|
|
|
|
if (AppState().isDisclosureEnabled) ...[disabledWidget]
|
|
|
|
|
],
|
|
|
|
|
).onPress(() {
|
|
|
|
|
if (AppState().isDisclosureEnabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.leaveBalance);
|
|
|
|
|
}),
|
|
|
|
|
data.isLeaveTicketBalanceLoading
|
|
|
|
|
? MenuShimmer().onPress(() {
|
|
|
|
|
data.fetchWorkListCounter(context);
|
|
|
|
|
})
|
|
|
|
|
: Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[3]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
: Stack(
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: Color(namesColor[3]),
|
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
LocaleKeys.ticketBalance.tr().toText12(color: Colors.white),
|
|
|
|
|
Row(
|
|
|
|
|
children: [
|
|
|
|
|
Expanded(
|
|
|
|
|
child: data.ticketBalance.toStringAsFixed(2).toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
|
|
|
),
|
|
|
|
|
RotatedBox(quarterTurns: AppState().isArabic(context) ? 2 : 4, child: SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
|
|
|
),
|
|
|
|
|
if (AppState().isDisclosureEnabled) ...[disabledWidget]
|
|
|
|
|
],
|
|
|
|
|
).onPress(
|
|
|
|
|
() {
|
|
|
|
|
if (AppState().isDisclosureEnabled) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
|
|
|
|
|
},
|
|
|
|
|
)
|
|
|
|
|
|