circle avatar to handle null
This commit is contained in:
@@ -41,63 +41,56 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
||||
// onChange: (newProPic) {},
|
||||
// ),
|
||||
//print(widget.propicFile);
|
||||
ImageProvider logoFrame =
|
||||
MzanziInnovationHub.of(context)!.theme.logoFrame();
|
||||
if (widget.propicFile != null) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-profile',
|
||||
arguments: AppProfileUpdateArguments(
|
||||
widget.signedInUser, widget.propicFile),
|
||||
);
|
||||
},
|
||||
child: MihCircleAvatar(
|
||||
imageFile: widget.propicFile,
|
||||
width: 60,
|
||||
editable: false,
|
||||
fileNameController: proPicController,
|
||||
onChange: (_) {},
|
||||
userSelectedfile: null,
|
||||
frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
),
|
||||
// MIHProfilePicture(
|
||||
// profilePictureFile: widget.propicFile,
|
||||
// proPicController: proPicController,
|
||||
// proPic: null,
|
||||
// width: 60,
|
||||
// radius: 27,
|
||||
// drawerMode: true,
|
||||
// editable: false,
|
||||
// frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// onChange: (newProPic) {},
|
||||
// ),
|
||||
|
||||
// Stack(
|
||||
// alignment: Alignment.center,
|
||||
// fit: StackFit.loose,
|
||||
// children: [
|
||||
// CircleAvatar(
|
||||
// backgroundColor:
|
||||
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// backgroundImage: widget.propicFile,
|
||||
// //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'),
|
||||
// radius: 27,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 60,
|
||||
// child: Image(image: logoFrame),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
);
|
||||
} else {
|
||||
return SizedBox(
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
Navigator.of(context).pushNamed(
|
||||
'/mzansi-profile',
|
||||
arguments:
|
||||
AppProfileUpdateArguments(widget.signedInUser, widget.propicFile),
|
||||
);
|
||||
},
|
||||
child: MihCircleAvatar(
|
||||
imageFile: widget.propicFile,
|
||||
width: 60,
|
||||
child: Image(image: logoFrame),
|
||||
);
|
||||
}
|
||||
editable: false,
|
||||
fileNameController: proPicController,
|
||||
onChange: (_) {},
|
||||
userSelectedfile: null,
|
||||
frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
backgroundColor:
|
||||
MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
),
|
||||
// MIHProfilePicture(
|
||||
// profilePictureFile: widget.propicFile,
|
||||
// proPicController: proPicController,
|
||||
// proPic: null,
|
||||
// width: 60,
|
||||
// radius: 27,
|
||||
// drawerMode: true,
|
||||
// editable: false,
|
||||
// frameColor: MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// onChange: (newProPic) {},
|
||||
// ),
|
||||
|
||||
// Stack(
|
||||
// alignment: Alignment.center,
|
||||
// fit: StackFit.loose,
|
||||
// children: [
|
||||
// CircleAvatar(
|
||||
// backgroundColor:
|
||||
// MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
// backgroundImage: widget.propicFile,
|
||||
// //'https://media.licdn.com/dms/image/D4D03AQGd1-QhjtWWpA/profile-displayphoto-shrink_400_400/0/1671698053061?e=2147483647&v=beta&t=a3dJI5yxs5-KeXjj10LcNCFuC9IOfa8nNn3k_Qyr0CA'),
|
||||
// radius: 27,
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 60,
|
||||
// child: Image(image: logoFrame),
|
||||
// )
|
||||
// ],
|
||||
// ),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
|
||||
@@ -109,6 +109,8 @@ class _MihHomeState extends State<MihHome> {
|
||||
userSelectedfile: null,
|
||||
// frameColor: frameColor,
|
||||
frameColor: MzanziInnovationHub.of(context)!.theme.secondaryColor(),
|
||||
backgroundColor:
|
||||
MzanziInnovationHub.of(context)!.theme.primaryColor(),
|
||||
onChange: (_) {},
|
||||
),
|
||||
// MIHProfilePicture(
|
||||
|
||||
@@ -35,17 +35,6 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
||||
ImageProvider<Object>? propicFile;
|
||||
int _selcetedIndex = 0;
|
||||
|
||||
ImageProvider<Object>? isPictureAvailable(String url) {
|
||||
if (url == "") {
|
||||
return const AssetImage(
|
||||
'lib/mih_components/mih_package_components/assets/images/i-dont-know-2.png');
|
||||
} else if (url != "") {
|
||||
return NetworkImage(url);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
bool isUserNew(AppUser signedInUser) {
|
||||
if (signedInUser.fname == "") {
|
||||
return true;
|
||||
@@ -249,7 +238,9 @@ class _MIHProfileGetterState extends State<MIHProfileGetter> {
|
||||
business: snapshot.data!.business,
|
||||
patient: snapshot.data!.patient,
|
||||
notifications: snapshot.data!.notifi,
|
||||
propicFile: isPictureAvailable(snapshot.data!.profilePicUrl),
|
||||
propicFile: snapshot.data!.profilePicUrl != ""
|
||||
? NetworkImage(snapshot.data!.profilePicUrl)
|
||||
: null,
|
||||
isUserNew: isUserNew(snapshot.requireData.signedInUser),
|
||||
isBusinessUser: isBusinessUser(snapshot.requireData.signedInUser),
|
||||
isBusinessUserNew: isBusinessUserNew(snapshot.data!.businessUser),
|
||||
|
||||
Reference in New Issue
Block a user