fix Mzansi profiles QR code in offline mode
This commit is contained in:
parent
d722251d50
commit
003c8b7c0d
3 changed files with 101 additions and 73 deletions
|
|
@ -175,6 +175,8 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||
}
|
||||
|
||||
Widget displayBusinessQRCode(double profilePictureWidth) {
|
||||
MzansiProfileProvider profileprovider =
|
||||
context.read<MzansiProfileProvider>();
|
||||
return Screenshot(
|
||||
controller: screenshotController,
|
||||
child: Material(
|
||||
|
|
@ -193,42 +195,54 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
|||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: futureImageUrl,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.done &&
|
||||
asyncSnapshot.hasData) {
|
||||
if (asyncSnapshot.requireData != "" ||
|
||||
asyncSnapshot.requireData.isNotEmpty) {
|
||||
return MihCircleAvatar(
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
expandable: true,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.primary(),
|
||||
backgroundColor: MihColors.secondary(),
|
||||
onChange: () {},
|
||||
);
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihIDontKnow,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihRing,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
widget.business == null
|
||||
? MihCircleAvatar(
|
||||
imageFile: profileprovider.businessProfilePicture,
|
||||
width: profilePictureWidth,
|
||||
expandable: true,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.primary(),
|
||||
backgroundColor: MihColors.secondary(),
|
||||
onChange: () {},
|
||||
)
|
||||
: FutureBuilder(
|
||||
future: futureImageUrl,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.done &&
|
||||
asyncSnapshot.hasData) {
|
||||
if (asyncSnapshot.requireData != "" ||
|
||||
asyncSnapshot.requireData.isNotEmpty) {
|
||||
return MihCircleAvatar(
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
expandable: true,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.primary(),
|
||||
backgroundColor: MihColors.secondary(),
|
||||
onChange: () {},
|
||||
);
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihIDontKnow,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihRing,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
FittedBox(
|
||||
child: Text(
|
||||
business.Name,
|
||||
|
|
|
|||
|
|
@ -231,7 +231,7 @@ class _MihBusinessReviewsState extends State<MihBusinessReviews> {
|
|||
);
|
||||
}
|
||||
} else {
|
||||
return Center(child: Text('Error'));
|
||||
return Center(child: Text('Error: MIH in Offline Mode'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -174,6 +174,8 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
|
|||
}
|
||||
|
||||
Widget displayPersonalQRCode(double profilePictureWidth) {
|
||||
MzansiProfileProvider profileProvider =
|
||||
context.read<MzansiProfileProvider>();
|
||||
return Screenshot(
|
||||
controller: screenshotController,
|
||||
child: Material(
|
||||
|
|
@ -192,42 +194,54 @@ class _MihPersonalQrCodeState extends State<MihPersonalQrCode> {
|
|||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
FutureBuilder(
|
||||
future: futureImageUrl,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.done &&
|
||||
asyncSnapshot.hasData) {
|
||||
if (asyncSnapshot.requireData != "" ||
|
||||
asyncSnapshot.requireData.isNotEmpty) {
|
||||
return MihCircleAvatar(
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
expandable: true,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.primary(),
|
||||
backgroundColor: MihColors.secondary(),
|
||||
onChange: () {},
|
||||
);
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihIDontKnow,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihRing,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
widget.user == null
|
||||
? MihCircleAvatar(
|
||||
imageFile: profileProvider.userProfilePicture,
|
||||
width: profilePictureWidth,
|
||||
expandable: true,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.primary(),
|
||||
backgroundColor: MihColors.secondary(),
|
||||
onChange: () {},
|
||||
)
|
||||
: FutureBuilder(
|
||||
future: futureImageUrl,
|
||||
builder: (context, asyncSnapshot) {
|
||||
if (asyncSnapshot.connectionState ==
|
||||
ConnectionState.done &&
|
||||
asyncSnapshot.hasData) {
|
||||
if (asyncSnapshot.requireData != "" ||
|
||||
asyncSnapshot.requireData.isNotEmpty) {
|
||||
return MihCircleAvatar(
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
expandable: true,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
userSelectedfile: file,
|
||||
frameColor: MihColors.primary(),
|
||||
backgroundColor: MihColors.secondary(),
|
||||
onChange: () {},
|
||||
);
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihIDontKnow,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
return Icon(
|
||||
MihIcons.mihRing,
|
||||
size: profilePictureWidth,
|
||||
color: MihColors.primary(),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
FittedBox(
|
||||
child: Text(
|
||||
user.username,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue