You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			187 lines
		
	
	
		
			8.9 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			187 lines
		
	
	
		
			8.9 KiB
		
	
	
	
		
			Dart
		
	
| 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';
 | |
| import 'package:mohem_flutter_app/generated/locale_keys.g.dart';
 | |
| import 'package:mohem_flutter_app/provider/dashboard_provider_model.dart';
 | |
| import 'package:mohem_flutter_app/ui/my_attendance/dynamic_screens/dynamic_listview_screen.dart';
 | |
| import 'package:mohem_flutter_app/widgets/shimmer/dashboard_shimmer_widget.dart';
 | |
| 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>(
 | |
|       builder: (cxt, data, child) {
 | |
|         return GridView(
 | |
|           gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2, childAspectRatio: 2 / 2, crossAxisSpacing: 9, mainAxisSpacing: 9),
 | |
|           padding: EdgeInsets.zero,
 | |
|           shrinkWrap: true,
 | |
|           primary: false,
 | |
|           physics: const NeverScrollableScrollPhysics(),
 | |
|           children: [
 | |
|             data.isWorkListLoading
 | |
|                 ? MenuShimmer().onPress(() {
 | |
|                     data.fetchWorkListCounter(context, showLoading: true);
 | |
|                   })
 | |
|                 : Stack(
 | |
|                     children: [
 | |
|                       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(
 | |
|                               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),
 | |
|                       ),
 | |
|                       if (AppState().isDisclosureEnabled) ...[disabledWidget]
 | |
|                     ],
 | |
|                   ).onPress(() {
 | |
|                     if (AppState().isDisclosureEnabled) {
 | |
|                       return;
 | |
|                     }
 | |
|                     Navigator.pushNamed(context, AppRoutes.workList);
 | |
|                   }),
 | |
|             data.isMissingSwipeLoading
 | |
|                 ? MenuShimmer().onPress(() {
 | |
|                     data.fetchWorkListCounter(context);
 | |
|                   })
 | |
|                 : Stack(
 | |
|                     children: [
 | |
|                       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(
 | |
|                               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),
 | |
|                       ),
 | |
|                       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);
 | |
|                   })
 | |
|                 : Stack(
 | |
|                     children: [
 | |
|                       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(
 | |
|                               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),
 | |
|                       ),
 | |
|                       if (AppState().isDisclosureEnabled) ...[disabledWidget]
 | |
|                     ],
 | |
|                   ).onPress(() {
 | |
|                     if (AppState().isDisclosureEnabled) {
 | |
|                       return;
 | |
|                     }
 | |
|                     Navigator.pushNamed(context, AppRoutes.leaveBalance);
 | |
|                   }),
 | |
|             data.isLeaveTicketBalanceLoading
 | |
|                 ? MenuShimmer().onPress(() {
 | |
|                     data.fetchWorkListCounter(context);
 | |
|                   })
 | |
|                 : Stack(
 | |
|                     children: [
 | |
|                       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(
 | |
|                               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),
 | |
|                       ),
 | |
|                       if (AppState().isDisclosureEnabled) ...[disabledWidget]
 | |
|                     ],
 | |
|                   ).onPress(
 | |
|                     () {
 | |
|                       if (AppState().isDisclosureEnabled) {
 | |
|                         return;
 | |
|                       }
 | |
|                       Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
 | |
|                     },
 | |
|                   )
 | |
|           ],
 | |
|         );
 | |
|       },
 | |
|     );
 | |
|   }
 | |
| }
 |