Skip to content

Commit 0d75ad9

Browse files
committed
network image: attemp to fix loading on windows
1 parent 2036d3f commit 0d75ad9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

lib/screens/common/style_view.dart

+9-3
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,18 @@ class StyleView extends ConsumerWidget {
3838
mainAxisSpacing: isMobile ? 15 : 20,
3939
),
4040
itemBuilder: (context, index) => prov.when(
41-
data: (data) => InkWell(
41+
data: (imagesList) => InkWell(
4242
onTap: () {
43+
// fix weird character on windows
44+
imagesList = imagesList
45+
.map(
46+
(item) => item.replaceAll("%0D", ""),
47+
)
48+
.toList();
4349
// update the content image provider(will update the ui image)
4450
context.read(styleProvider.notifier).setState(
4551
CachedNetworkImageProvider(
46-
BUCKET_PREFIX + data[index],
52+
BUCKET_PREFIX + imagesList[index],
4753
),
4854
);
4955

@@ -53,7 +59,7 @@ class StyleView extends ConsumerWidget {
5359
nav.pop();
5460
},
5561
child: NetworkImageContainer(
56-
imgName: data[index],
62+
imgName: imagesList[index],
5763
),
5864
),
5965
loading: () => CupertinoActivityIndicator(),

lib/widgets/network_image_container.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class NetworkImageContainer extends StatelessWidget {
1414
return ClipRRect(
1515
borderRadius: BorderRadius.circular(20),
1616
child: CachedNetworkImage(
17-
imageUrl: BUCKET_PREFIX + imgName!,
17+
imageUrl: BUCKET_PREFIX + imgName!.replaceAll("%0D", ""),
1818
placeholder: (context, url) => SizedBox(
1919
height: height * 0.6,
2020
width: height * 0.6,

0 commit comments

Comments
 (0)