fix wallet padding
This commit is contained in:
@@ -43,7 +43,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void editCardWindow(BuildContext ctxt, int index) {
|
void editCardWindow(BuildContext ctxt, int index, double width) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -55,56 +55,95 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
_nicknameController.clear();
|
_nicknameController.clear();
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
windowBody: Column(
|
windowBody: Padding(
|
||||||
children: [
|
padding:
|
||||||
MihForm(
|
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||||
formKey: _formKey,
|
? EdgeInsets.symmetric(horizontal: width * 0.05)
|
||||||
formFields: [
|
: EdgeInsets.symmetric(horizontal: width * 0),
|
||||||
MihTextFormField(
|
child: Column(
|
||||||
fillColor:
|
children: [
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
MihForm(
|
||||||
inputColor:
|
formKey: _formKey,
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
formFields: [
|
||||||
controller: _nicknameController,
|
MihTextFormField(
|
||||||
multiLineInput: false,
|
fillColor:
|
||||||
requiredText: false,
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
hintText: "Card Title",
|
inputColor:
|
||||||
),
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
const SizedBox(height: 10),
|
controller: _nicknameController,
|
||||||
Row(
|
multiLineInput: false,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
requiredText: false,
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
hintText: "Card Title",
|
||||||
mainAxisSize: MainAxisSize.max,
|
),
|
||||||
children: [
|
const SizedBox(height: 10),
|
||||||
Flexible(
|
Row(
|
||||||
child: MihTextFormField(
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
fillColor: MzanziInnovationHub.of(context)!
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: MihTextFormField(
|
||||||
|
fillColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
controller: _cardNumberController,
|
||||||
|
multiLineInput: false,
|
||||||
|
requiredText: true,
|
||||||
|
hintText: "Card Number",
|
||||||
|
numberMode: true,
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
MihButton(
|
||||||
|
onPressed: () {
|
||||||
|
openscanner();
|
||||||
|
},
|
||||||
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
inputColor: MzanziInnovationHub.of(context)!
|
width: 100,
|
||||||
.theme
|
child: Text(
|
||||||
.primaryColor(),
|
"Scan",
|
||||||
controller: _cardNumberController,
|
style: TextStyle(
|
||||||
multiLineInput: false,
|
color: MzanziInnovationHub.of(context)!
|
||||||
requiredText: true,
|
.theme
|
||||||
hintText: "Card Number",
|
.primaryColor(),
|
||||||
numberMode: true,
|
fontSize: 20,
|
||||||
validator: (value) {
|
fontWeight: FontWeight.bold,
|
||||||
return MihValidationServices().isEmpty(value);
|
),
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(width: 20),
|
),
|
||||||
MihButton(
|
const SizedBox(height: 15),
|
||||||
|
Center(
|
||||||
|
child: MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
openscanner();
|
if (_formKey.currentState!.validate()) {
|
||||||
|
MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
||||||
|
widget.signedInUser,
|
||||||
|
widget.cardList[index].idloyalty_cards,
|
||||||
|
widget.cardList[index].favourite,
|
||||||
|
widget.cardList[index].priority_index,
|
||||||
|
_nicknameController.text,
|
||||||
|
_cardNumberController.text,
|
||||||
|
0,
|
||||||
|
ctxt,
|
||||||
|
);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
width: 100,
|
width: 300,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Scan",
|
"Update",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!
|
color: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
@@ -114,40 +153,11 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
MIHMzansiWalletApis.updateLoyaltyCardAPICall(
|
|
||||||
widget.signedInUser,
|
|
||||||
widget.cardList[index].idloyalty_cards,
|
|
||||||
widget.cardList[index].favourite,
|
|
||||||
widget.cardList[index].priority_index,
|
|
||||||
_nicknameController.text,
|
|
||||||
_cardNumberController.text,
|
|
||||||
0,
|
|
||||||
ctxt,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Update",
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -290,7 +300,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void viewCardWindow(int index) {
|
void viewCardWindow(int index, double width) {
|
||||||
//print(widget.cardList[index].card_number);
|
//print(widget.cardList[index].card_number);
|
||||||
String formattedCardNumber = "";
|
String formattedCardNumber = "";
|
||||||
for (int i = 0; i <= widget.cardList[index].card_number.length - 1; i++) {
|
for (int i = 0; i <= widget.cardList[index].card_number.length - 1; i++) {
|
||||||
@@ -356,7 +366,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
_cardNumberController.text = widget.cardList[index].card_number;
|
_cardNumberController.text = widget.cardList[index].card_number;
|
||||||
_nicknameController.text = widget.cardList[index].nickname;
|
_nicknameController.text = widget.cardList[index].nickname;
|
||||||
});
|
});
|
||||||
editCardWindow(context, index);
|
editCardWindow(context, index, width);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
SpeedDialChild(
|
SpeedDialChild(
|
||||||
@@ -500,7 +510,7 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
|
|||||||
height: 100,
|
height: 100,
|
||||||
),
|
),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
viewCardWindow(index);
|
viewCardWindow(index, size.width);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void addCardWindow(BuildContext ctxt) {
|
void addCardWindow(BuildContext ctxt, double width) {
|
||||||
showDialog(
|
showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -97,127 +97,178 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
shopName.value = "";
|
shopName.value = "";
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
windowBody: Column(
|
windowBody: Padding(
|
||||||
children: [
|
padding:
|
||||||
MihForm(
|
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
|
||||||
formKey: _formKey,
|
? EdgeInsets.symmetric(horizontal: width * 0.05)
|
||||||
formFields: [
|
: EdgeInsets.symmetric(horizontal: width * 0),
|
||||||
MIHDropdownField(
|
child: Column(
|
||||||
controller: shopController,
|
children: [
|
||||||
hintText: "Shop Name",
|
MihForm(
|
||||||
dropdownOptions: const [
|
formKey: _formKey,
|
||||||
"+More",
|
formFields: [
|
||||||
"Apple Tree",
|
MIHDropdownField(
|
||||||
"Auchan",
|
controller: shopController,
|
||||||
"Best Before",
|
hintText: "Shop Name",
|
||||||
"Big Save",
|
dropdownOptions: const [
|
||||||
"Boxer",
|
"+More",
|
||||||
"BP",
|
"Apple Tree",
|
||||||
"Builders Warehouse",
|
"Auchan",
|
||||||
"Checkers",
|
"Best Before",
|
||||||
"Choppies",
|
"Big Save",
|
||||||
"Clicks",
|
"Boxer",
|
||||||
"Continente",
|
"BP",
|
||||||
"Cotton:On",
|
"Builders Warehouse",
|
||||||
"Carrefour",
|
"Checkers",
|
||||||
"Dis-Chem",
|
"Choppies",
|
||||||
"Edgars",
|
"Clicks",
|
||||||
"Eskom",
|
"Continente",
|
||||||
"Exclusive Books",
|
"Cotton:On",
|
||||||
"Fresh Stop",
|
"Carrefour",
|
||||||
"Fresmart",
|
"Dis-Chem",
|
||||||
"Infinity",
|
"Edgars",
|
||||||
"Jet",
|
"Eskom",
|
||||||
"Justrite",
|
"Exclusive Books",
|
||||||
"Kero",
|
"Fresh Stop",
|
||||||
"Leroy Merlin",
|
"Fresmart",
|
||||||
"Makro",
|
"Infinity",
|
||||||
"Naivas",
|
"Jet",
|
||||||
"OK Foods",
|
"Justrite",
|
||||||
"Panarottis",
|
"Kero",
|
||||||
"Pick n Pay",
|
"Leroy Merlin",
|
||||||
"PnA",
|
"Makro",
|
||||||
"PQ Clothing",
|
"Naivas",
|
||||||
"Rage",
|
"OK Foods",
|
||||||
"Sefalana",
|
"Panarottis",
|
||||||
"Sasol",
|
"Pick n Pay",
|
||||||
"Shell",
|
"PnA",
|
||||||
"Shoprite",
|
"PQ Clothing",
|
||||||
"Signature Cosmetics & Fragrances",
|
"Rage",
|
||||||
"Spar",
|
"Sefalana",
|
||||||
"Spur",
|
"Sasol",
|
||||||
"TFG Group",
|
"Shell",
|
||||||
"Toys R Us",
|
"Shoprite",
|
||||||
"Woermann Brock",
|
"Signature Cosmetics & Fragrances",
|
||||||
"Woolworths"
|
"Spar",
|
||||||
],
|
"Spur",
|
||||||
required: true,
|
"TFG Group",
|
||||||
editable: true,
|
"Toys R Us",
|
||||||
enableSearch: false,
|
"Woermann Brock",
|
||||||
),
|
"Woolworths"
|
||||||
ValueListenableBuilder(
|
],
|
||||||
valueListenable: shopName,
|
required: true,
|
||||||
builder: (BuildContext context, String value, Widget? child) {
|
editable: true,
|
||||||
return Visibility(
|
enableSearch: false,
|
||||||
visible: value != "",
|
),
|
||||||
child: Column(
|
ValueListenableBuilder(
|
||||||
children: [
|
valueListenable: shopName,
|
||||||
const SizedBox(height: 10),
|
builder:
|
||||||
MihCardDisplay(
|
(BuildContext context, String value, Widget? child) {
|
||||||
shopName: shopName.value,
|
return Visibility(
|
||||||
nickname: "",
|
visible: value != "",
|
||||||
height: 200),
|
child: Column(
|
||||||
],
|
children: [
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihCardDisplay(
|
||||||
|
shopName: shopName.value,
|
||||||
|
nickname: "",
|
||||||
|
height: 200),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
MihTextFormField(
|
||||||
|
fillColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||||
|
inputColor:
|
||||||
|
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||||
|
controller: _nicknameController,
|
||||||
|
multiLineInput: false,
|
||||||
|
requiredText: false,
|
||||||
|
hintText: "Card Title",
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: MihTextFormField(
|
||||||
|
fillColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.secondaryColor(),
|
||||||
|
inputColor: MzanziInnovationHub.of(context)!
|
||||||
|
.theme
|
||||||
|
.primaryColor(),
|
||||||
|
controller: cardNumberController,
|
||||||
|
multiLineInput: false,
|
||||||
|
requiredText: true,
|
||||||
|
hintText: "Card Number",
|
||||||
|
numberMode: true,
|
||||||
|
validator: (value) {
|
||||||
|
return MihValidationServices().isEmpty(value);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
const SizedBox(width: 20),
|
||||||
},
|
MihButton(
|
||||||
),
|
onPressed: () {
|
||||||
const SizedBox(height: 10),
|
openscanner();
|
||||||
MihTextFormField(
|
},
|
||||||
fillColor:
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
inputColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
controller: _nicknameController,
|
|
||||||
multiLineInput: false,
|
|
||||||
requiredText: false,
|
|
||||||
hintText: "Card Title",
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
child: MihTextFormField(
|
|
||||||
fillColor: MzanziInnovationHub.of(context)!
|
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
inputColor: MzanziInnovationHub.of(context)!
|
width: 100,
|
||||||
.theme
|
child: Text(
|
||||||
.primaryColor(),
|
"Scan",
|
||||||
controller: cardNumberController,
|
style: TextStyle(
|
||||||
multiLineInput: false,
|
color: MzanziInnovationHub.of(context)!
|
||||||
requiredText: true,
|
.theme
|
||||||
hintText: "Card Number",
|
.primaryColor(),
|
||||||
numberMode: true,
|
fontSize: 20,
|
||||||
validator: (value) {
|
fontWeight: FontWeight.bold,
|
||||||
return MihValidationServices().isEmpty(value);
|
),
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
const SizedBox(width: 20),
|
),
|
||||||
MihButton(
|
const SizedBox(height: 15),
|
||||||
|
Center(
|
||||||
|
child: MihButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
openscanner();
|
if (_formKey.currentState!.validate()) {
|
||||||
|
if (shopController.text == "") {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
return const MIHErrorMessage(
|
||||||
|
errorType: "Input Error");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
MIHMzansiWalletApis.addLoyaltyCardAPICall(
|
||||||
|
widget.signedInUser,
|
||||||
|
widget.signedInUser.app_id,
|
||||||
|
shopController.text,
|
||||||
|
cardNumberController.text,
|
||||||
|
"",
|
||||||
|
0,
|
||||||
|
_nicknameController.text,
|
||||||
|
0,
|
||||||
|
context,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
buttonColor: MzanziInnovationHub.of(context)!
|
buttonColor: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
.secondaryColor(),
|
.secondaryColor(),
|
||||||
width: 100,
|
width: 300,
|
||||||
child: Text(
|
child: Text(
|
||||||
"Scan",
|
"Add",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: MzanziInnovationHub.of(context)!
|
color: MzanziInnovationHub.of(context)!
|
||||||
.theme
|
.theme
|
||||||
@@ -227,51 +278,11 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
|
||||||
),
|
|
||||||
const SizedBox(height: 15),
|
|
||||||
MihButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (_formKey.currentState!.validate()) {
|
|
||||||
if (shopController.text == "") {
|
|
||||||
showDialog(
|
|
||||||
context: context,
|
|
||||||
builder: (context) {
|
|
||||||
return const MIHErrorMessage(
|
|
||||||
errorType: "Input Error");
|
|
||||||
},
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
MIHMzansiWalletApis.addLoyaltyCardAPICall(
|
|
||||||
widget.signedInUser,
|
|
||||||
widget.signedInUser.app_id,
|
|
||||||
shopController.text,
|
|
||||||
cardNumberController.text,
|
|
||||||
"",
|
|
||||||
0,
|
|
||||||
_nicknameController.text,
|
|
||||||
0,
|
|
||||||
context,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
buttonColor:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
|
||||||
width: 300,
|
|
||||||
child: Text(
|
|
||||||
"Add",
|
|
||||||
style: TextStyle(
|
|
||||||
color:
|
|
||||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
|
||||||
fontSize: 20,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -388,7 +399,7 @@ class _MihCardsState extends State<MihCards> {
|
|||||||
backgroundColor:
|
backgroundColor:
|
||||||
MzanziInnovationHub.of(context)!.theme.successColor(),
|
MzanziInnovationHub.of(context)!.theme.successColor(),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
addCardWindow(context);
|
addCardWindow(context, width);
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
|
|||||||
Reference in New Issue
Block a user