|
|
|
@ -9,6 +9,7 @@ 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';
|
|
|
|
import 'package:mohem_flutter_app/extensions/widget_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/models/offers_and_discounts/get_categories_list.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/offers_and_discounts/get_categories_list.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart';
|
|
|
|
import 'package:mohem_flutter_app/models/offers_and_discounts/get_offers_list.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
import 'package:mohem_flutter_app/widgets/app_bar_widget.dart';
|
|
|
|
@ -37,20 +38,15 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
return Scaffold(
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
backgroundColor: Colors.white,
|
|
|
|
appBar: AppBarWidget(
|
|
|
|
appBar: AppBarWidget(context, title: LocaleKeys.offerAndDiscounts.tr(), showHomeButton: true),
|
|
|
|
context,
|
|
|
|
|
|
|
|
// title: LocaleKeys.mowadhafhiRequest.tr(),
|
|
|
|
|
|
|
|
title: "Offers & Discounts",
|
|
|
|
|
|
|
|
showHomeButton: true,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
body: SingleChildScrollView(
|
|
|
|
child: Column(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
mainAxisSize: MainAxisSize.min,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
DynamicTextFieldWidget(
|
|
|
|
DynamicTextFieldWidget(
|
|
|
|
"Search",
|
|
|
|
LocaleKeys.search.tr(),
|
|
|
|
"Search Items",
|
|
|
|
LocaleKeys.searchItems.tr(),
|
|
|
|
isEnable: true,
|
|
|
|
isEnable: true,
|
|
|
|
suffixIconData: Icons.search,
|
|
|
|
suffixIconData: Icons.search,
|
|
|
|
isPopup: false,
|
|
|
|
isPopup: false,
|
|
|
|
@ -60,17 +56,16 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
|
|
|
|
onChange: (String value) {
|
|
|
|
onChange: (String value) {
|
|
|
|
// _runFilter(value);
|
|
|
|
// _runFilter(value);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 21, bottom: 18),
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 21),
|
|
|
|
Row(
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
"Browse Categories".toText17(),
|
|
|
|
LocaleKeys.browseCategories.tr().toText17(),
|
|
|
|
IconButton(
|
|
|
|
const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0).onPress(() {
|
|
|
|
icon: const Icon(Icons.filter_alt_sharp, color: MyColors.darkIconColor, size: 28.0),
|
|
|
|
Navigator.pop(context);
|
|
|
|
onPressed: () => Navigator.pop(context),
|
|
|
|
}),
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingOnly(left: 21, right: 21),
|
|
|
|
).paddingOnly(left: 21, right: 21, top: 21),
|
|
|
|
SizedBox(
|
|
|
|
SizedBox(
|
|
|
|
height: 110.0,
|
|
|
|
height: 110.0,
|
|
|
|
child: getCategoriesList.isNotEmpty
|
|
|
|
child: getCategoriesList.isNotEmpty
|
|
|
|
@ -120,7 +115,7 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
|
|
|
|
currentCategoryID == getCategoriesList[index].id ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(),
|
|
|
|
currentCategoryID == getCategoriesList[index].id ? const Icon(Icons.check_circle_rounded, color: MyColors.greenColor, size: 16.0) : Container(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).expanded,
|
|
|
|
).expanded,
|
|
|
|
AppState().isArabic(context) ? getCategoriesList[index].categoryNameAr!.toText10(maxLine: 1) : getCategoriesList[index].categoryNameEn!.toText10(maxLine: 1)
|
|
|
|
AppState().isArabic(context) ? getCategoriesList[index].categoryNameAr!.toText10(maxlines: 1) : getCategoriesList[index].categoryNameEn!.toText10(maxlines: 1)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
|
|
|
|
).paddingOnly(left: 10, right: 10, bottom: 10, top: 12),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -195,7 +190,9 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
10.height,
|
|
|
|
10.height,
|
|
|
|
AppState().isArabic(context) ? getOffersList.titleAR!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1) : getOffersList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
|
|
|
|
AppState().isArabic(context)
|
|
|
|
|
|
|
|
? getOffersList.titleAR!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1)
|
|
|
|
|
|
|
|
: getOffersList.title!.toText16(isBold: true, color: const Color(0xff2B353E), maxlines: 1),
|
|
|
|
// Html(
|
|
|
|
// Html(
|
|
|
|
// data: AppState().isArabic(context) ? getOffersList.descriptionAR! : getOffersList.description ?? "",
|
|
|
|
// data: AppState().isArabic(context) ? getOffersList.descriptionAR! : getOffersList.description ?? "",
|
|
|
|
// // onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, _) {
|
|
|
|
// // onLinkTap: (String? url, RenderContext context, Map<String, String> attributes, _) {
|
|
|
|
@ -224,8 +221,8 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
|
|
|
|
getOffersDetailList.add(offersListModelObj);
|
|
|
|
getOffersDetailList.add(offersListModelObj);
|
|
|
|
|
|
|
|
|
|
|
|
getOffersList.forEach((element) {
|
|
|
|
getOffersList.forEach((element) {
|
|
|
|
if(counter <= 4) {
|
|
|
|
if (counter <= 4) {
|
|
|
|
if(element.rowID != offersListModelObj.rowID) {
|
|
|
|
if (element.rowID != offersListModelObj.rowID) {
|
|
|
|
getOffersDetailList.add(element);
|
|
|
|
getOffersDetailList.add(element);
|
|
|
|
counter++;
|
|
|
|
counter++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
@ -238,9 +235,9 @@ class _OffersAndDiscountsHomeState extends State<OffersAndDiscountsHome> {
|
|
|
|
Widget checkDate(String endDate) {
|
|
|
|
Widget checkDate(String endDate) {
|
|
|
|
DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate);
|
|
|
|
DateTime endDateObj = DateFormat("yyyy-MM-dd").parse(endDate);
|
|
|
|
if (endDateObj.isAfter(DateTime.now())) {
|
|
|
|
if (endDateObj.isAfter(DateTime.now())) {
|
|
|
|
return "Offer Valid".toText14(isBold: true, color: MyColors.greenColor);
|
|
|
|
return LocaleKeys.offerValid.tr().toText14(isBold: true, color: MyColors.greenColor);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
return "Offer Expired".toText14(isBold: true, color: MyColors.redColor);
|
|
|
|
return LocaleKeys.offerExpired.tr().toText14(isBold: true, color: MyColors.redColor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|