Compare commits

...

4 Commits

16 changed files with 184 additions and 44 deletions

View File

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

View File

@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="space.lynnesbian.buyeeb_mobile">
package="space.lynnesbian.buypeeb_mobile">
<!-- Flutter needs it to communicate with the running application
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"
package="space.lynnesbian.buyeeb_mobile">
package="space.lynnesbian.buypeeb_mobile">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
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. -->
<application
android:name="io.flutter.app.FlutterApplication"
android:label="buyeeb_mobile"
android:label="buypeeb_mobile"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"

View File

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

View File

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

View File

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

View File

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

View File

@ -15,9 +15,9 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import 'package:buyeeb_mobile/pages/main_page.dart';
import 'package:buyeeb_mobile/pages/splash.dart';
import 'package:buyeeb_mobile/pages/view_listing.dart';
import 'package:buypeeb_mobile/pages/main_page.dart';
import 'package:buypeeb_mobile/pages/splash.dart';
import 'package:buypeeb_mobile/pages/view_listing.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'models/user_listings.dart';
@ -27,17 +27,17 @@ void main() {
ChangeNotifierProvider(
create: (context) => UserListings(),
child: MaterialApp(
initialRoute: '/splash',
routes: {
'/': (context) => RouteHome(),
'/splash': (context) => RouteSplash(),
'/view_listing': (context) => RouteViewListing(),
},
initialRoute: '/splash',
routes: {
'/': (context) => RouteHome(),
'/splash': (context) => RouteSplash(),
'/view_listing': (context) => RouteViewListing(),
},
title: "Buypeeb Mobile",
theme: ThemeData(
primarySwatch: Colors.pink,
),
title: "Buypeeb Mobile",
theme: ThemeData(
primarySwatch: Colors.pink,
),
)
),
);

View File

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

View File

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

View File

@ -1,10 +1,12 @@
import 'package:buyeeb_mobile/models/user_listings.dart';
import 'package:buyeeb_mobile/models/yahoo_auctions_item.dart';
import 'package:buypeeb_mobile/models/user_listings.dart';
import 'package:buypeeb_mobile/models/yahoo_auctions_item.dart';
import 'package:flutter/material.dart';
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<MainPage> {
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,

View File

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

View File

@ -1,4 +1,10 @@
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 'dart:collection';
class RouteViewListing extends StatefulWidget {
@override
@ -9,17 +15,129 @@ class _RouteViewListingState extends State<RouteViewListing> {
@override
Widget build(BuildContext context) {
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(
appBar: AppBar(
title: Text("View listing"),
automaticallyImplyLeading: false, // remove the useless back button
),
body: ListView(
children: [
ListTile(
title: Text("ID: $id")
body: NestedScrollView(
headerSliverBuilder: (context, innerBoxIsScrolled) => [
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
),
),
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
),
],
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,6 +177,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:

View File

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

View File

@ -5,11 +5,11 @@
// 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.
import 'package:buyeeb_mobile/pages/main_page.dart';
import 'package:buypeeb_mobile/pages/main_page.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:buyeeb_mobile/main.dart';
import 'package:buypeeb_mobile/main.dart';
void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {