create loyalty card mih object
This commit is contained in:
31
Frontend/lib/mih_objects/loyalty_card.dart
Normal file
31
Frontend/lib/mih_objects/loyalty_card.dart
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
class MIHNotification {
|
||||||
|
final int idloyalty_cards;
|
||||||
|
final String app_id;
|
||||||
|
final String shop_name;
|
||||||
|
final String card_number;
|
||||||
|
|
||||||
|
const MIHNotification({
|
||||||
|
required this.idloyalty_cards,
|
||||||
|
required this.app_id,
|
||||||
|
required this.shop_name,
|
||||||
|
required this.card_number,
|
||||||
|
});
|
||||||
|
|
||||||
|
factory MIHNotification.fromJson(Map<String, dynamic> json) {
|
||||||
|
return switch (json) {
|
||||||
|
{
|
||||||
|
"idloyalty_cards": int idloyalty_cards,
|
||||||
|
"app_id": String app_id,
|
||||||
|
"shop_name": String shop_name,
|
||||||
|
"notification_read": String card_number,
|
||||||
|
} =>
|
||||||
|
MIHNotification(
|
||||||
|
idloyalty_cards: idloyalty_cards,
|
||||||
|
app_id: app_id,
|
||||||
|
shop_name: shop_name,
|
||||||
|
card_number: card_number,
|
||||||
|
),
|
||||||
|
_ => throw const FormatException('Failed to load loyalty card.'),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
48
Frontend/lib/mih_packages/mzansi_wallet/loyalty_cards.dart
Normal file
48
Frontend/lib/mih_packages/mzansi_wallet/loyalty_cards.dart
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import 'package:Mzansi_Innovation_Hub/main.dart';
|
||||||
|
import 'package:Mzansi_Innovation_Hub/mih_objects/app_user.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class LoyaltyCards extends StatefulWidget {
|
||||||
|
final AppUser signedInUser;
|
||||||
|
const LoyaltyCards({
|
||||||
|
super.key,
|
||||||
|
required this.signedInUser,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<LoyaltyCards> createState() => _LoyaltyCardsState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _LoyaltyCardsState extends State<LoyaltyCards> {
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Column(
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
"Loyalty Cards",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 25,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.add_card),
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
color: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
onPressed: () {
|
||||||
|
//
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Divider(color: MzanziInnovationHub.of(context)!.theme.secondaryColor()),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user