From 0c2d9e20eb19da1008c82f1897820940cdad5e66 Mon Sep 17 00:00:00 2001 From: Lynne Date: Wed, 30 Sep 2020 21:38:07 +1000 Subject: [PATCH] add some properties to YahooAuctionsItem, show images in home view --- lib/models/yahoo_auctions_item.dart | 5 +++++ lib/pages/main_page.dart | 17 +++++++++++++---- lib/pages/view_listing.dart | 2 +- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/lib/models/yahoo_auctions_item.dart b/lib/models/yahoo_auctions_item.dart index 32e8358..1653179 100644 --- a/lib/models/yahoo_auctions_item.dart +++ b/lib/models/yahoo_auctions_item.dart @@ -2,7 +2,12 @@ import 'package:flutter/foundation.dart'; class YahooAuctionsItem { String name; + String imageUrl = "https://lynnesbian.space/res/ceres/lesbun_full.jpg"; int price; + int bids; + // ending time + bool buyItNow; + bool autoExtension; YahooAuctionsItem({ @required this.name, diff --git a/lib/pages/main_page.dart b/lib/pages/main_page.dart index 23b3150..243cd92 100644 --- a/lib/pages/main_page.dart +++ b/lib/pages/main_page.dart @@ -5,6 +5,8 @@ import 'package:sprintf/sprintf.dart'; import 'package:provider/provider.dart'; import 'dart:math'; +import 'package:transparent_image/transparent_image.dart'; + class RouteHome extends StatelessWidget { // This widget is the root of your application. @override @@ -56,10 +58,17 @@ class _MainPageState extends State { String key = listings.items.keys.elementAt(i); return ListTile( title: Text(listings.items[key].name), - subtitle: Text(sprintf( - "¥%d (≈\$%2.2f)", - [listings.items[key].price, listings.items[key].getLocalPrice()] - )), + subtitle: Text( + sprintf( + "¥%d (≈\$%2.2f)", + [listings.items[key].price, listings.items[key].getLocalPrice()] + ) + ), + leading: FadeInImage.memoryNetwork( + placeholder: kTransparentImage, + image: listings.items[key].imageUrl, + fit: BoxFit.cover, + ), onTap: () { Navigator.pushNamed( context, diff --git a/lib/pages/view_listing.dart b/lib/pages/view_listing.dart index ed7663d..5138de2 100644 --- a/lib/pages/view_listing.dart +++ b/lib/pages/view_listing.dart @@ -63,7 +63,7 @@ class _RouteViewListingState extends State { children: [ FadeInImage.memoryNetwork( placeholder: kTransparentImage, - image: 'https://lynnesbian.space/res/ceres/lesbun_full.jpg', + image: thisListing.imageUrl, fit: BoxFit.cover, ), const DecoratedBox(