fix wallet padding

This commit is contained in:
2025-06-06 12:35:11 +02:00
parent 2cd074f230
commit b6183f2a5d
2 changed files with 256 additions and 235 deletions

View File

@@ -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,7 +55,12 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
_nicknameController.clear(); _nicknameController.clear();
Navigator.pop(context); Navigator.pop(context);
}, },
windowBody: Column( windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: EdgeInsets.symmetric(horizontal: width * 0),
child: Column(
children: [ children: [
MihForm( MihForm(
formKey: _formKey, formKey: _formKey,
@@ -117,7 +122,8 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
], ],
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
MihButton( Center(
child: MihButton(
onPressed: () { onPressed: () {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
MIHMzansiWalletApis.updateLoyaltyCardAPICall( MIHMzansiWalletApis.updateLoyaltyCardAPICall(
@@ -132,24 +138,28 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
); );
} }
}, },
buttonColor: buttonColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.secondaryColor(), .theme
.secondaryColor(),
width: 300, width: 300,
child: Text( child: Text(
"Update", "Update",
style: TextStyle( style: TextStyle(
color: color: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.primaryColor(), .theme
.primaryColor(),
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, 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);
}, },
); );
}, },

View File

@@ -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,7 +97,12 @@ class _MihCardsState extends State<MihCards> {
shopName.value = ""; shopName.value = "";
Navigator.pop(context); Navigator.pop(context);
}, },
windowBody: Column( windowBody: Padding(
padding:
MzanziInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: EdgeInsets.symmetric(horizontal: width * 0),
child: Column(
children: [ children: [
MihForm( MihForm(
formKey: _formKey, formKey: _formKey,
@@ -157,7 +162,8 @@ class _MihCardsState extends State<MihCards> {
), ),
ValueListenableBuilder( ValueListenableBuilder(
valueListenable: shopName, valueListenable: shopName,
builder: (BuildContext context, String value, Widget? child) { builder:
(BuildContext context, String value, Widget? child) {
return Visibility( return Visibility(
visible: value != "", visible: value != "",
child: Column( child: Column(
@@ -230,7 +236,8 @@ class _MihCardsState extends State<MihCards> {
], ],
), ),
const SizedBox(height: 15), const SizedBox(height: 15),
MihButton( Center(
child: MihButton(
onPressed: () { onPressed: () {
if (_formKey.currentState!.validate()) { if (_formKey.currentState!.validate()) {
if (shopController.text == "") { if (shopController.text == "") {
@@ -256,24 +263,28 @@ class _MihCardsState extends State<MihCards> {
} }
} }
}, },
buttonColor: buttonColor: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.secondaryColor(), .theme
.secondaryColor(),
width: 300, width: 300,
child: Text( child: Text(
"Add", "Add",
style: TextStyle( style: TextStyle(
color: color: MzanziInnovationHub.of(context)!
MzanziInnovationHub.of(context)!.theme.primaryColor(), .theme
.primaryColor(),
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.bold, 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);
}, },
) )
]), ]),