add some properties to YahooAuctionsItem, show images in home view

This commit is contained in:
Lynne Megido 2020-09-30 21:38:07 +10:00
parent 2ff6324a69
commit 0c2d9e20eb
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
3 changed files with 19 additions and 5 deletions

View file

@ -2,7 +2,12 @@ import 'package:flutter/foundation.dart';
class YahooAuctionsItem { class YahooAuctionsItem {
String name; String name;
String imageUrl = "https://lynnesbian.space/res/ceres/lesbun_full.jpg";
int price; int price;
int bids;
// ending time
bool buyItNow;
bool autoExtension;
YahooAuctionsItem({ YahooAuctionsItem({
@required this.name, @required this.name,

View file

@ -5,6 +5,8 @@ import 'package:sprintf/sprintf.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'dart:math'; import 'dart:math';
import 'package:transparent_image/transparent_image.dart';
class RouteHome extends StatelessWidget { class RouteHome extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
@ -56,10 +58,17 @@ class _MainPageState extends State<MainPage> {
String key = listings.items.keys.elementAt(i); String key = listings.items.keys.elementAt(i);
return ListTile( return ListTile(
title: Text(listings.items[key].name), title: Text(listings.items[key].name),
subtitle: Text(sprintf( subtitle: Text(
"¥%d (≈\$%2.2f)", sprintf(
[listings.items[key].price, listings.items[key].getLocalPrice()] "¥%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: () { onTap: () {
Navigator.pushNamed( Navigator.pushNamed(
context, context,

View file

@ -63,7 +63,7 @@ class _RouteViewListingState extends State<RouteViewListing> {
children: [ children: [
FadeInImage.memoryNetwork( FadeInImage.memoryNetwork(
placeholder: kTransparentImage, placeholder: kTransparentImage,
image: 'https://lynnesbian.space/res/ceres/lesbun_full.jpg', image: thisListing.imageUrl,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
const DecoratedBox( const DecoratedBox(