mirror of
https://github.com/SoPat712/RUSwipeShare.git
synced 2025-08-21 19:08:46 -04:00
holy fuck its future
This commit is contained in:
97
lib/buy.dart
97
lib/buy.dart
@@ -2,6 +2,9 @@ import 'dart:ui';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:ruswipeshare/main.dart';
|
import 'package:ruswipeshare/main.dart';
|
||||||
|
import 'package:intl/intl.dart';
|
||||||
|
|
||||||
|
import 'meetings.dart';
|
||||||
|
|
||||||
enum CampusState { campuses, list_options, offers }
|
enum CampusState { campuses, list_options, offers }
|
||||||
|
|
||||||
@@ -64,6 +67,8 @@ class BuyScreen extends StatefulWidget {
|
|||||||
class _BuyScreenState extends State<BuyScreen> {
|
class _BuyScreenState extends State<BuyScreen> {
|
||||||
CampusState _currentState = CampusState.campuses;
|
CampusState _currentState = CampusState.campuses;
|
||||||
List<String> _diningOptions = List.empty();
|
List<String> _diningOptions = List.empty();
|
||||||
|
List<Seller> _sellersAtDiningHall = [];
|
||||||
|
|
||||||
String _selectedLocation = "";
|
String _selectedLocation = "";
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -348,6 +353,29 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
itemCount: 30,
|
itemCount: 30,
|
||||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
|
List<Seller> sellers = [];
|
||||||
|
var loc = _diningOptions[index % _diningOptions.length];
|
||||||
|
|
||||||
|
return FutureBuilder<List<Seller>>(
|
||||||
|
future: getSellers(Filter([loc], null, null)),
|
||||||
|
builder: (BuildContext context,
|
||||||
|
AsyncSnapshot<List<Seller>> snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
final data = snapshot.data ?? [];
|
||||||
|
String startTimeFmt = DateFormat("h:mm a").format(
|
||||||
|
data[index % data.length]
|
||||||
|
.availableTime
|
||||||
|
.startTime
|
||||||
|
.toDate());
|
||||||
|
|
||||||
|
String endTimeFmt = DateFormat("h:mm a").format(
|
||||||
|
data[index % data.length]
|
||||||
|
.availableTime
|
||||||
|
.endTime
|
||||||
|
.toDate());
|
||||||
|
|
||||||
|
final price = data[index % data.length].price;
|
||||||
|
|
||||||
return InkWell(
|
return InkWell(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
showSheet(context, index);
|
showSheet(context, index);
|
||||||
@@ -412,32 +440,36 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
border: Border.all(
|
border: Border.all(
|
||||||
color: CustomMaterialColor(240, 240, 240)
|
color:
|
||||||
|
CustomMaterialColor(240, 240, 240)
|
||||||
.mdColor,
|
.mdColor,
|
||||||
width: 2),
|
width: 2),
|
||||||
borderRadius:
|
borderRadius: const BorderRadius.all(
|
||||||
const BorderRadius.all(Radius.circular(10))),
|
Radius.circular(10))),
|
||||||
margin: const EdgeInsets.all(4),
|
margin: const EdgeInsets.all(4),
|
||||||
height: 120,
|
height: 120,
|
||||||
child: ClipRRect(
|
child: ClipRRect(
|
||||||
borderRadius:
|
borderRadius: const BorderRadius.all(
|
||||||
const BorderRadius.all(Radius.circular(10)),
|
Radius.circular(10)),
|
||||||
child: Container(
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
colorFilter: const ColorFilter.mode(
|
colorFilter: const ColorFilter.mode(
|
||||||
Colors.black26, BlendMode.darken),
|
Colors.black26, BlendMode.darken),
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
image: AssetImage(timeBgAssets[index % 3]),
|
image:
|
||||||
|
AssetImage(timeBgAssets[index % 3]),
|
||||||
)),
|
)),
|
||||||
child: BackdropFilter(
|
child: BackdropFilter(
|
||||||
filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
|
filter: ImageFilter.blur(
|
||||||
|
sigmaX: 2, sigmaY: 2),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 7,
|
flex: 7,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 20),
|
padding:
|
||||||
|
EdgeInsets.only(left: 20),
|
||||||
// color: Colors.red,
|
// color: Colors.red,
|
||||||
margin: const EdgeInsets.only(
|
margin: const EdgeInsets.only(
|
||||||
top: 4, left: 4, bottom: 4),
|
top: 4, left: 4, bottom: 4),
|
||||||
@@ -446,18 +478,25 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
entries[index % entries.length],
|
data?[index % data.length]
|
||||||
|
.name ??
|
||||||
|
"Unknown Seller",
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow:
|
||||||
style:
|
TextOverflow.ellipsis,
|
||||||
const TextStyle(fontSize: 20),
|
style: const TextStyle(
|
||||||
|
fontSize: 20),
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: const [
|
children: const [
|
||||||
Icon(Icons.star, size: 16),
|
Icon(Icons.star,
|
||||||
Icon(Icons.star, size: 16),
|
size: 16),
|
||||||
Icon(Icons.star, size: 16),
|
Icon(Icons.star,
|
||||||
Icon(Icons.star_half, size: 16),
|
size: 16),
|
||||||
|
Icon(Icons.star,
|
||||||
|
size: 16),
|
||||||
|
Icon(Icons.star_half,
|
||||||
|
size: 16),
|
||||||
Icon(Icons.star_border,
|
Icon(Icons.star_border,
|
||||||
size: 16),
|
size: 16),
|
||||||
],
|
],
|
||||||
@@ -466,14 +505,15 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.end,
|
MainAxisAlignment.end,
|
||||||
children: const [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'88:88PM - 88:88PM',
|
"$startTimeFmt - $endTimeFmt",
|
||||||
textAlign: TextAlign.start,
|
textAlign:
|
||||||
overflow:
|
TextAlign.start,
|
||||||
TextOverflow.ellipsis,
|
overflow: TextOverflow
|
||||||
style:
|
.ellipsis,
|
||||||
TextStyle(fontSize: 16),
|
style: TextStyle(
|
||||||
|
fontSize: 16),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -485,9 +525,10 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
flex: 3,
|
flex: 3,
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: EdgeInsets.only(right: 15),
|
padding:
|
||||||
|
EdgeInsets.only(right: 15),
|
||||||
child: Text(
|
child: Text(
|
||||||
'\$88',
|
'\$${price}',
|
||||||
textAlign: TextAlign.end,
|
textAlign: TextAlign.end,
|
||||||
style: TextStyle(fontSize: 44),
|
style: TextStyle(fontSize: 44),
|
||||||
),
|
),
|
||||||
@@ -500,6 +541,12 @@ class _BuyScreenState extends State<BuyScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text("${snapshot.error}");
|
||||||
|
}
|
||||||
|
return CircularProgressIndicator();
|
||||||
|
},
|
||||||
|
);
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user