Compare commits

..

No commits in common. "0c2d9e20eb19da1008c82f1897820940cdad5e66" and "395778a6239c50ded848d52b16b334fa3cfe37c4" have entirely different histories.

16 changed files with 44 additions and 184 deletions

View file

@ -38,7 +38,7 @@ android {
defaultConfig { defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "space.lynnesbian.buypeeb_mobile" applicationId "space.lynnesbian.buyeeb_mobile"
minSdkVersion 16 minSdkVersion 16
targetSdkVersion 28 targetSdkVersion 28
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()

View file

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="space.lynnesbian.buypeeb_mobile"> package="space.lynnesbian.buyeeb_mobile">
<!-- Flutter needs it to communicate with the running application <!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->

View file

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="space.lynnesbian.buypeeb_mobile"> package="space.lynnesbian.buyeeb_mobile">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that <!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method. calls FlutterMain.startInitialization(this); in its onCreate method.
In most cases you can leave this as-is, but you if you want to provide In most cases you can leave this as-is, but you if you want to provide
@ -7,7 +7,7 @@
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<application <application
android:name="io.flutter.app.FlutterApplication" android:name="io.flutter.app.FlutterApplication"
android:label="buypeeb_mobile" android:label="buyeeb_mobile"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"

View file

@ -1,4 +1,4 @@
package space.lynnesbian.buypeeb_mobile package space.lynnesbian.buyeeb_mobile
import io.flutter.embedding.android.FlutterActivity import io.flutter.embedding.android.FlutterActivity

View file

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="space.lynnesbian.buypeeb_mobile"> package="space.lynnesbian.buyeeb_mobile">
<!-- Flutter needs it to communicate with the running application <!-- Flutter needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc. to allow setting breakpoints, to provide hot reload, etc.
--> -->

View file

@ -310,7 +310,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = space.lynnesbian.buypeebMobile; PRODUCT_BUNDLE_IDENTIFIER = space.lynnesbian.buyeebMobile;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -438,7 +438,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = space.lynnesbian.buypeebMobile; PRODUCT_BUNDLE_IDENTIFIER = space.lynnesbian.buyeebMobile;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };
@ -461,7 +461,7 @@
"$(inherited)", "$(inherited)",
"$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/Flutter",
); );
PRODUCT_BUNDLE_IDENTIFIER = space.lynnesbian.buypeebMobile; PRODUCT_BUNDLE_IDENTIFIER = space.lynnesbian.buyeebMobile;
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
VERSIONING_SYSTEM = "apple-generic"; VERSIONING_SYSTEM = "apple-generic";
}; };

View file

@ -11,7 +11,7 @@
<key>CFBundleInfoDictionaryVersion</key> <key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string> <string>6.0</string>
<key>CFBundleName</key> <key>CFBundleName</key>
<string>buypeeb_mobile</string> <string>buyeeb_mobile</string>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>

View file

@ -15,9 +15,9 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:buypeeb_mobile/pages/main_page.dart'; import 'package:buyeeb_mobile/pages/main_page.dart';
import 'package:buypeeb_mobile/pages/splash.dart'; import 'package:buyeeb_mobile/pages/splash.dart';
import 'package:buypeeb_mobile/pages/view_listing.dart'; import 'package:buyeeb_mobile/pages/view_listing.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'models/user_listings.dart'; import 'models/user_listings.dart';

View file

