Merge pull request #17 from yaso-meth/loyalty-card-layout

Loyalty-card-layout
This commit is contained in:
yaso-meth
2024-11-30 22:15:38 +02:00
committed by GitHub
6 changed files with 61 additions and 21 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 166 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 147 KiB

View File

@@ -103,36 +103,54 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final Size size = MediaQuery.sizeOf(context);
final double width = size.width;
//final double height = size.height;
if (widget.cardList.isNotEmpty) { if (widget.cardList.isNotEmpty) {
return ListView.separated( return GridView.builder(
//physics: const NeverScrollableScrollPhysics(),
shrinkWrap: true, shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(), padding: EdgeInsets.only(
separatorBuilder: (BuildContext context, int index) { left: width / 10,
return Divider( right: width / 10,
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(), //bottom: height / 5,
); //top: 20,
}, ),
// physics: ,
// shrinkWrap: true,
itemCount: widget.cardList.length, itemCount: widget.cardList.length,
gridDelegate: const SliverGridDelegateWithMaxCrossAxisExtent(
mainAxisSpacing: 15, maxCrossAxisExtent: 200),
itemBuilder: (context, index) { itemBuilder: (context, index) {
return ListTile( return GestureDetector(
title: MihCardDisplay( child: MihCardDisplay(
shopName: widget.cardList[index].shop_name, height: 200), shopName: widget.cardList[index].shop_name, height: 100),
// subtitle: Text(
// "Card Number: ${widget.cardList[index].card_number}",
// style: TextStyle(
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// ),
// ),
// trailing: Icon(
// Icons.arrow_forward,
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// ),
onTap: () { onTap: () {
viewCardWindow(index); viewCardWindow(index);
}, },
); );
}, },
); );
// return ListView.separated(
// shrinkWrap: true,
// physics: const NeverScrollableScrollPhysics(),
// separatorBuilder: (BuildContext context, int index) {
// return Divider(
// color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
// );
// },
// itemCount: widget.cardList.length,
// itemBuilder: (context, index) {
// return ListTile(
// title: MihCardDisplay(
// shopName: widget.cardList[index].shop_name, height: 200),
// onTap: () {
// viewCardWindow(index);
// },
// );
// },
// );
} else { } else {
return const Padding( return const Padding(
padding: EdgeInsets.only(top: 25.0), padding: EdgeInsets.only(top: 25.0),

View File

@@ -32,7 +32,7 @@ class _MihCardDisplayState extends State<MihCardDisplay> {
children: [ children: [
SizedBox( SizedBox(
height: widget.height, height: widget.height,
child: Image.asset('images/loyalty_cards/xtraSavings.png'), child: Image.asset('images/loyalty_cards/checkers_xtra.png'),
), ),
], ],
); );
@@ -46,6 +46,16 @@ class _MihCardDisplayState extends State<MihCardDisplay> {
), ),
], ],
); );
case "cotton:on":
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: widget.height,
child: Image.asset('images/loyalty_cards/cotton_on_perks.png'),
),
],
);
case "dis-chem": case "dis-chem":
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@@ -66,6 +76,16 @@ class _MihCardDisplayState extends State<MihCardDisplay> {
), ),
], ],
); );
case "shoprite":
return Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
height: widget.height,
child: Image.asset('images/loyalty_cards/shoprite_xtra.png'),
),
],
);
case "spar": case "spar":
return Row( return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,

View File

@@ -105,8 +105,10 @@ class _LoyaltyCardsState extends State<LoyaltyCards> {
"Best Before", "Best Before",
"Checkers", "Checkers",
"Clicks", "Clicks",
"Cotton:On",
"Dis-Chem", "Dis-Chem",
"Pick n Pay", "Pick n Pay",
"Shoprite",
"Spar", "Spar",
"Woolworths" "Woolworths"
], ],