update packages, replace barcode_widget with, qr_bar_code & update for new code package

This commit is contained in:
yaso 2026-07-10 12:16:12 +02:00
parent d7e4ac134d
commit e3766c827e
12 changed files with 925 additions and 823 deletions

View file

@ -15,6 +15,8 @@ import 'package:mzansi_innovation_hub/mih_config/mih_env.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:provider/provider.dart';
import 'package:qr_bar_code/code/src/code_generate.dart';
import 'package:qr_bar_code/code/src/code_type.dart';
import 'package:screenshot/screenshot.dart';
import 'package:share_plus/share_plus.dart';
import 'package:supertokens_flutter/supertokens.dart';
@ -33,7 +35,7 @@ class MihBusinessQrCode extends StatefulWidget {
class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
late Business business;
PlatformFile? file;
late String qrCodedata;
late String _businessShare;
int qrSize = 500;
bool _isUserSignedIn = false;
ScreenshotController screenshotController = ScreenshotController();
@ -46,19 +48,6 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
});
}
String getQrCodeData(int qrSize) {
String color =
MihColors.primary().toARGB32().toRadixString(16).substring(2, 8);
// KenLogger.warning(color);
String bgColor =
MihColors.secondary().toARGB32().toRadixString(16).substring(2, 8);
// KenLogger.warning(bgColor);
String encodedData =
Uri.encodeComponent("$qrCodedata${business.business_id}");
return "https://api.qrserver.com/v1/create-qr-code/?data=$encodedData&size=${qrSize}x$qrSize&bgcolor=$bgColor&color=$color";
}
Future<void> saveImage(Uint8List imageBytes) async {
final String filename =
"${business.Name}_QR_Code_${DateTime.now().millisecondsSinceEpoch}";
@ -186,53 +175,60 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
widget.business == null
? MihCircleAvatar(
imageFile: profileprovider.businessProfilePicture,
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
)
: MihCircleAvatar(
imageFile: CachedNetworkImageProvider(
MihFileApi.getMinioFileUrlV2(business.logo_path),
Center(
child: widget.business == null
? MihCircleAvatar(
imageFile: profileprovider.businessProfilePicture,
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
)
: MihCircleAvatar(
imageFile: CachedNetworkImageProvider(
MihFileApi.getMinioFileUrlV2(business.logo_path),
),
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
),
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
),
Center(
child: FittedBox(
child: Text(
business.Name,
style: TextStyle(
fontSize: 45,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
FittedBox(
child: Text(
business.Name,
style: TextStyle(
fontSize: 35,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
),
),
FittedBox(
child: Text(
business.type,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: MihColors.primary(),
Center(
child: FittedBox(
child: Text(
business.type,
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
color: MihColors.primary(),
),
),
),
),
@ -244,7 +240,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
child: Text(
"Powered by MIH",
style: TextStyle(
fontSize: 15,
fontSize: 18,
fontWeight: FontWeight.w600,
color: MihColors.primary(),
),
@ -259,26 +255,31 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
],
),
const SizedBox(height: 10),
SizedBox(
width: 300,
height: 300,
child: CachedNetworkImage(
imageUrl: getQrCodeData(qrSize.toInt()),
placeholder: (context, url) => FittedBox(
child: const Mihloadingcircle(),
),
errorWidget: (context, url, error) =>
const Icon(Icons.error),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 35.0),
child: LayoutBuilder(builder: (context, constraints) {
final double codesize = constraints.maxWidth < qrSize
? constraints.maxWidth
: qrSize.toDouble();
return Code(
color: MihColors.primary(),
data: "$_businessShare${business.business_id}",
codeType: CodeType.qrCode(),
width: codesize,
height: codesize,
);
}),
),
const SizedBox(height: 10),
FittedBox(
child: Text(
"Scan & Connect",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
Center(
child: FittedBox(
child: Text(
"Scan & Connect",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
),
),
),
@ -312,7 +313,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
business = profileProvider.business!;
}
_checkUserSession();
qrCodedata = "${AppEnviroment.baseAppUrl}/business-profile/view/";
_businessShare = "${AppEnviroment.baseAppUrl}/business-profile/view/";
}
@override
@ -327,12 +328,14 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
}
Widget getBody(Size screenSize, BuildContext context) {
double profilePictureWidth = 150;
double profilePictureWidth =
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? 225
: 200;
return Stack(
alignment: Alignment.topCenter,
children: [
MihSingleChildScroll(
scrollbarOn: true,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Padding(
@ -342,7 +345,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
: EdgeInsets.symmetric(
horizontal: screenSize.width * 0), //.075),
child: Padding(
padding: const EdgeInsets.only(top: 10.0),
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: displayBusinessQRCode(profilePictureWidth),
),
),
@ -386,7 +389,7 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
shareMIHLink(
context,
"Check out ${business.Name} on the MIH app's Mzansi Directory",
"$qrCodedata${business.business_id}",
"$_businessShare${business.business_id}",
);
},
),
@ -404,7 +407,8 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
backgroundColor: MihColors.green(),
onTap: () async {
await Clipboard.setData(
ClipboardData(text: "$qrCodedata${business.business_id}"),
ClipboardData(
text: "$_businessShare${business.business_id}"),
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(

View file

@ -3,6 +3,7 @@ import 'package:file_picker/file_picker.dart';
import 'package:file_saver/file_saver.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
@ -16,6 +17,8 @@ import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart
import 'package:mzansi_innovation_hub/mih_services/mih_file_services.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_circle_avatar.dart';
import 'package:provider/provider.dart';
import 'package:qr_bar_code/code/src/code_generate.dart';
import 'package:qr_bar_code/code/src/code_type.dart';
import 'package:screenshot/screenshot.dart';
import 'package:share_plus/share_plus.dart';
import 'package:supertokens_flutter/supertokens.dart';
@ -38,7 +41,8 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
ScreenshotController screenshotController = ScreenshotController();
Uint8List? personalQRImageFile;
bool _isUserSignedIn = false;
final String _qrCodedata = "${AppEnviroment.baseAppUrl}/mzansi-profile/view/";
final String _userShareLink =
"${AppEnviroment.baseAppUrl}/mzansi-profile/view/";
Future<void> _checkUserSession() async {
final doesSessionExist = await SuperTokens.doesSessionExist();
@ -47,18 +51,6 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
});
}
String getQrCodeData(int qrSize) {
String color =
MihColors.primary().toARGB32().toRadixString(16).substring(2, 8);
// KenLogger.warning(color);
String bgColor =
MihColors.secondary().toARGB32().toRadixString(16).substring(2, 8);
// KenLogger.warning(bgColor);
String encodedData =
Uri.encodeComponent("$_qrCodedata${user.username.toLowerCase()}");
return "https://api.qrserver.com/v1/create-qr-code/?data=$encodedData&size=${qrSize}x$qrSize&bgcolor=$bgColor&color=$color";
}
Future<void> saveImage(Uint8List imageBytes) async {
final String filename =
"${user.username}_QR_Code_${DateTime.now().millisecondsSinceEpoch}";
@ -177,64 +169,72 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
context.read<MzansiProfileProvider>();
return Screenshot(
controller: screenshotController,
child: Material(
color: MihColors.secondary().withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(25),
elevation: 10,
shadowColor: Colors.black,
child: Container(
decoration: BoxDecoration(
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: SizedBox(
child: Material(
color: MihColors.secondary().withValues(alpha: 0.6),
borderRadius: BorderRadius.circular(25),
elevation: 10,
shadowColor: Colors.black,
child: Container(
decoration: BoxDecoration(
color: MihColors.secondary(),
borderRadius: BorderRadius.circular(20),
),
child: Padding(
padding: const EdgeInsets.symmetric(vertical: 20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
widget.user == null
? MihCircleAvatar(
imageFile: profileProvider.userProfilePicture,
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
)
: MihCircleAvatar(
imageFile: CachedNetworkImageProvider(
MihFileApi.getMinioFileUrlV2(user.pro_pic_path),
Center(
child: widget.user == null
? MihCircleAvatar(
imageFile: profileProvider.userProfilePicture,
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
)
: MihCircleAvatar(
imageFile: CachedNetworkImageProvider(
MihFileApi.getMinioFileUrlV2(user.pro_pic_path),
),
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
),
width: profilePictureWidth,
expandable: true,
editable: false,
fileNameController: TextEditingController(),
userSelectedfile: file,
frameColor: MihColors.primary(),
backgroundColor: MihColors.secondary(),
onChange: () {},
),
Center(
child: FittedBox(
child: Text(
user.username,
style: TextStyle(
fontSize: 45,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
FittedBox(
child: Text(
user.username,
style: TextStyle(
fontSize: 35,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
),
),
FittedBox(
child: Text(
"${user.fname} ${user.lname}",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: MihColors.primary(),
Center(
child: FittedBox(
child: Text(
"${user.fname} ${user.lname}",
style: TextStyle(
fontSize: 25,
fontWeight: FontWeight.w600,
color: MihColors.primary(),
),
),
),
),
@ -246,7 +246,7 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
child: Text(
"Powered by MIH",
style: TextStyle(
fontSize: 15,
fontSize: 18,
fontWeight: FontWeight.w600,
color: MihColors.primary(),
),
@ -261,31 +261,39 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
],
),
const SizedBox(height: 10),
SizedBox(
width: 300,
height: 300,
child: CachedNetworkImage(
imageUrl: getQrCodeData(qrSize.toInt()),
placeholder: (context, url) => FittedBox(
child: const Mihloadingcircle(),
),
errorWidget: (context, url, error) =>
const Icon(Icons.error),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 35.0),
child: LayoutBuilder(builder: (context, constraints) {
final double codesize = constraints.maxWidth < qrSize
? constraints.maxWidth
: qrSize.toDouble();
return Code(
color: MihColors.primary(),
data:
"$_userShareLink${profileProvider.user!.username.toLowerCase()}",
codeType: CodeType.qrCode(),
width: codesize,
height: codesize,
);
}),
),
const SizedBox(height: 10),
FittedBox(
child: Text(
"Scan & Connect",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
Center(
child: FittedBox(
child: Text(
"Scan & Connect",
style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
color: MihColors.primary(),
),
),
),
),
],
)),
),
),
),
),
),
);
@ -329,22 +337,24 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
}
Widget getBody(Size screenSize, BuildContext context) {
double profilePictureWidth = 150;
double profilePictureWidth =
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? 225
: 200;
return Stack(
alignment: Alignment.topCenter,
children: [
MihSingleChildScroll(
scrollbarOn: true,
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: screenSize.width * 0.2)
: EdgeInsets.symmetric(
horizontal: screenSize.width * 0), //.075),
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: screenSize.width * 0.2)
: EdgeInsets.symmetric(
horizontal: screenSize.width * 0), //.075),
child: MihSingleChildScroll(
child: Padding(
padding: const EdgeInsets.only(top: 10.0),
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: displayPersonalQRCode(profilePictureWidth),
),
),
@ -388,7 +398,7 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
shareMIHLink(
context,
"Check out ${user.username} on the MIH app's Mzansi Directory",
"$_qrCodedata${user.username.toLowerCase()}",
"$_userShareLink${user.username.toLowerCase()}",
);
},
),
@ -407,7 +417,8 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
onTap: () async {
await Clipboard.setData(
ClipboardData(
text: "$_qrCodedata${user.username.toLowerCase()}"),
text:
"$_userShareLink${user.username.toLowerCase()}"),
);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(

View file

@ -1,21 +1,19 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display_slanted.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display_window.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_edit_window.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
import 'package:flutter/material.dart';
import 'package:barcode_widget/barcode_widget.dart';
import 'package:provider/provider.dart';
import 'package:screen_brightness/screen_brightness.dart';
@ -38,556 +36,18 @@ class BuildLoyaltyCardList extends StatefulWidget {
}
class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
final TextEditingController _nicknameController = TextEditingController();
final TextEditingController _cardNumberController = TextEditingController();
late int _noFavourites;
double? _originalBrightness;
final _formKey = GlobalKey<FormState>();
void openscanner() async {
context.pushNamed(
"barcodeScanner",
extra: _cardNumberController,
);
}
void editCardWindow(
MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider,
BuildContext ctxt,
int index,
double width) {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => MihPackageWindow(
fullscreen: false,
windowTitle: "Edit Loyalty Card",
onWindowTapClose: () {
_cardNumberController.clear();
_nicknameController.clear();
Navigator.pop(context);
},
windowBody: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: width * 0.05)
: EdgeInsets.symmetric(horizontal: width * 0),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
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: MihColors.secondary(),
inputColor: MihColors.primary(),
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: MihColors.secondary(),
width: 100,
child: Text(
"Scan",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(height: 15),
Center(
child: MihButton(
onPressed: () async {
if (_formKey.currentState!.validate()) {
walletProvider.updateLocalLoyaltyCard(
mzansiProfileProvider,
MIHLoyaltyCard(
idloyalty_cards:
widget.cardList[index].idloyalty_cards,
app_id: widget.cardList[index].app_id,
shop_name: widget.cardList[index].shop_name,
card_number: _cardNumberController.text,
favourite: widget.cardList[index].favourite,
priority_index:
widget.cardList[index].priority_index,
nickname: _nicknameController.text,
),
);
context.pop();
context.pop();
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully updated the loyalty card details.",
context,
);
} else {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
],
),
),
),
);
}
void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
MihAlertServices().deleteConfirmationAlert(
"This Card will be deleted permanently from your Mzansi Wallet. Are you certain you want to delete it?",
() async {
walletProvider.deleteLocalLoyaltyCard(
mzansiProfileProvider,
widget.cardList[index],
);
context.pop();
context.pop();
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully deleted the loyalty card from your Mzansi Wallet.",
context,
);
},
context,
);
}
void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
MihAlertServices().warningAdvancedAlert(
// "Card Added to Favourites",
"Add Card to Favourites?",
"Would you like to add this card to your favourites for quick access?",
// "You have successfully added the loyalty card to your favourites.",
[
MihButton(
onPressed: () async {
context.pop();
},
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Cancel",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () async {
await walletProvider.updateLocalLoyaltyCard(
mzansiProfileProvider,
MIHLoyaltyCard(
idloyalty_cards: widget.cardList[index].idloyalty_cards,
app_id: widget.cardList[index].app_id,
shop_name: widget.cardList[index].shop_name,
card_number: widget.cardList[index].card_number,
favourite: "Yes",
priority_index: _noFavourites,
nickname: widget.cardList[index].nickname,
),
);
context.pop();
context.pop();
context.read<MzansiWalletProvider>().setToolIndex(1);
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully added the loyalty card to your favourites.",
context,
);
},
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
context,
);
}
void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
MihAlertServices().warningAdvancedAlert(
"Remove From Favourites?",
"Are you sure you want to remove this card from your favourites?",
[
MihButton(
onPressed: () async {
await walletProvider.updateLocalLoyaltyCard(
mzansiProfileProvider,
MIHLoyaltyCard(
idloyalty_cards: widget.cardList[index].idloyalty_cards,
app_id: widget.cardList[index].app_id,
shop_name: widget.cardList[index].shop_name,
card_number: widget.cardList[index].card_number,
favourite: "",
priority_index: 0,
nickname: widget.cardList[index].nickname,
),
);
context.pop();
context.pop();
context.read<MzansiWalletProvider>().setToolIndex(0);
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully removed the loyalty card to your favourites.",
context,
);
},
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Remove",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () async {
context.pop();
},
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Cancel",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
ctxt,
);
}
Color getCardColor(String shopName) {
switch (shopName.toLowerCase()) {
case "apple tree":
return const Color(0xFFffffff);
case "best before":
return const Color(0xFF000000);
case "checkers":
return const Color(0xFF00a6a3);
case "clicks":
return const Color(0xFF005baa);
case "cotton:on":
return const Color(0xFFffffff);
case "dis-chem":
return const Color(0xFF00a950);
case "pick n pay":
return const Color(0xFFffffff);
case "shoprite":
return const Color(0xFFc12514);
case "spar":
return const Color(0xFFffffff);
case "woolworths":
return const Color(0xFF000000);
case "makro":
return const Color(0xFFffffff);
case "fresh stop":
return const Color(0xFF50b849);
case "panarottis":
return const Color(0xFF3c3c3b);
case "shell":
return const Color(0xFF1d232a);
case "edgars":
return const Color(0xFFffffff);
case "jet":
return const Color(0xFFffffff);
case "spur":
return const Color(0xFF0a0157);
case "infinity":
return const Color(0xFFffffff);
case "eskom":
return const Color(0xFF003897);
case "+more":
return const Color(0xFFffffff);
case "bp":
return const Color(0xFF9dc600);
case "builders warehouse":
return const Color(0xFFffcb26);
case "exclusive books":
return const Color(0xFF2abdc5);
case "pna":
return const Color(0xFFcf3339);
case "pq clothing":
return const Color(0xFFed2223);
case "rage":
return const Color(0xFFffffff);
case "sasol":
return const Color(0xFFffffff);
case "tfg group":
return const Color(0xFF622775);
case "toys r us":
return const Color(0xFF0962ad);
case "leroy merlin":
return const Color(0xFFffffff);
case "signature cosmetics & fragrances":
return const Color(0xFFec028b);
case "ok foods":
return const Color(0xFFffffff);
case "choppies":
return const Color(0xFFffffff);
case "boxer":
return const Color(0xFFffffff);
case "carrefour":
return const Color(0xFFffffff);
case "sefalana":
return const Color(0xFFffffff);
case "big save":
return const Color(0xFF333333);
case "justrite":
return const Color(0xFF50b849);
case "naivas":
return const Color(0xFFf26535);
case "kero":
return const Color(0xFF004986);
case "auchan":
return const Color(0xFFffffff);
case "woermann brock":
return const Color(0xFFe31e2d);
case "continente":
return const Color(0xFFffffff);
case "fresmart":
return const Color(0xFF72ba2e);
case "total energies":
return const Color(0xFFffffff);
case "engen":
return const Color(0xFF002b8f);
default:
return const Color(0xFFffffff);
}
}
void viewCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, int index, double width) {
//print(widget.cardList[index].card_number);
String formattedCardNumber = "";
for (int i = 0; i <= widget.cardList[index].card_number.length - 1; i++) {
formattedCardNumber += widget.cardList[index].card_number[i];
if ((i + 1) % 4 == 0) {
formattedCardNumber += "\t";
}
}
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => MihPackageWindow(
backgroundColor: getCardColor(widget.cardList[index].shop_name),
fullscreen: false,
windowTitle: null,
menuOptions: [
SpeedDialChild(
child: widget.cardList[index].favourite == ""
? Icon(
Icons.favorite,
color: MihColors.primary(),
)
: Icon(
Icons.favorite_border,
color: MihColors.primary(),
),
label: widget.cardList[index].favourite == ""
? "Add to Favourite"
: "Remove from Favourite",
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.green(),
onTap: () {
if (widget.cardList[index].favourite == "") {
addToFavCardWindow(
mzansiProfileProvider,
walletProvider,
context,
index,
);
} else {
removeFromFavCardWindow(
mzansiProfileProvider,
walletProvider,
context,
index,
);
}
},
),
SpeedDialChild(
child: Icon(
Icons.edit,
color: MihColors.primary(),
),
label: "Edit Card Details",
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.green(),
onTap: () {
setState(() {
_cardNumberController.text = widget.cardList[index].card_number;
_nicknameController.text = widget.cardList[index].nickname;
});
editCardWindow(
mzansiProfileProvider,
walletProvider,
context,
index,
width,
);
},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MihColors.primary(),
),
label: "Delete Card",
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.green(),
onTap: () {
deleteCardWindow(
mzansiProfileProvider,
walletProvider,
context,
index,
);
},
),
],
onWindowTapClose: () {
resetScreenBrightness();
context.pop();
},
windowBody: Column(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 15,
),
SizedBox(
width: 500,
child: MihCardDisplay(
shopName: widget.cardList[index].shop_name,
nickname: widget.cardList[index].nickname,
),
),
const SizedBox(height: 20),
Container(
width: 500,
//color: Colors.white,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: Column(
children: [
// const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.all(10.0),
child: SizedBox(
height: 150,
// width: 300,
child: BarcodeWidget(
//color: MihColors.secondary(),
barcode: Barcode.code128(),
backgroundColor: Colors.white,
data: widget.cardList[index].card_number,
drawText: false,
),
// SfBarcodeGenerator(
// backgroundColor: Colors.white,
// barColor: Colors.black,
// value: widget.cardList[index].card_number,
// symbology: Code128(),
// //showValue: true,
// ),
),
),
// const SizedBox(height: 10),
Text(
formattedCardNumber,
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.black,
fontSize: 25,
fontWeight: FontWeight.bold
//MihColors.secondary(),
),
),
],
),
),
SizedBox(height: 10),
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS)) MihBannerAd()
// MihBannerAd(),
],
),
builder: (context) => MihCardDisplayWindow(
displayCard: widget.cardList[index],
listIndex: index,
noFavourites: _noFavourites,
),
);
}
@ -657,22 +117,6 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
} else {
KenLogger.warning(
"Screen brightness adjustment is not supported on Web.");
// _originalBrightness = 1.0; // Default brightness for web
// await ScreenBrightness.instance.setSystemScreenBrightness(1.0);
// KenLogger.success("Brightness set to default value: 1.0");
}
}
void resetScreenBrightness() async {
if (!kIsWeb) {
KenLogger.success(
"Resetting screen brightness to original value: $_originalBrightness");
if (_originalBrightness != null) {
await ScreenBrightness.instance
.setSystemScreenBrightness(_originalBrightness!);
}
} else {
KenLogger.warning("Screen brightness reset is not supported on Web.");
}
}
@ -687,8 +131,6 @@ class _BuildLoyaltyCardListState extends State<BuildLoyaltyCardList> {
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.sizeOf(context);
// final double width = size.width;
//final double height = size.height;
if (widget.cardList.isNotEmpty) {
return Consumer2<MzansiProfileProvider, MzansiWalletProvider>(
builder: (BuildContext context,

View file

@ -0,0 +1,469 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_speed_dial/flutter_speed_dial.dart';
import 'package:go_router/go_router.dart';
import 'package:ken_logger/ken_logger.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
import 'package:mzansi_innovation_hub/mih_package_components/mih_banner_ad.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_display.dart';
import 'package:mzansi_innovation_hub/mih_packages/mzansi_wallet/components/mih_card_edit_window.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_alert_services.dart';
import 'package:provider/provider.dart';
import 'package:qr_bar_code/code/src/code_generate.dart';
import 'package:qr_bar_code/code/src/code_type.dart';
import 'package:screen_brightness/screen_brightness.dart';
class MihCardDisplayWindow extends StatefulWidget {
final MIHLoyaltyCard displayCard;
final int listIndex;
final int noFavourites;
const MihCardDisplayWindow({
super.key,
required this.displayCard,
required this.listIndex,
required this.noFavourites,
});
@override
State<MihCardDisplayWindow> createState() => _MihCardDisplayWindowState();
}
class _MihCardDisplayWindowState extends State<MihCardDisplayWindow> {
double? _originalBrightness;
void resetScreenBrightness() async {
if (!kIsWeb) {
KenLogger.success(
"Resetting screen brightness to original value: $_originalBrightness");
if (_originalBrightness != null) {
await ScreenBrightness.instance
.setSystemScreenBrightness(_originalBrightness!);
}
} else {
KenLogger.warning("Screen brightness reset is not supported on Web.");
}
}
String getFormattedCardNumber() {
String formattedCardNumber = "";
for (int i = 0; i <= widget.displayCard.card_number.length - 1; i++) {
formattedCardNumber += widget.displayCard.card_number[i];
if ((i + 1) % 4 == 0) {
formattedCardNumber += "\t";
}
}
return formattedCardNumber;
}
void deleteCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
MihAlertServices().deleteConfirmationAlert(
"This Card will be deleted permanently from your Mzansi Wallet. Are you certain you want to delete it?",
() async {
walletProvider.deleteLocalLoyaltyCard(
mzansiProfileProvider,
widget.displayCard,
);
context.pop();
context.pop();
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully deleted the loyalty card from your Mzansi Wallet.",
context,
);
},
context,
);
}
void addToFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
MihAlertServices().warningAdvancedAlert(
// "Card Added to Favourites",
"Add Card to Favourites?",
"Would you like to add this card to your favourites for quick access?",
// "You have successfully added the loyalty card to your favourites.",
[
MihButton(
onPressed: () async {
context.pop();
},
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Cancel",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () async {
await walletProvider.updateLocalLoyaltyCard(
mzansiProfileProvider,
MIHLoyaltyCard(
idloyalty_cards: widget.displayCard.idloyalty_cards,
app_id: widget.displayCard.app_id,
shop_name: widget.displayCard.shop_name,
card_number: widget.displayCard.card_number,
favourite: "Yes",
priority_index: widget.noFavourites,
nickname: widget.displayCard.nickname,
),
);
context.pop();
context.pop();
context.read<MzansiWalletProvider>().setToolIndex(1);
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully added the loyalty card to your favourites.",
context,
);
},
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Add",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
context,
);
}
void removeFromFavCardWindow(MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider, BuildContext ctxt, int index) {
MihAlertServices().warningAdvancedAlert(
"Remove From Favourites?",
"Are you sure you want to remove this card from your favourites?",
[
MihButton(
onPressed: () async {
await walletProvider.updateLocalLoyaltyCard(
mzansiProfileProvider,
MIHLoyaltyCard(
idloyalty_cards: widget.displayCard.idloyalty_cards,
app_id: widget.displayCard.app_id,
shop_name: widget.displayCard.shop_name,
card_number: widget.displayCard.card_number,
favourite: "",
priority_index: 0,
nickname: widget.displayCard.nickname,
),
);
context.pop();
context.pop();
context.read<MzansiWalletProvider>().setToolIndex(0);
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully removed the loyalty card to your favourites.",
context,
);
},
buttonColor: MihColors.red(),
width: 300,
child: Text(
"Remove",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
MihButton(
onPressed: () async {
context.pop();
},
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Cancel",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
ctxt,
);
}
void editCardWindow(
int index,
) {
showDialog(
context: context,
barrierDismissible: false,
builder: (context) => MihCardEditWindow(
editCard: widget.displayCard,
listIndex: widget.listIndex,
),
);
}
@override
Widget build(BuildContext context) {
return Consumer2<MzansiProfileProvider, MzansiWalletProvider>(
builder: (
BuildContext context,
MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider,
Widget? child,
) {
return MihPackageWindow(
backgroundColor: getCardColor(widget.displayCard.shop_name),
fullscreen: false,
windowTitle: null,
menuOptions: [
SpeedDialChild(
child: widget.displayCard.favourite == ""
? Icon(
Icons.favorite,
color: MihColors.primary(),
)
: Icon(
Icons.favorite_border,
color: MihColors.primary(),
),
label: widget.displayCard.favourite == ""
? "Add to Favourite"
: "Remove from Favourite",
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.green(),
onTap: () {
if (widget.displayCard.favourite == "") {
addToFavCardWindow(
mzansiProfileProvider,
walletProvider,
context,
widget.listIndex,
);
} else {
removeFromFavCardWindow(
mzansiProfileProvider,
walletProvider,
context,
widget.listIndex,
);
}
},
),
SpeedDialChild(
child: Icon(
Icons.edit,
color: MihColors.primary(),
),
label: "Edit Card Details",
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.green(),
onTap: () {
editCardWindow(
widget.listIndex,
);
},
),
SpeedDialChild(
child: Icon(
Icons.delete,
color: MihColors.primary(),
),
label: "Delete Card",
labelBackgroundColor: MihColors.green(),
labelStyle: TextStyle(
color: MihColors.primary(),
fontWeight: FontWeight.bold,
),
backgroundColor: MihColors.green(),
onTap: () {
deleteCardWindow(
mzansiProfileProvider,
walletProvider,
context,
widget.listIndex,
);
},
),
],
onWindowTapClose: () {
resetScreenBrightness();
context.pop();
},
windowBody: Column(
mainAxisSize: MainAxisSize.max,
children: [
SizedBox(
height: 15,
),
SizedBox(
width: 500,
child: MihCardDisplay(
shopName: widget.displayCard.shop_name,
nickname: widget.displayCard.nickname,
),
),
const SizedBox(height: 20),
Container(
// width: 500,
//color: Colors.white,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Colors.white,
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: [
Code(
data: widget.displayCard.card_number,
codeType: CodeType.code128(),
drawText: false,
height: 250,
),
const SizedBox(height: 10),
Text(
getFormattedCardNumber(),
textAlign: TextAlign.center,
style: const TextStyle(
color: Colors.black,
fontSize: 25,
fontWeight: FontWeight.bold
//MihColors.secondary(),
),
),
],
),
),
),
SizedBox(height: 10),
if (!kIsWeb && (Platform.isAndroid || Platform.isIOS))
MihBannerAd()
// MihBannerAd(),
],
),
);
},
);
}
Color getCardColor(String shopName) {
switch (shopName.toLowerCase()) {
case "apple tree":
return const Color(0xFFffffff);
case "best before":
return const Color(0xFF000000);
case "checkers":
return const Color(0xFF00a6a3);
case "clicks":
return const Color(0xFF005baa);
case "cotton:on":
return const Color(0xFFffffff);
case "dis-chem":
return const Color(0xFF00a950);
case "pick n pay":
return const Color(0xFFffffff);
case "shoprite":
return const Color(0xFFc12514);
case "spar":
return const Color(0xFFffffff);
case "woolworths":
return const Color(0xFF000000);
case "makro":
return const Color(0xFFffffff);
case "fresh stop":
return const Color(0xFF50b849);
case "panarottis":
return const Color(0xFF3c3c3b);
case "shell":
return const Color(0xFF1d232a);
case "edgars":
return const Color(0xFFffffff);
case "jet":
return const Color(0xFFffffff);
case "spur":
return const Color(0xFF0a0157);
case "infinity":
return const Color(0xFFffffff);
case "eskom":
return const Color(0xFF003897);
case "+more":
return const Color(0xFFffffff);
case "bp":
return const Color(0xFF9dc600);
case "builders warehouse":
return const Color(0xFFffcb26);
case "exclusive books":
return const Color(0xFF2abdc5);
case "pna":
return const Color(0xFFcf3339);
case "pq clothing":
return const Color(0xFFed2223);
case "rage":
return const Color(0xFFffffff);
case "sasol":
return const Color(0xFFffffff);
case "tfg group":
return const Color(0xFF622775);
case "toys r us":
return const Color(0xFF0962ad);
case "leroy merlin":
return const Color(0xFFffffff);
case "signature cosmetics & fragrances":
return const Color(0xFFec028b);
case "ok foods":
return const Color(0xFFffffff);
case "choppies":
return const Color(0xFFffffff);
case "boxer":
return const Color(0xFFffffff);
case "carrefour":
return const Color(0xFFffffff);
case "sefalana":
return const Color(0xFFffffff);
case "big save":
return const Color(0xFF333333);
case "justrite":
return const Color(0xFF50b849);
case "naivas":
return const Color(0xFFf26535);
case "kero":
return const Color(0xFF004986);
case "auchan":
return const Color(0xFFffffff);
case "woermann brock":
return const Color(0xFFe31e2d);
case "continente":
return const Color(0xFFffffff);
case "fresmart":
return const Color(0xFF72ba2e);
case "total energies":
return const Color(0xFFffffff);
case "engen":
return const Color(0xFF002b8f);
default:
return const Color(0xFFffffff);
}
}
}

View file

@ -0,0 +1,169 @@
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:mih_package_toolkit/mih_package_toolkit.dart';
import 'package:mzansi_innovation_hub/main.dart';
import 'package:mzansi_innovation_hub/mih_objects/loyalty_card.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_profile_provider.dart';
import 'package:mzansi_innovation_hub/mih_providers/mzansi_wallet_provider.dart';
import 'package:mzansi_innovation_hub/mih_services/mih_validation_services.dart';
import 'package:provider/provider.dart';
import '../../../mih_services/mih_alert_services.dart';
class MihCardEditWindow extends StatefulWidget {
final MIHLoyaltyCard editCard;
final int listIndex;
const MihCardEditWindow({
super.key,
required this.editCard,
required this.listIndex,
});
@override
State<MihCardEditWindow> createState() => _MihCardEditWindowState();
}
class _MihCardEditWindowState extends State<MihCardEditWindow> {
final TextEditingController _nicknameController = TextEditingController();
final TextEditingController _cardNumberController = TextEditingController();
final _formKey = GlobalKey<FormState>();
void openscanner() async {
context.pushNamed(
"barcodeScanner",
extra: _cardNumberController,
);
}
@override
void initState() {
super.initState();
_nicknameController.text = widget.editCard.nickname;
_cardNumberController.text = widget.editCard.card_number;
}
@override
Widget build(BuildContext context) {
final Size size = MediaQuery.sizeOf(context);
return Consumer2<MzansiProfileProvider, MzansiWalletProvider>(
builder: (
BuildContext context,
MzansiProfileProvider mzansiProfileProvider,
MzansiWalletProvider walletProvider,
Widget? child,
) {
return MihPackageWindow(
fullscreen: false,
windowTitle: "Edit Loyalty Card",
onWindowTapClose: () {
_cardNumberController.clear();
_nicknameController.clear();
Navigator.pop(context);
},
windowBody: Padding(
padding:
MzansiInnovationHub.of(context)!.theme.screenType == "desktop"
? EdgeInsets.symmetric(horizontal: size.width * 0.05)
: EdgeInsets.symmetric(horizontal: size.width * 0),
child: Column(
children: [
MihForm(
formKey: _formKey,
formFields: [
MihTextFormField(
fillColor: MihColors.secondary(),
inputColor: MihColors.primary(),
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: MihColors.secondary(),
inputColor: MihColors.primary(),
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: MihColors.secondary(),
width: 100,
child: Text(
"Scan",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
],
),
const SizedBox(height: 15),
Center(
child: MihButton(
onPressed: () async {
if (_formKey.currentState!.validate()) {
walletProvider.updateLocalLoyaltyCard(
mzansiProfileProvider,
MIHLoyaltyCard(
idloyalty_cards:
widget.editCard.idloyalty_cards,
app_id: widget.editCard.app_id,
shop_name: widget.editCard.shop_name,
card_number: _cardNumberController.text,
favourite: widget.editCard.favourite,
priority_index: widget.editCard.priority_index,
nickname: _nicknameController.text,
),
);
context.pop();
context.pop();
MihAlertServices().successBasicAlert(
"Success!",
"You have successfully updated the loyalty card details.",
context,
);
} else {
MihAlertServices().inputErrorAlert(context);
}
},
buttonColor: MihColors.green(),
width: 300,
child: Text(
"Update",
style: TextStyle(
color: MihColors.primary(),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
),
),
],
),
],
),
),
);
},
);
}
}

View file

@ -9,6 +9,7 @@
#include <file_saver/file_saver_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <printing/printing_plugin.h>
#include <qr_bar_code/qr_bar_code_plugin.h>
#include <record_linux/record_linux_plugin.h>
#include <syncfusion_pdfviewer_linux/syncfusion_pdfviewer_linux_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
@ -23,6 +24,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) printing_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PrintingPlugin");
printing_plugin_register_with_registrar(printing_registrar);
g_autoptr(FlPluginRegistrar) qr_bar_code_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "QrBarCodePlugin");
qr_bar_code_plugin_register_with_registrar(qr_bar_code_registrar);
g_autoptr(FlPluginRegistrar) record_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "RecordLinuxPlugin");
record_linux_plugin_register_with_registrar(record_linux_registrar);

View file

@ -6,6 +6,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
file_saver
file_selector_linux
printing
qr_bar_code
record_linux
syncfusion_pdfviewer_linux
url_launcher_linux

View file

@ -20,6 +20,7 @@ import local_auth_darwin
import mobile_scanner
import package_info_plus
import printing
import qr_bar_code
import record_macos
import screen_brightness_macos
import share_plus
@ -45,6 +46,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
MobileScannerPlugin.register(with: registry.registrar(forPlugin: "MobileScannerPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PrintingPlugin.register(with: registry.registrar(forPlugin: "PrintingPlugin"))
QrBarCodePlugin.register(with: registry.registrar(forPlugin: "QrBarCodePlugin"))
RecordMacOsPlugin.register(with: registry.registrar(forPlugin: "RecordMacOsPlugin"))
ScreenBrightnessMacosPlugin.register(with: registry.registrar(forPlugin: "ScreenBrightnessMacosPlugin"))
SharePlusMacosPlugin.register(with: registry.registrar(forPlugin: "SharePlusMacosPlugin"))

View file

@ -73,14 +73,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.9"
barcode_widget:
dependency: "direct main"
description:
name: barcode_widget
sha256: "6f2c5b08659b1a5f4d88d183e6007133ea2f96e50e7b8bb628f03266c3931427"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
bazel_worker:
dependency: transitive
description:
@ -109,34 +101,34 @@ packages:
dependency: transitive
description:
name: build
sha256: a156715e7cd728130c592f30552575908aae5b100005fbc1f0fb16b3c03a3d10
sha256: "45d14a0fb23e018d8287c32fc98d726ce466b231928ed9b9200f29bd3ccd39ae"
url: "https://pub.dev"
source: hosted
version: "4.0.6"
version: "4.0.7"
build_config:
dependency: transitive
description:
name: build_config
sha256: "4070d2a59f8eec34c97c86ceb44403834899075f66e8a9d59706f8e7834f6f71"
sha256: f2c223156a26eea323e6244b85141d76413a80aeee9fe0b380773789fabaf8ae
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "1.3.1"
build_daemon:
dependency: transitive
description:
name: build_daemon
sha256: bf05f6e12cfea92d3c09308d7bcdab1906cd8a179b023269eed00c071004b957
sha256: fd754058c342243718d5171a95f352cfc9fcf0cba8cfa26df67cb13a5836db78
url: "https://pub.dev"
source: hosted
version: "4.1.1"
version: "4.1.2"
build_runner:
dependency: "direct dev"
description:
name: build_runner
sha256: "1523ce62448ebac2c15a8ba5fbad8acac169788658a7dd2a1c2d9c2a9318b9a6"
sha256: "5367e521935b102bdf1e735d2aab461e36b2edca6517662d088dd04cc39f8d16"
url: "https://pub.dev"
source: hosted
version: "2.15.0"
version: "2.15.1"
build_web_compilers:
dependency: "direct dev"
description:
@ -213,10 +205,10 @@ packages:
dependency: transitive
description:
name: camera_platform_interface
sha256: "7ac852d77699acee79f0d438b793feee26721841e50973576419ff5c6d95e9b7"
sha256: "4524ca6eb4176b066864036ad4fe02c3e4863e63b77eadc21a5bf56824f43498"
url: "https://pub.dev"
source: hosted
version: "2.13.0"
version: "2.13.1"
camera_web:
dependency: transitive
description:
@ -301,10 +293,10 @@ packages:
dependency: "direct main"
description:
name: cross_file
sha256: d687bec93342bf6a764a116d15c8694ebeff10e633dc28a39dd3144f7195024e
sha256: "92c9c43c383bfa1c32079d3bc492d55d6d4318044b7b47edaff8971cbb555c51"
url: "https://pub.dev"
source: hosted
version: "0.3.5+3"
version: "0.3.5+4"
crypto:
dependency: transitive
description:
@ -405,10 +397,10 @@ packages:
dependency: transitive
description:
name: equatable
sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b"
sha256: "3bce007a596ff8b3119c45d68aaef631272537c03d30e5d4534dd24bf4c5eaa2"
url: "https://pub.dev"
source: hosted
version: "2.0.8"
version: "2.1.0"
fake_async:
dependency: transitive
description:
@ -613,10 +605,10 @@ packages:
dependency: "direct main"
description:
name: fl_downloader
sha256: "7e28207e959c5d327b3776b7320f88cb475224946e40bcc335a0f7414f7cc563"
sha256: "5f268a9cd8dea6304a2eebf4b7a3460c7b3471fc902a5fbca8fdbd88e463a034"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.2.0"
flutter:
dependency: "direct main"
description: flutter
@ -690,10 +682,10 @@ packages:
dependency: "direct main"
description:
name: flutter_markdown_plus
sha256: "039177906850278e8fb1cd364115ee0a46281135932fa8ecea8455522166d2de"
sha256: "2e4b667a75c08e5710866ae010da392acf5af475f9ad0be9bf406525e9751b0c"
url: "https://pub.dev"
source: hosted
version: "1.0.7"
version: "1.0.11"
flutter_native_splash:
dependency: "direct main"
description:
@ -956,10 +948,10 @@ packages:
dependency: transitive
description:
name: idb_shim
sha256: a3b70c0c49c90dfbb3ffcaf6a1e376a83d542dc59124e6f29b1e84487c481c30
sha256: "3448298f244bc76a14aca71461eeab6add2b8a877930521c42c2e8b71b644590"
url: "https://pub.dev"
source: hosted
version: "2.9.6"
version: "2.9.6+2"
image:
dependency: transitive
description:
@ -1124,10 +1116,10 @@ packages:
dependency: transitive
description:
name: local_auth
sha256: ae6f382f638108c6becd134318d7c3f0a93875383a54010f61d7c97ac05d5137
sha256: ecf24edf2283c509ecd217e3595f6f71034b68888d28ad1dae6bfa0857b816ac
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
local_auth_android:
dependency: transitive
description:
@ -1180,10 +1172,10 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
sha256: "31bd099b47c10cd1aeb55146a2d46ce0277630ecef3f7dae54ad7873f36696cd"
url: "https://pub.dev"
source: hosted
version: "0.12.19"
version: "0.12.20"
material_color_utilities:
dependency: transitive
description:
@ -1212,10 +1204,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
sha256: "307249ce4ff29d58a18e97f6345f539382eb9c9c29ecda628900f31de0443dd9"
url: "https://pub.dev"
source: hosted
version: "1.18.0"
version: "1.19.0"
mih_package_toolkit:
dependency: "direct main"
description:
@ -1276,10 +1268,10 @@ packages:
dependency: "direct main"
description:
name: ollama_dart
sha256: ec1ed4d10ca53ca5014b50db2c189fe88634e3ba4203b328cb436562f884fe17
sha256: "8636167784e4a24ca3d943213e891bae671379a122e6deff7d953c9f9a91894e"
url: "https://pub.dev"
source: hosted
version: "2.3.0"
version: "2.4.0"
os_detect:
dependency: transitive
description:
@ -1480,6 +1472,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.2"
qr_bar_code:
dependency: "direct main"
description:
name: qr_bar_code
sha256: "835eec43524767fd2f21e08d58effc05075dfdc230ef9aa80a313fe38867c68c"
url: "https://pub.dev"
source: hosted
version: "4.0.0"
quick_actions:
dependency: "direct main"
description:
@ -1516,50 +1516,50 @@ packages:
dependency: transitive
description:
name: record
sha256: "10911465138fafacef459a780564e883e01bd48eabf87ab20543684884492870"
sha256: "82539d1372e23cf51375fdfcba084f39912bcbf9a953b75d56596691f8f11c0f"
url: "https://pub.dev"
source: hosted
version: "6.2.1"
version: "7.1.1"
record_android:
dependency: transitive
description:
name: record_android
sha256: eb1732e42d0d2a1895b8db86e4fc917287e6d8491b6ed59918aea8bed6c69de4
sha256: "28f1108626a190e249b01ffa9f639070e31e5157474b64a5ae380bf36aec9559"
url: "https://pub.dev"
source: hosted
version: "1.5.2"
version: "2.1.2"
record_ios:
dependency: transitive
description:
name: record_ios
sha256: c051fb48edd7a0e265daafb9108730dc827c27b551728a3fdfb3ef69efd89c73
sha256: "21d189f49a598af4697dac4cc9e48389ac0a1fb3e916622b5504a58d9b96313e"
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "2.1.1"
record_linux:
dependency: transitive
description:
name: record_linux
sha256: "31181787bf7eccb0e298835836b69b3cd0a903863b75d70e937de3dec71cd8f3"
sha256: b7484fdaf1f6d291543b9cf615e78096662b02df68d7a4728b13f352bde58d27
url: "https://pub.dev"
source: hosted
version: "1.3.1"
version: "2.1.1"
record_macos:
dependency: transitive
description:
name: record_macos
sha256: cfe1b61435e27db418bf513dc36820d10c9f7eb1843786c2c9a52e07e2f4f627
sha256: ced7495abf3d683e8a7dbe8fc96df8ea5722837a26f922b7cb7c5de11661bb46
url: "https://pub.dev"
source: hosted
version: "1.2.2"
version: "2.1.1"
record_platform_interface:
dependency: transitive
description:
name: record_platform_interface
sha256: "8e56cbe06c6984137fb86132ff03459f29938d927496d9b2d0962e2d6345d488"
sha256: d94b37cadb8fe203e64b0e9893271c0b71b34f2550ee7fb0c6105d650e00c1f5
url: "https://pub.dev"
source: hosted
version: "1.6.0"
version: "2.1.0"
record_use:
dependency: transitive
description:
@ -1572,18 +1572,18 @@ packages:
dependency: transitive
description:
name: record_web
sha256: "7e9846981c1f2d111d86f0ae3309071f5bba8b624d1c977316706f08fc31d16d"
sha256: "7d75ed681b5bf40c3a9b51b6c105fe53705f752284d859d5f030ab5a2bfd49cf"
url: "https://pub.dev"
source: hosted
version: "1.3.0"
version: "2.1.1"
record_windows:
dependency: transitive
description:
name: record_windows
sha256: "223258060a1d25c62bae18282c16783f28581ec19401d17e56b5205b9f039d78"
sha256: "9cedfacee553a02b48977a5e1d74bf08a36cc5647eba56fb83e57da20552f443"
url: "https://pub.dev"
source: hosted
version: "1.0.7"
version: "2.2.2"
redacted:
dependency: "direct main"
description:
@ -1905,74 +1905,74 @@ packages:
dependency: "direct main"
description:
name: syncfusion_flutter_core
sha256: f054f5636c618dbf1a155409d0b5f3e70f8e9beb7ac7a8fdc870653968875e7d
sha256: "91fdcf04d055c1f37d3fb7c1f7a9dded507de1d14b1a9580efb63c94a68d9f95"
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_flutter_pdf:
dependency: transitive
description:
name: syncfusion_flutter_pdf
sha256: "63ebe5bb3261e83c586a9105c12ae55d8b70863c7f7bb867048f081b9bf46d6e"
sha256: f2f8fda5acdd07c548792a506ca2a0cfb75a765507f9d608fcbb0b7c3ed98c36
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_flutter_pdfviewer:
dependency: "direct main"
description:
name: syncfusion_flutter_pdfviewer
sha256: ac0c2bfe233ab1253746de72a46d32c69b1f13267e245989e13dc55970fbb50a
sha256: f19f71590ace902d054b0788088236aae57957bcfce182ee0275edbae712e676
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_flutter_signaturepad:
dependency: transitive
description:
name: syncfusion_flutter_signaturepad
sha256: f127af6fcb7de2dae74a0856f005747d27869fb176c8b92346136fe2254d73dc
sha256: "46d50d8e2c5fa0e9ad32b926ca4f18092c9f6d7c23d7fafb0e858c94f93c4bfa"
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_pdfviewer_linux:
dependency: transitive
description:
name: syncfusion_pdfviewer_linux
sha256: "8f24e911178b126f9ed65158880ebb1478519e351f45b2a6da87ea1d4e66c8b8"
sha256: f78743d7c3b3ac97e074cc7c420dbc04984b18113be02ba2d9965649d1c1b10d
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_pdfviewer_macos:
dependency: transitive
description:
name: syncfusion_pdfviewer_macos
sha256: ca72847813956eb01a0f580827fdb7784eeff1bbbb2565d4253bf32325c911da
sha256: "82c6e8a6705e64ee4b0992d13757aa2aa27b244f27464c8df6867a24766bc64c"
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_pdfviewer_platform_interface:
dependency: transitive
description:
name: syncfusion_pdfviewer_platform_interface
sha256: f4dc6151e9f5a8ca1a385773ada3f23e1a5f96ece867045620f7e7600653717b
sha256: "793381fb302939979f5f3d932d41d2fd24c992ddfa9cc5676edfc7680da1172d"
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_pdfviewer_web:
dependency: transitive
description:
name: syncfusion_pdfviewer_web
sha256: b3a455f0806bee6de2d0d6a13b12bb2d3fa598111b36927a5c8dcbb2a6f316ef
sha256: c2b2f975747ed94f4ce93bc420ff4b8f9540a322fde96a538fd1a296e0834a6e
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
syncfusion_pdfviewer_windows:
dependency: transitive
description:
name: syncfusion_pdfviewer_windows
sha256: "983ae0f6b3a0682692a4050f82a52fb61187454cdd3322e67494db16731bc74d"
sha256: "5185837cfe46a8d54d27654e4d749dc360c6e13ba7f2ff22cf256607f05d1656"
url: "https://pub.dev"
source: hosted
version: "33.2.15"
version: "34.1.30"
synchronized:
dependency: transitive
description:
@ -2001,10 +2001,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
sha256: "475610b2aa23c19687cce2961e44b0cc57cafe220f67c2b80201231b2a07fbe7"
url: "https://pub.dev"
source: hosted
version: "0.7.11"
version: "0.7.13"
typed_data:
dependency: transitive
description:
@ -2137,10 +2137,10 @@ packages:
dependency: transitive
description:
name: vector_math
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
sha256: "1d774bbdf6b72a0b12122fc1560c9c2d2a67db5a4a4cc2bd8a5c990ab20e3188"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.4.0"
version:
dependency: transitive
description:
@ -2177,10 +2177,10 @@ packages:
dependency: transitive
description:
name: waveform_recorder
sha256: "1ca0a19b143d1bdef2adfb3d28f0627c18aee5285235c8cf81a89bf29a0420e1"
sha256: "78d22372bd988cfc883515ee15dd9a946a82e5b56d3193920f6080b6dc83ef8a"
url: "https://pub.dev"
source: hosted
version: "1.8.0"
version: "1.8.1"
web:
dependency: "direct main"
description:
@ -2209,10 +2209,10 @@ packages:
dependency: transitive
description:
name: webview_flutter
sha256: e4d3474277c5043f5f3100ed27d94ad693abfd5c602b0221c719a4497e4ba1e4
sha256: d53e1ccf5516f25017e3c9d44c39034db352d20fa34fe200674270242c2c5111
url: "https://pub.dev"
source: hosted
version: "4.14.0"
version: "4.14.1"
webview_flutter_android:
dependency: transitive
description:

View file

@ -13,12 +13,11 @@ dependencies:
mih_package_toolkit: ^0.1.0
cupertino_icons: ^1.0.8
font_awesome_flutter: ^11.0.0
syncfusion_flutter_core: ^33.2.15
syncfusion_flutter_pdfviewer: ^33.2.15
# universal_html: ^2.2.4
syncfusion_flutter_core: ^34.1.30
syncfusion_flutter_pdfviewer: ^34.1.30
web: ^1.1.1
file_picker: ^12.0.0-beta.7
supertokens_flutter: ^0.6.3
supertokens_flutter: ^0.6.5
http: ^1.2.1
intl: ^0.20.2
flutter_native_splash: ^2.4.6
@ -26,9 +25,9 @@ dependencies:
geolocator: ^14.0.1
geolocator_linux: ^0.2.4
table_calendar: ^3.1.2
mobile_scanner: ^7.0.1
mobile_scanner: ^7.2.0
flutter_launcher_icons: ^0.14.4
barcode_widget: ^2.0.4 #Generate Barcodes
qr_bar_code: ^4.0.0
url_launcher: ^6.3.1
fl_downloader: ^2.0.2
math_expressions: ^3.1.0
@ -59,9 +58,6 @@ dependencies:
hive_ce:
hive_ce_flutter:
dependency_overrides:
supertokens_flutter: any
dev_dependencies:
flutter_test:
sdk: flutter

View file

@ -16,6 +16,7 @@
#include <geolocator_windows/geolocator_windows.h>
#include <local_auth_windows/local_auth_plugin.h>
#include <printing/printing_plugin.h>
#include <qr_bar_code/qr_bar_code_plugin_c_api.h>
#include <record_windows/record_windows_plugin_c_api.h>
#include <screen_brightness_windows/screen_brightness_windows_plugin_c_api.h>
#include <share_plus/share_plus_windows_plugin_c_api.h>
@ -43,6 +44,8 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("LocalAuthPlugin"));
PrintingPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PrintingPlugin"));
QrBarCodePluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("QrBarCodePluginCApi"));
RecordWindowsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("RecordWindowsPluginCApi"));
ScreenBrightnessWindowsPluginCApiRegisterWithRegistrar(

View file

@ -13,6 +13,7 @@ list(APPEND FLUTTER_PLUGIN_LIST
geolocator_windows
local_auth_windows
printing
qr_bar_code
record_windows
screen_brightness_windows
share_plus