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.
143 lines
6.7 KiB
Dart
143 lines
6.7 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/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) {
|
|
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);
|
|
})
|
|
: 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),
|
|
),
|
|
SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)
|
|
],
|
|
)
|
|
],
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
).onPress(() {
|
|
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(
|
|
children: [
|
|
Expanded(
|
|
child: data.missingSwipeCounter.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
),
|
|
SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)
|
|
],
|
|
)
|
|
],
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
).onPress(() {
|
|
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(
|
|
children: [
|
|
Expanded(
|
|
child: data.leaveBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
),
|
|
SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)
|
|
],
|
|
)
|
|
],
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
).onPress(() {
|
|
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(
|
|
children: [
|
|
Expanded(
|
|
child: data.ticketBalance.toString().toText16(color: Colors.white, isBold: true, maxlines: 1),
|
|
),
|
|
SvgPicture.asset("assets/images/arrow_next.svg", color: Colors.white)
|
|
],
|
|
)
|
|
],
|
|
).paddingOnly(left: 10, right: 10, bottom: 6, top: 6),
|
|
).onPress(
|
|
() {
|
|
Navigator.pushNamed(context, AppRoutes.dynamicScreen, arguments: DynamicListViewParams(LocaleKeys.ticketBalance.tr(), "HMG_TKT_NEW_EIT_SS"));
|
|
},
|
|
)
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|