profile Picture fix
This commit is contained in:
@@ -45,7 +45,9 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate>
|
||||
late final GifController _controller;
|
||||
|
||||
Future<String> getFileUrlApiCall(String filePath) async {
|
||||
if (AppEnviroment.getEnv() == "Dev") {
|
||||
if (widget.signedInUser.pro_pic_path == "") {
|
||||
return "";
|
||||
} else if (AppEnviroment.getEnv() == "Dev") {
|
||||
return "${AppEnviroment.baseFileUrl}/mih/$filePath";
|
||||
} else {
|
||||
var url = "${AppEnviroment.baseApiUrl}/minio/pull/file/$filePath/prod";
|
||||
@@ -222,12 +224,10 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate>
|
||||
var proPicName = "";
|
||||
if (widget.signedInUser.pro_pic_path.isNotEmpty) {
|
||||
proPicName = widget.signedInUser.pro_pic_path.split("/").last;
|
||||
setState(() {
|
||||
proPicUrl = getFileUrlApiCall(widget.signedInUser.pro_pic_path);
|
||||
});
|
||||
}
|
||||
_controller = GifController(vsync: this);
|
||||
setState(() {
|
||||
proPicUrl = getFileUrlApiCall(widget.signedInUser.pro_pic_path);
|
||||
proPicController.text = proPicName;
|
||||
fnameController.text = widget.signedInUser.fname;
|
||||
lnameController.text = widget.signedInUser.lname;
|
||||
@@ -270,7 +270,7 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate>
|
||||
future: proPicUrl,
|
||||
builder: (BuildContext context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
if (snapshot.hasData) {
|
||||
if (snapshot.hasData && snapshot.data != "") {
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
fit: StackFit.loose,
|
||||
@@ -292,32 +292,18 @@ class _ProfileUserUpdateState extends State<ProfileUserUpdate>
|
||||
],
|
||||
);
|
||||
} else {
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occurred',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
return SizedBox(
|
||||
width: 110,
|
||||
child: Image(
|
||||
image: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.altLogoImage()));
|
||||
}
|
||||
} else {
|
||||
return SizedBox(
|
||||
width: 110,
|
||||
child: Gif(
|
||||
image: MzanziInnovationHub.of(context)!
|
||||
.theme
|
||||
.loadingImage(),
|
||||
controller:
|
||||
_controller, // if duration and fps is null, original gif fps will be used.
|
||||
fps: 15,
|
||||
//duration: const Duration(seconds: 3),
|
||||
autostart: Autostart.loop,
|
||||
placeholder: (context) => const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
onFetchCompleted: () {
|
||||
_controller.reset();
|
||||
_controller.forward();
|
||||
},
|
||||
return Center(
|
||||
child: Text(
|
||||
'${snapshot.error} occurred',
|
||||
style: const TextStyle(fontSize: 18),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user