This commit is contained in:
2023-02-26 00:59:07 -05:00
9 changed files with 432 additions and 27 deletions

View File

@@ -49,7 +49,7 @@ android {
applicationId "com.example.ruswipeshare"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion 19
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName

View File

@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:ruswipeshare/sell.dart';
class BuyScreen extends StatefulWidget {
const BuyScreen({Key? key}) : super(key: key);
@@ -12,16 +13,23 @@ class _BuyScreenState extends State<BuyScreen> {
Widget build(BuildContext context) {
TimeOfDay _time = TimeOfDay.now();
return Scaffold(
appBar: AppBar(
title: const Text('Sell'),
automaticallyImplyLeading: false,
),
body: OffersListView(),
body: const OffersListView(),
);
}
}
final List<String> entries = <String>['A', 'B', 'C'];
final List<String> entries = <String>[
'Antoinette Beauchamp',
'Iliana Campbell',
'Angelique Straub',
'Ryleigh Pond',
'Andy Watters',
'Raphael Gossett',
'Kent Deutsch',
'Bridger Mojica',
'Pearl Morse',
'Jana Munguia'
];
final List<int> colorCodes = <int>[600, 500, 100];
class OffersListView extends StatelessWidget {
@@ -30,14 +38,78 @@ class OffersListView extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ListView.builder(
padding: const EdgeInsets.all(8),
itemCount: 30,
itemBuilder: (BuildContext context, int index) {
return Container(
return InkWell(
onTap: () {
Navigator.push(context,
MaterialPageRoute(builder: (context) => const SellScreen()));
},
child: Container(
height: 80,
color: Colors.amber[colorCodes[index % 3]],
child: Center(child: Text('Entry ${entries[index % 3]}')),
color: Colors.blue,
margin: const EdgeInsets.only(top: 4, bottom: 4),
child: Row(
children: [
Expanded(
flex: 7,
child: Container(
color: Colors.red,
margin: EdgeInsets.only(top: 4, left: 4, bottom: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
entries[index % entries.length],
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 24),
),
Row(
children: [
Icon(Icons.star, size: 16),
Icon(Icons.star, size: 16),
Icon(Icons.star, size: 16),
Icon(Icons.star_half, size: 16),
Icon(Icons.star_border, size: 16),
],
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
const Text(
'\88:88PM - 88:88PM',
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 16),
),
],
),
)
],
),
),
),
Expanded(
flex: 3,
child: Container(
color: Colors.orange,
child: const Text(
'\$88',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 44),
),
),
)
],
),
),
);
});
}
}
// return Container(
// height: 80,
// color: Colors.amber[colorCodes[index % colorCodes.length]],
// );

258
lib/credit_view.dart Normal file
View File

