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:ruswipeshare/main.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'meetings.dart';
|
||||
|
||||
enum CampusState { campuses, list_options, offers }
|
||||
|
||||
@@ -64,6 +67,8 @@ class BuyScreen extends StatefulWidget {
|
||||
class _BuyScreenState extends State<BuyScreen> {
|
||||
CampusState _currentState = CampusState.campuses;
|
||||
List<String> _diningOptions = List.empty();
|
||||
List<Seller> _sellersAtDiningHall = [];
|
||||
|
||||
String _selectedLocation = "";
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -348,6 +353,29 @@ class _BuyScreenState extends State<BuyScreen> {
|
||||
itemCount: 30,
|
||||
padding: EdgeInsets.fromLTRB(10, 0, 10, 0),
|
||||
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(
|
||||
onTap: () {
|
||||
showSheet(context, index);
|
||||
@@ -412,32 +440,36 @@ class _BuyScreenState extends State<BuyScreen> {
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border.all(
|
||||
color: CustomMaterialColor(240, 240, 240)
|
||||
color:
|
||||
CustomMaterialColor(240, 240, 240)
|
||||
.mdColor,
|
||||
width: 2),
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(10))),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10))),
|
||||
margin: const EdgeInsets.all(4),
|
||||
height: 120,
|
||||
child: ClipRRect(
|
||||
borderRadius:
|
||||
const BorderRadius.all(Radius.circular(10)),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10)),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
colorFilter: const ColorFilter.mode(
|
||||
Colors.black26, BlendMode.darken),
|
||||
fit: BoxFit.cover,
|
||||
image: AssetImage(timeBgAssets[index % 3]),
|
||||
image:
|
||||
AssetImage(timeBgAssets[index % 3]),
|
||||
)),
|
||||
child: BackdropFilter(
|
||||
filter: ImageFilter.blur(sigmaX: 2, sigmaY: 2),
|
||||
filter: ImageFilter.blur(
|
||||
sigmaX: 2, sigmaY: 2),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 7,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 20),
|
||||
padding:
|
||||
EdgeInsets.only(left: 20),
|
||||
// color: Colors.red,
|
||||
margin: const EdgeInsets.only(
|
||||
top: 4, left: 4, bottom: 4),
|
||||
@@ -446,18 +478,25 @@ class _BuyScreenState extends State<BuyScreen> {
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
entries[index % entries.length],
|
||||
data?[index % data.length]
|
||||
.name ??
|
||||
"Unknown Seller",
|
||||
textAlign: TextAlign.start,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style:
|
||||
const TextStyle(fontSize: 20),
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
style: const TextStyle(
|
||||
fontSize: 20),
|
||||
),
|
||||
Row(
|
||||
children: const [
|
||||
Icon(Icons.star, size: 16),
|
||||
Icon(Icons.star, size: 16),
|
||||
Icon(Icons.star, size: 16),
|
||||
Icon(Icons.star_half, size: 16),
|
||||
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),
|
||||
],
|
||||
@@ -466,14 +505,15 @@ class _BuyScreenState extends State<BuyScreen> {
|
||||
child: Column(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.end,
|
||||
children: const [
|
||||
children: [
|
||||
Text(
|
||||
'88:88PM - 88:88PM',
|
||||
textAlign: TextAlign.start,
|
||||
overflow:
|
||||
TextOverflow.ellipsis,
|
||||
style:
|
||||
TextStyle(fontSize: 16),
|
||||
"$startTimeFmt - $endTimeFmt",
|
||||
textAlign:
|
||||
TextAlign.start,
|
||||
overflow: TextOverflow
|
||||
.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 16),
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -485,9 +525,10 @@ class _BuyScreenState extends State<BuyScreen> {
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(right: 15),
|
||||
padding:
|
||||
EdgeInsets.only(right: 15),
|
||||
child: Text(
|
||||
'\$88',
|
||||
'\$${price}',
|
||||
textAlign: TextAlign.end,
|
||||
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