QOL: Switch from Network Image to CachedNetworkImage
This commit is contained in:
@@ -154,11 +154,7 @@ class _PackageToolOneState extends State<PackageToolOne> {
|
||||
super.initState();
|
||||
setState(() {
|
||||
imagePreview = null;
|
||||
// const NetworkImage(
|
||||
// "https://lh3.googleusercontent.com/nW4ZZ89Q1ATz7Ht3nsAVWXL_cwNi4gNusqQZiL60UuuI3FG-VM7bTYDoJ-sUr2kDTdorfQYjxo5PjDM-0MO5rA=s512");
|
||||
});
|
||||
|
||||
// myCoordinates = MIHLocationAPI().getGPSPosition(context);
|
||||
}
|
||||
|
||||
Widget getBody(double width) {
|
||||
|
||||
@@ -42,9 +42,7 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
||||
directoryProvider,
|
||||
);
|
||||
List<Business> favBus = [];
|
||||
// Map<String, ImageProvider<Object>?> favBusImages = {};
|
||||
Map<String, Future<String>> favBusImages = {};
|
||||
// String businessLogoUrl = "";
|
||||
Future<String> businessLogoUrl;
|
||||
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||
await MihBusinessDetailsServices()
|
||||
@@ -53,7 +51,6 @@ class _MihFavouriteBusinessesState extends State<MihFavouriteBusinesses> {
|
||||
favBus.add(business!);
|
||||
businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path);
|
||||
favBusImages[business.business_id] = businessLogoUrl;
|
||||
// businessLogoUrl != "" ? NetworkImage(businessLogoUrl) : null;
|
||||
});
|
||||
}
|
||||
directoryProvider.setFavouriteBusinesses(
|
||||
|
||||
@@ -38,9 +38,7 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
||||
directoryProvider,
|
||||
);
|
||||
List<Business> favBus = [];
|
||||
// Map<String, ImageProvider<Object>?> favBusImages = {};
|
||||
Map<String, Future<String>> favBusImages = {};
|
||||
// String businessLogoUrl = "";
|
||||
Future<String> businessLogoUrl;
|
||||
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||
await MihBusinessDetailsServices()
|
||||
@@ -49,7 +47,6 @@ class _MihAddBookmarkAlertState extends State<MihAddBookmarkAlert> {
|
||||
favBus.add(business!);
|
||||
businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path);
|
||||
favBusImages[business.business_id] = businessLogoUrl;
|
||||
// businessLogoUrl != "" ? NetworkImage(businessLogoUrl) : null;
|
||||
});
|
||||
}
|
||||
directoryProvider.setFavouriteBusinesses(
|
||||
|
||||
@@ -574,14 +574,11 @@ class _MihBusinessCardState extends State<MihBusinessCard> {
|
||||
businessSearchResults = await MihBusinessDetailsServices()
|
||||
.searchBusinesses(directoryProvider.searchTerm,
|
||||
directoryProvider.businessTypeFilter, context);
|
||||
// Map<String, ImageProvider<Object>?> busImages = {};
|
||||
Map<String, Future<String>> busImagesUrl = {};
|
||||
// String businessLogoUrl = "";
|
||||
Future<String> businessLogoUrl;
|
||||
for (var bus in businessSearchResults) {
|
||||
businessLogoUrl = MihFileApi.getMinioFileUrl(bus.logo_path);
|
||||
busImagesUrl[bus.business_id] = businessLogoUrl;
|
||||
// != "" ? NetworkImage(businessLogoUrl) : null;
|
||||
}
|
||||
directoryProvider.setSearchedBusinesses(
|
||||
searchedBusinesses: businessSearchResults,
|
||||
|
||||
@@ -43,9 +43,7 @@ class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
||||
directoryProvider,
|
||||
);
|
||||
List<Business> favBus = [];
|
||||
// Map<String, ImageProvider<Object>?> favBusImages = {};
|
||||
Map<String, Future<String>> favBusImages = {};
|
||||
// String businessLogoUrl = "";
|
||||
Future<String> businessLogoUrl;
|
||||
for (var bus in directoryProvider.bookmarkedBusinesses) {
|
||||
await MihBusinessDetailsServices()
|
||||
@@ -54,7 +52,6 @@ class _MihDeleteBookmarkAlertState extends State<MihDeleteBookmarkAlert> {
|
||||
favBus.add(business!);
|
||||
businessLogoUrl = MihFileApi.getMinioFileUrl(business.logo_path);
|
||||
favBusImages[business.business_id] = businessLogoUrl;
|
||||
// businessLogoUrl != "" ? NetworkImage(businessLogoUrl) : null;
|
||||
});
|
||||
}
|
||||
directoryProvider.setFavouriteBusinesses(
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:custom_rating_bar/custom_rating_bar.dart';
|
||||
import 'package:file_picker/file_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
@@ -72,8 +73,8 @@ class _MihBusinessDetailsViewState extends State<MihBusinessDetailsView> {
|
||||
asyncSnapshot.hasData) {
|
||||
if (asyncSnapshot.requireData != "") {
|
||||
return MihCircleAvatar(
|
||||
imageFile:
|
||||
NetworkImage(asyncSnapshot.requireData),
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
|
||||
@@ -208,7 +208,8 @@ class _MihBusinessQrCodeState extends State<MihBusinessQrCode> {
|
||||
if (asyncSnapshot.requireData != "" ||
|
||||
asyncSnapshot.requireData.isNotEmpty) {
|
||||
return MihCircleAvatar(
|
||||
imageFile: NetworkImage(asyncSnapshot.requireData),
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:mzansi_innovation_hub/main.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_package_components/mih_icons.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_providers/mzansi_directory_provider.dart';
|
||||
@@ -69,7 +70,8 @@ class _MihPersonalProfileViewState extends State<MihPersonalProfileView> {
|
||||
asyncSnapshot.hasData) {
|
||||
if (asyncSnapshot.requireData != "") {
|
||||
return MihCircleAvatar(
|
||||
imageFile: NetworkImage(asyncSnapshot.requireData),
|
||||
imageFile: CachedNetworkImageProvider(
|
||||
asyncSnapshot.requireData),
|
||||
width: profilePictureWidth,
|
||||
editable: false,
|
||||
fileNameController: TextEditingController(),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/app_user.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/business.dart';
|
||||
@@ -76,7 +77,8 @@ class MzansiProfileProvider extends ChangeNotifier {
|
||||
|
||||
void setUserProfilePicUrl(String url) {
|
||||
userProfilePicUrl = url;
|
||||
userProfilePicture = url.isNotEmpty ? NetworkImage(url) : null;
|
||||
userProfilePicture =
|
||||
url.isNotEmpty ? CachedNetworkImageProvider(url) : null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -89,7 +91,8 @@ class MzansiProfileProvider extends ChangeNotifier {
|
||||
|
||||
void setBusinessProfilePicUrl(String url) {
|
||||
businessProfilePicUrl = url;
|
||||
businessProfilePicture = url.isNotEmpty ? NetworkImage(url) : null;
|
||||
businessProfilePicture =
|
||||
url.isNotEmpty ? CachedNetworkImageProvider(url) : null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
@@ -100,7 +103,8 @@ class MzansiProfileProvider extends ChangeNotifier {
|
||||
|
||||
void setBusinessUserSignatureUrl(String url) {
|
||||
businessUserSignatureUrl = url;
|
||||
businessUserSignature = url.isNotEmpty ? NetworkImage(url) : null;
|
||||
businessUserSignature =
|
||||
url.isNotEmpty ? CachedNetworkImageProvider(url) : null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/claim_statement_file.dart';
|
||||
import 'package:mzansi_innovation_hub/mih_objects/files.dart';
|
||||
@@ -62,7 +63,8 @@ class PatientManagerProvider extends ChangeNotifier {
|
||||
|
||||
void setSelectedPatientProfilePicUrl(String url) {
|
||||
selectedPatientProfilePictureUrl = url;
|
||||
selectedPatientProfilePicture = url.isNotEmpty ? NetworkImage(url) : null;
|
||||
selectedPatientProfilePicture =
|
||||
url.isNotEmpty ? CachedNetworkImageProvider(url) : null;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user