Fix: some changes
This commit is contained in:
@@ -111,7 +111,6 @@ class _MainPageState extends State<MainPage> {
|
||||
setState(() {
|
||||
filteredData = data;
|
||||
itemViewCount = min(filteredData.length, 5);
|
||||
debugPrint(itemViewCount.toString());
|
||||
});
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
for (var element in filteredData.sublist(0, itemViewCount)) {
|
||||
@@ -281,11 +280,22 @@ class _MainPageState extends State<MainPage> {
|
||||
itemBuilder: (context, index) {
|
||||
final product = filteredData[index];
|
||||
return ProductCard(
|
||||
imagePath: Image(
|
||||
image:
|
||||
Image.network(product.images[0].url)
|
||||
.image,
|
||||
width: 120,
|
||||
imagePath: FutureBuilder(
|
||||
future: precacheImage(
|
||||
NetworkImage(product.images[0].url),
|
||||
context),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState ==
|
||||
ConnectionState.done) {
|
||||
return Image(
|
||||
image: NetworkImage(
|
||||
product.images[0].url),
|
||||
width: 120,
|
||||
);
|
||||
} else {
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
},
|
||||
),
|
||||
name: shortString(product.title),
|
||||
price: product.price.toStringAsFixed(2),
|
||||
|
||||
Reference in New Issue
Block a user