Skip to content

Commit

Permalink
Load feed images from the network instead of a static file
Browse files Browse the repository at this point in the history
  • Loading branch information
MillerAdulu committed Aug 27, 2024
1 parent b172a1e commit 35011f6
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions lib/features/feed/ui/feed_screen.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_svg/svg.dart';
Expand Down Expand Up @@ -61,9 +62,23 @@ class _FeedScreenState extends State<FeedScreen> {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
),
child: Image.asset(
AppAssets.session1,
height: 209,
child: CachedNetworkImage(
fit: BoxFit.cover,
imageUrl: feed.image,
width: double.infinity,
placeholder: (_, __) => const SizedBox(
height: 100,
width: double.infinity,
child: Center(child: CircularProgressIndicator()),
),
errorWidget: (_, __, ___) => const SizedBox(
height: 100,
width: double.infinity,
child: Icon(
Icons.error,
color: Colors.red,
),
),
),
),
const SizedBox(height: 16),
Expand Down

0 comments on commit 35011f6

Please sign in to comment.