@@ -0,0 +1,258 @@
import 'package:flutter/material.dart';
import 'package:flutter_credit_card/credit_card_brand.dart';
import 'package:flutter_credit_card/flutter_credit_card.dart';
import 'package:flutter_stripe/flutter_stripe.dart';
void main() => runApp(CreditView());
class CreditView extends StatefulWidget {
@override
State<StatefulWidget> createState() {
return CreditViewState();
}
}
class CreditViewState extends State<CreditView> {
String cardNumber = '';
String expiryDate = '';
String cardHolderName = '';
String cvvCode = '';
bool isCvvFocused = false;
bool useGlassMorphism = false;
bool useBackgroundImage = false;
OutlineInputBorder? border;
final GlobalKey<FormState> formKey = GlobalKey<FormState>();
@override
void initState() {
border = OutlineInputBorder(
borderSide: BorderSide(
color: Colors.grey.withOpacity(0.7),
width: 2.0,
),
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Credit Card View Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: Scaffold(
resizeToAvoidBottomInset: false,
body: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: ExactAssetImage('assets/bg.png'),
fit: BoxFit.fill,
),
color: Colors.black,
),
child: SafeArea(
child: Column(
children: <Widget>[
const SizedBox(
height: 30,
),
CreditCardWidget(
glassmorphismConfig:
useGlassMorphism ? Glassmorphism.defaultConfig() : null,
cardNumber: cardNumber,
expiryDate: expiryDate,
cardHolderName: cardHolderName,
cvvCode: cvvCode,
bankName: 'Axis Bank',
frontCardBorder:
!useGlassMorphism ? Border.all(color: Colors.grey) : null,
backCardBorder:
!useGlassMorphism ? Border.all(color: Colors.grey) : null,
showBackView: isCvvFocused,
obscureCardNumber: true,
obscureCardCvv: true,
isHolderNameVisible: true,
backgroundImage:
useBackgroundImage ? 'assets/card_bg.png' : null,
isSwipeGestureEnabled: true,
onCreditCardWidgetChange:
(CreditCardBrand creditCardBrand) {},
customCardTypeIcons: <CustomCardTypeIcon>[
CustomCardTypeIcon(
cardType: CardType.mastercard,
cardImage: Image.asset(
'assets/mastercard.png',
height: 48,
width: 48,
),
),
],
),
Expanded(
child: SingleChildScrollView(
child: Column(
children: <Widget>[
CreditCardForm(
formKey: formKey,
obscureCvv: true,
obscureNumber: true,
cardNumber: cardNumber,
cvvCode: cvvCode,
isHolderNameVisible: true,
isCardNumberVisible: true,
isExpiryDateVisible: true,
cardHolderName: cardHolderName,
expiryDate: expiryDate,
themeColor: Colors.blue,
textColor: Colors.white,
cardNumberDecoration: InputDecoration(
labelText: 'Number',
hintText: 'XXXX XXXX XXXX XXXX',
hintStyle: const TextStyle(color: Colors.white),
labelStyle: const TextStyle(color: Colors.white),
focusedBorder: border,
enabledBorder: border,
),
expiryDateDecoration: InputDecoration(
hintStyle: const TextStyle(color: Colors.white),
labelStyle: const TextStyle(color: Colors.white),
focusedBorder: border,
enabledBorder: border,
labelText: 'Expired Date',
hintText: 'XX/XX',
),
cvvCodeDecoration: InputDecoration(
hintStyle: const TextStyle(color: Colors.white),
labelStyle: const TextStyle(color: Colors.white),
focusedBorder: border,
enabledBorder: border,
labelText: 'CVV',
hintText: 'XXX',
),
cardHolderDecoration: InputDecoration(
hintStyle: const TextStyle(color: Colors.white),
labelStyle: const TextStyle(color: Colors.white),
focusedBorder: border,
enabledBorder: border,
labelText: 'Card Holder',
),
onCreditCardModelChange: onCreditCardModelChange,
),
const SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Glassmorphism',
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
const Spacer(),
Switch(
value: useGlassMorphism,
inactiveTrackColor: Colors.grey,
activeColor: Colors.white,
onChanged: (bool value) => setState(() {
useGlassMorphism = value;
}),
),
],
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
const Text(
'Card Image',
style: TextStyle(
color: Colors.white,
fontSize: 18,
),
),
const Spacer(),
Switch(
value: useBackgroundImage,
inactiveTrackColor: Colors.grey,
activeColor: Colors.white,
onChanged: (bool value) => setState(() {
useBackgroundImage = value;
}),
),
],
),
),
const SizedBox(
height: 20,
),
GestureDetector(
onTap: _onValidate,
child: Container(
margin: const EdgeInsets.symmetric(
horizontal: 16, vertical: 8),
padding: const EdgeInsets.symmetric(vertical: 15),
width: double.infinity,
alignment: Alignment.center,
child: const Text(
'Validate',
style: TextStyle(
color: Colors.black,
fontFamily: 'halter',
fontSize: 14,
package: 'flutter_credit_card',
),
),
),
),
OutlinedButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(Colors.red),
),
onPressed: () { },
child: Text('Complete Setup'),
),
],
),
),
),
],
),
),
),
),
);
}
void _onValidate() {
if (formKey.currentState!.validate()) {
print('valid!');
} else {
print('invalid!');
}
}
void onCreditCardModelChange(CreditCardModel? creditCardModel) {
setState(() {
cardNumber = creditCardModel!.cardNumber;
expiryDate = creditCardModel.expiryDate;
cardHolderName = creditCardModel.cardHolderName;
cvvCode = creditCardModel.cvvCode;
isCvvFocused = creditCardModel.isCvvFocused;
});
}
}

View File

