|
|
|
@ -9,6 +9,7 @@ import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
import 'package:mohem_flutter_app/app_state/app_state.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/colors.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
import 'package:mohem_flutter_app/classes/utils.dart';
|
|
|
|
|
|
|
|
import 'package:mohem_flutter_app/config/env.dart';
|
|
|
|
import 'package:mohem_flutter_app/config/routes.dart';
|
|
|
|
import 'package:mohem_flutter_app/config/routes.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/int_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
import 'package:mohem_flutter_app/extensions/string_extensions.dart';
|
|
|
|
@ -56,9 +57,12 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
super.initState();
|
|
|
|
super.initState();
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
scheduleMicrotask(() {
|
|
|
|
data = Provider.of<DashboardProviderModel>(context, listen: false);
|
|
|
|
data = Provider.of<DashboardProviderModel>(context, listen: false);
|
|
|
|
|
|
|
|
if (env["marathon"]) {
|
|
|
|
marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
|
|
|
|
marathonProvider = Provider.of<MarathonProvider>(context, listen: false);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (env["chat"]) {
|
|
|
|
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
|
|
|
|
cProvider = Provider.of<ChatProviderModel>(context, listen: false);
|
|
|
|
|
|
|
|
}
|
|
|
|
_onRefresh();
|
|
|
|
_onRefresh();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -80,20 +84,28 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
|
|
|
|
|
|
|
void _onRefresh() async {
|
|
|
|
void _onRefresh() async {
|
|
|
|
data.initProvider();
|
|
|
|
data.initProvider();
|
|
|
|
|
|
|
|
if (env["chat"]) {
|
|
|
|
_bHubCon();
|
|
|
|
_bHubCon();
|
|
|
|
|
|
|
|
}
|
|
|
|
// data.getITGNotification().then((value) {
|
|
|
|
// data.getITGNotification().then((value) {
|
|
|
|
// print("--------------------detail_1-----------------");
|
|
|
|
// print("--------------------detail_1-----------------");
|
|
|
|
// print(value!.result!.data!.notificationMasterId);
|
|
|
|
// print(value!.result!.data!.notificationMasterId);
|
|
|
|
// print(value.result!.data!.notificationTitle);
|
|
|
|
// print(value.result!.data!.notificationTitle);
|
|
|
|
// });
|
|
|
|
// });
|
|
|
|
data.fetchListMenu();
|
|
|
|
data.fetchListMenu();
|
|
|
|
|
|
|
|
if (env["dashboard"]["attendance"]) {
|
|
|
|
data.fetchAttendanceTracking(context);
|
|
|
|
data.fetchAttendanceTracking(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
data.fetchWorkListCounter(context);
|
|
|
|
data.fetchWorkListCounter(context);
|
|
|
|
|
|
|
|
if (env["dashboard"]["missingSwipe"]) {
|
|
|
|
data.fetchMissingSwipe(context);
|
|
|
|
data.fetchMissingSwipe(context);
|
|
|
|
|
|
|
|
}
|
|
|
|
data.fetchLeaveTicketBalance(context, DateTime.now());
|
|
|
|
data.fetchLeaveTicketBalance(context, DateTime.now());
|
|
|
|
data.fetchMenuEntries();
|
|
|
|
data.fetchMenuEntries();
|
|
|
|
data.getCategoryOffersListAPI(context);
|
|
|
|
data.getCategoryOffersListAPI(context);
|
|
|
|
|
|
|
|
if (env["marathon"]) {
|
|
|
|
marathonProvider.getMarathonDetailsFromApi();
|
|
|
|
marathonProvider.getMarathonDetailsFromApi();
|
|
|
|
|
|
|
|
}
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
_refreshController.refreshCompleted();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@ -180,9 +192,11 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
SvgPicture.asset(
|
|
|
|
SvgPicture.asset(
|
|
|
|
"assets/images/announcements.svg",
|
|
|
|
"assets/images/announcements.svg",
|
|
|
|
matchTextDirection: true,
|
|
|
|
matchTextDirection: true,
|
|
|
|
).onPress(() async {
|
|
|
|
).onPress(
|
|
|
|
|
|
|
|
() async {
|
|
|
|
await Navigator.pushNamed(context, AppRoutes.announcements);
|
|
|
|
await Navigator.pushNamed(context, AppRoutes.announcements);
|
|
|
|
})
|
|
|
|
},
|
|
|
|
|
|
|
|
)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 48, bottom: 7),
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 48, bottom: 7),
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
@ -205,6 +219,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
16.height,
|
|
|
|
16.height,
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
|
|
|
|
if (env["dashboard"]["attendance"])
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: AspectRatio(
|
|
|
|
child: AspectRatio(
|
|
|
|
aspectRatio: 159 / 159,
|
|
|
|
aspectRatio: 159 / 159,
|
|
|
|
@ -215,10 +230,15 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
: Container(
|
|
|
|
: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
borderRadius: BorderRadius.circular(15),
|
|
|
|
gradient: const LinearGradient(transform: GradientRotation(.46), begin: Alignment.topRight, end: Alignment.bottomLeft, colors: [
|
|
|
|
gradient: const LinearGradient(
|
|
|
|
|
|
|
|
transform: GradientRotation(.46),
|
|
|
|
|
|
|
|
begin: Alignment.topRight,
|
|
|
|
|
|
|
|
end: Alignment.bottomLeft,
|
|
|
|
|
|
|
|
colors: [
|
|
|
|
MyColors.gradiantEndColor,
|
|
|
|
MyColors.gradiantEndColor,
|
|
|
|
MyColors.gradiantStartColor,
|
|
|
|
MyColors.gradiantStartColor,
|
|
|
|
]),
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: Stack(
|
|
|
|
child: Stack(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
alignment: Alignment.center,
|
|
|
|
@ -316,7 +336,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
9.width,
|
|
|
|
if (env["dashboard"]["attendance"]) 9.width,
|
|
|
|
Expanded(
|
|
|
|
Expanded(
|
|
|
|
child: MenusWidget(),
|
|
|
|
child: MenusWidget(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -324,11 +344,13 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 7),
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 7),
|
|
|
|
|
|
|
|
if (env["marathon"])
|
|
|
|
context.watch<MarathonProvider>().isLoading
|
|
|
|
context.watch<MarathonProvider>().isLoading
|
|
|
|
? const MarathonBannerShimmer().paddingAll(20)
|
|
|
|
? const MarathonBannerShimmer().paddingAll(20)
|
|
|
|
: MarathonBanner(isMarathonUpcoming: context.watch<MarathonProvider>().isUpComingMarathon).paddingAll(20),
|
|
|
|
: MarathonBanner(isMarathonUpcoming: context.watch<MarathonProvider>().isUpComingMarathon).paddingAll(20),
|
|
|
|
ServicesWidget(),
|
|
|
|
ServicesWidget(),
|
|
|
|
8.height,
|
|
|
|
8.height,
|
|
|
|
|
|
|
|
if (env["offersDiscount"])
|
|
|
|
Container(
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
width: double.infinity,
|
|
|
|
padding: const EdgeInsets.only(top: 31),
|
|
|
|
padding: const EdgeInsets.only(top: 31),
|
|
|
|
@ -444,7 +466,9 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
drawer: SafeArea(
|
|
|
|
drawer: SafeArea(
|
|
|
|
child: AppDrawer(onLanguageChange: _onRefresh),
|
|
|
|
child: AppDrawer(onLanguageChange: _onRefresh),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
bottomNavigationBar: SizedBox(
|
|
|
|
bottomNavigationBar: !env["bottomBar"]
|
|
|
|
|
|
|
|
? null
|
|
|
|
|
|
|
|
: SizedBox(
|
|
|
|
height: Platform.isAndroid ? 70 : 100,
|
|
|
|
height: Platform.isAndroid ? 70 : 100,
|
|
|
|
child: BottomNavigationBar(
|
|
|
|
child: BottomNavigationBar(
|
|
|
|
items: <BottomNavigationBarItem>[
|
|
|
|
items: <BottomNavigationBarItem>[
|
|
|
|
@ -556,14 +580,14 @@ class _DashboardScreenState extends State<DashboardScreen> {
|
|
|
|
|
|
|
|
|
|
|
|
getOffersDetailList.add(offersListModelObj);
|
|
|
|
getOffersDetailList.add(offersListModelObj);
|
|
|
|
|
|
|
|
|
|
|
|
data.getOffersList.forEach((OffersListModel element) {
|
|
|
|
for (OffersListModel element in data.getOffersList) {
|
|
|
|
if (counter <= 4) {
|
|
|
|
if (counter <= 4) {
|
|
|
|
if (element.rowID != offersListModelObj.rowID) {
|
|
|
|
if (element.rowID != offersListModelObj.rowID) {
|
|
|
|
getOffersDetailList.add(element);
|
|
|
|
getOffersDetailList.add(element);
|
|
|
|
counter++;
|
|
|
|
counter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList);
|
|
|
|
Navigator.pushNamed(context, AppRoutes.offersAndDiscountsDetails, arguments: getOffersDetailList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|