Fix: some changes

This commit is contained in:
2024-06-14 01:37:54 +03:00
parent f5e1407281
commit 73fe273c75
6 changed files with 52 additions and 26 deletions

View File

@@ -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),