QOL: Switch from Network Image to CachedNetworkImage
This commit is contained in:
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user