fix app drawer profile picture continuous reload
This commit is contained in:
@@ -6,7 +6,7 @@ import 'package:supertokens_flutter/supertokens.dart';
|
|||||||
class MIHAppDrawer extends StatefulWidget {
|
class MIHAppDrawer extends StatefulWidget {
|
||||||
final AppUser signedInUser;
|
final AppUser signedInUser;
|
||||||
final ImageProvider<Object>? propicFile;
|
final ImageProvider<Object>? propicFile;
|
||||||
//final AssetImage logo;
|
|
||||||
const MIHAppDrawer({
|
const MIHAppDrawer({
|
||||||
super.key,
|
super.key,
|
||||||
required this.signedInUser,
|
required this.signedInUser,
|
||||||
@@ -18,6 +18,7 @@ class MIHAppDrawer extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
||||||
|
late Widget profilePictureLoaded;
|
||||||
Future<bool> signOut() async {
|
Future<bool> signOut() async {
|
||||||
await SuperTokens.signOut(completionHandler: (error) {
|
await SuperTokens.signOut(completionHandler: (error) {
|
||||||
// handle error if any
|
// handle error if any
|
||||||
@@ -26,6 +27,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget displayProPic() {
|
Widget displayProPic() {
|
||||||
|
//print(widget.propicFile);
|
||||||
ImageProvider logoFrame =
|
ImageProvider logoFrame =
|
||||||
MzanziInnovationHub.of(context)!.theme.logoFrame();
|
MzanziInnovationHub.of(context)!.theme.logoFrame();
|
||||||
if (widget.propicFile != null) {
|
if (widget.propicFile != null) {
|
||||||
@@ -61,9 +63,9 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// setState(() {
|
setState(() {
|
||||||
// proPicUrl = getFileUrlApiCall(widget.signedInUser.pro_pic_path);
|
profilePictureLoaded = displayProPic();
|
||||||
// });
|
});
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -89,7 +91,7 @@ class _MIHAppDrawerState extends State<MIHAppDrawer> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
displayProPic(),
|
profilePictureLoaded,
|
||||||
Text(
|
Text(
|
||||||
"${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
"${widget.signedInUser.fname} ${widget.signedInUser.lname}",
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
|
|||||||
Reference in New Issue
Block a user