@ -1,5 +1,5 @@
import 'dart:collection'; import 'dart:collection';
import 'package:buypeeb_mobile/models/yahoo_auctions_item.dart'; import 'package:buyeeb_mobile/models/yahoo_auctions_item.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
class UserListings extends ChangeNotifier { class UserListings extends ChangeNotifier {

View file

@ -2,12 +2,7 @@ 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

@ -1,12 +1,10 @@
import 'package:buypeeb_mobile/models/user_listings.dart'; import 'package:buyeeb_mobile/models/user_listings.dart';
import 'package:buypeeb_mobile/models/yahoo_auctions_item.dart'; import 'package:buyeeb_mobile/models/yahoo_auctions_item.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:sprintf/sprintf.dart'; 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
@ -58,17 +56,10 @@ 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( subtitle: Text(sprintf(
sprintf(
"¥%d (≈\$%2.2f)", "¥%d (≈\$%2.2f)",
[listings.items[key].price, listings.items[key].getLocalPrice()] [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

@ -1,5 +1,5 @@
import 'package:buypeeb_mobile/models/user_listings.dart'; import 'package:buyeeb_mobile/models/user_listings.dart';
import 'package:buypeeb_mobile/models/yahoo_auctions_item.dart'; import 'package:buyeeb_mobile/models/yahoo_auctions_item.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'dart:math'; import 'dart:math';

View file

@ -1,10 +1,4 @@
import 'package:buypeeb_mobile/models/user_listings.dart';
import 'package:sprintf/sprintf.dart';
import 'package:transparent_image/transparent_image.dart';
import 'package:provider/provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:collection';
class RouteViewListing extends StatefulWidget { class RouteViewListing extends StatefulWidget {
@override @override
@ -15,129 +9,17 @@ class _RouteViewListingState extends State<RouteViewListing> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final String id = ModalRoute.of(context).settings.arguments; final String id = ModalRoute.of(context).settings.arguments;
var listings = context.watch<UserListings>();
var thisListing = listings.items[id];
final text = <Text>{};
final Map<Text, Widget> listingInfo = {
Text("ID"): Text(id),
Text("Price"): Text("¥${thisListing.price}"),
Text("Price (AUD)"): Text(sprintf("\$%2.2f", [thisListing.getLocalPrice()])),
Text("Ending in"): Text("3 days, 01:23:45"),
Text("Bids"): Text("7"),
Text('"Buy it now" available'): true ? Icon(Icons.check_circle) : Icon(Icons.cancel),
Text("Auto extension"): true ? Icon(Icons.check_circle) : Icon(Icons.cancel),
};
final Map<Text, Widget> listingActions = {
Text("Favourite"): true ? Icon(Icons.favorite) : Icon(Icons.favorite_border),
Text("Share") : Icon(Icons.share),
Text("Rename") : Icon(Icons.edit),
Text("View on Buyee") : Icon(Icons.web),
Text("View on Yahoo! Auctions Japan") : Icon(Icons.web),
Text("Delete") : Icon(Icons.delete),
};
return Scaffold( return Scaffold(
body: NestedScrollView( appBar: AppBar(
headerSliverBuilder: (context, innerBoxIsScrolled) => [ title: Text("View listing"),
SliverOverlapAbsorber(
sliver: SliverSafeArea(
top: false,
sliver: SliverAppBar(
pinned: true,
// based on https://api.flutter.dev/flutter/material/FlexibleSpaceBar-class.html
flexibleSpace: FlexibleSpaceBar(
stretchModes: [
StretchMode.blurBackground,
StretchMode.fadeTitle,
],
title: Text(
thisListing.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
centerTitle: true,
// titlePadding: const EdgeInsetsDirectional.only(bottom: 16, end: 150),
background: Stack(
fit: StackFit.expand,
children: [
FadeInImage.memoryNetwork(
placeholder: kTransparentImage,
image: thisListing.imageUrl,
fit: BoxFit.cover,
),
const DecoratedBox(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment(0.0, 0.5),
end: Alignment(0.0, 0.0),
colors: <Color>[
Color(0x60000000),
Color(0x00000000),
],
)
)
)
]
)
),
expandedHeight: 200,
automaticallyImplyLeading: false, // remove the useless back button automaticallyImplyLeading: false, // remove the useless back button
), ),
), body: ListView(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context), children: [
), ListTile(
], title: Text("ID: $id")
body:
ListView.separated(
itemBuilder: (context, i) {
if (i == 0) {
return ListTile(
visualDensity: VisualDensity.compact,
title: Text(
"About this listing",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
),
)
);
} else if (i > 0 && i <= listingInfo.length) {
// subtract one to account for the "About this listing" tile at the start of the list
i = i - 1;
var key = listingInfo.keys.elementAt(i);
return ListTile(
visualDensity: VisualDensity.compact,
title: key,
trailing: listingInfo[key],
);
} else if (i == listingInfo.length + 1) {
return ListTile(
visualDensity: VisualDensity.compact,
title: Text(
"Actions",
textAlign: TextAlign.center,
style: TextStyle(
fontWeight: FontWeight.bold,
)
)
);
} else if (i > listingInfo.length + 1 && i <= listingInfo.length + 1 + listingActions.length) {
// subtract 2 (one for each header), and the length of listingInfo, to account for the previous stuff
i = i - listingInfo.length - 2;
var key = listingActions.keys.elementAt(i);
return ListTile(
visualDensity: VisualDensity.compact,
title: key,
trailing: listingActions[key],
);
} else {
return ListTile(title: Text("???"));
}
},
separatorBuilder: (context, i) => new Divider(),
itemCount: listingInfo.length + listingActions.length + 2
) )
]
) )
); );
} }

View file

@ -177,13 +177,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.17" version: "0.2.17"
transparent_image:
dependency: "direct main"
description:
name: transparent_image
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:

View file

@ -1,4 +1,4 @@
name: buypeeb_mobile name: buyeeb_mobile
description: Buypeeb for mobile devices description: Buypeeb for mobile devices
# The following line prevents the package from being accidentally published to # The following line prevents the package from being accidentally published to
@ -31,7 +31,6 @@ dependencies:
sprintf: "^4.0.0" sprintf: "^4.0.0"
provider: ^4.1.0 provider: ^4.1.0
sqflite: ^1.3.0 sqflite: ^1.3.0
transparent_image: ^1.0.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

View file

@ -5,11 +5,11 @@
// gestures. You can also use WidgetTester to find child widgets in the widget // gestures. You can also use WidgetTester to find child widgets in the widget
// tree, read text, and verify that the values of widget properties are correct. // tree, read text, and verify that the values of widget properties are correct.
import 'package:buypeeb_mobile/pages/main_page.dart'; import 'package:buyeeb_mobile/pages/main_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_test/flutter_test.dart';
import 'package:buypeeb_mobile/main.dart'; import 'package:buyeeb_mobile/main.dart';
void main() { void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async { testWidgets('Counter increments smoke test', (WidgetTester tester) async {