@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'meetings.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
class MainScreen extends StatefulWidget {
const MainScreen({Key? key}) : super(key: key);
@@ -11,6 +13,13 @@ class MainScreen extends StatefulWidget {
class _MainScreenState extends State<MainScreen> {
@override
Widget build(BuildContext context) {
print("OOOGABOOGA");
getSellers(Filter(
["Sbarro"],
PriceRange(8, 10),
TimeRange(Timestamp.fromDate(DateTime(2023, 2, 26, 12, 50)),
Timestamp.fromDate(DateTime(2023, 2, 26, 11, 50)))))
.then((value) => {print(value)});
return Scaffold(
appBar: AppBar(
title: const Text("Main Beens"),

View File

@@ -3,27 +3,37 @@ import 'dart:ffi';
import 'package:cloud_firestore/cloud_firestore.dart';
class TimeRange {
late DateTime startTime;
late DateTime endTime;
late Timestamp startTime;
late Timestamp endTime;
TimeRange(this.startTime, this.endTime);
}
class PriceRange {
int low = 0;
int high = 0;
double low = 0;
double high = 0;
PriceRange(this.low, this.high);
}
class Seller {
class Seller implements Comparable<Seller> {
String name = "";
String uid = "";
List<String> location;
List<dynamic> location;
TimeRange availableTime;
int price;
Seller(this.name, this.uid, this.location, this.availableTime, this.price);
@override
String toString() {
return "Name: $name, Price: $price";
}
@override
int compareTo(Seller other) {
return name.compareTo(other.name);
}
}
class Filter {
@@ -36,17 +46,18 @@ class Filter {
Future<List<Seller>> getSellers(Filter filter) async {
CollectionReference users = FirebaseFirestore.instance.collection('sellers');
List<Seller> sellers = List.empty();
List<Seller> sellers = List.empty(growable: true);
final Query query = users
.where('location', arrayContainsAny: filter.locations)
.where('price', isGreaterThanOrEqualTo: filter.price?.low, isLessThanOrEqualTo: filter.price?.high)
.where('start-time', isGreaterThanOrEqualTo: filter.meetingTime?.startTime)
.where('end-time', isLessThanOrEqualTo: filter.meetingTime?.endTime);
.where('price',
isGreaterThanOrEqualTo: filter.price?.low,
isLessThanOrEqualTo: filter.price?.high);
final QuerySnapshot snapshot = await query.get();
for (var doc in snapshot.docs) {
sellers.add(Seller(doc["name"], doc["uid"], doc["location"], TimeRange(doc["start-time"], doc["end-time"]), doc["price"]));
sellers.add(Seller(doc["name"], doc["uid"], doc["location"],
TimeRange(doc["start-time"], doc["end-time"]), doc["price"]));
}
return sellers;
}

View File

@@ -8,6 +8,8 @@ import 'package:firebase_auth/firebase_auth.dart' show ActionCodeSettings, Fireb
import 'package:flutter/cupertino.dart' hide Title;
import 'package:flutter/material.dart';
import 'package:flutter/material.dart' hide Title;
import 'package:flutter/material.dart';
import 'package:flutter_credit_card/credit_card_brand.dart';
import 'package:flutter_credit_card/flutter_credit_card.dart';
import 'package:flutterfire_ui/auth.dart';
import 'package:flutterfire_ui/src/auth/widgets/internal/loading_button.dart';
@@ -19,6 +21,7 @@ import 'package:flutterfire_ui/src/auth/screens/internal/multi_provider_screen.d
import 'package:flutterfire_ui/src/auth/widgets/internal/rebuild_scope.dart';
import 'package:flutterfire_ui/src/auth/widgets/internal/subtitle.dart';
import 'package:flutterfire_ui/src/auth/widgets/internal/universal_icon_button.dart';
import 'package:ruswipeshare/credit_view.dart';
class EditButton extends StatelessWidget {
final bool isEditing;
@@ -250,6 +253,13 @@ class ProfileScreenCustom extends MultiProviderScreen {
],
...children,
const SizedBox(height: 300),
TextButton(
style: ButtonStyle(
foregroundColor: MaterialStateProperty.all<Color>(Colors.red),
),
onPressed: () {Navigator.push(context, MaterialPageRoute(builder: (context)=> CreditView())); },
child: Text('Setup Seller'),
),
Align(
alignment: Alignment.bottomCenter,
child: SignOutButton(

View File

@@ -33,10 +33,6 @@ class _SellScreenState extends State<SellScreen> {
Widget build(BuildContext context) {
bool is24HoursFormat = MediaQuery.of(context).alwaysUse24HourFormat;
return Scaffold(
appBar: AppBar(
title: const Text('Sell'),
automaticallyImplyLeading: false,
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [

View File

@@ -259,6 +259,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_stripe:
dependency: "direct main"
description:
name: flutter_stripe
sha256: "00e612c11ea57f9b78510e5b2aa8719022698bd8a023140e9b7f52c1dfa2e27d"
url: "https://pub.dev"
source: hosted
version: "8.0.0+1"
flutter_svg:
dependency: transitive
description:
@@ -285,6 +293,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.3+20"
freezed_annotation:
dependency: transitive
description:
name: freezed_annotation
sha256: aeac15850ef1b38ee368d4c53ba9a847e900bb2c53a4db3f6881cbb3cb684338
url: "https://pub.dev"
source: hosted
version: "2.2.0"
geolocator:
dependency: "direct main"
description:
@@ -405,6 +421,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.6.5"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317
url: "https://pub.dev"
source: hosted
version: "4.8.0"
lints:
dependency: transitive
description:
@@ -554,6 +578,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
stripe_android:
dependency: transitive
description:
name: stripe_android
sha256: "3cf43dfb70d8011ded0730c091e741b94cd4aaccaad22732a19f5941503072d6"
url: "https://pub.dev"
source: hosted
version: "8.0.0+1"
stripe_ios:
dependency: transitive
description:
name: stripe_ios
sha256: b3da653013be8aada352b158439024963a0d5dc0648524127d3ef4fd6b0a0cc7
url: "https://pub.dev"
source: hosted
version: "8.0.0"
stripe_platform_interface:
dependency: transitive
description:
name: stripe_platform_interface
sha256: "28c409b0c0e98115c4ab38a9a34a883010811036e6d9fa8d495f67c3ba01c034"
url: "https://pub.dev"
source: hosted
version: "8.0.0"
term_glyph:
dependency: transitive
description:

View File

@@ -42,6 +42,7 @@ dependencies:
persistent_bottom_nav_bar: any
geolocator: ^9.0.2
flutter_credit_card: any
flutter_stripe: any
dev_dependencies:
flutter_test: