Fixed some weird scrolling stuff, buy nav done

This commit is contained in:
NATHANIEL ENDICK
2023-02-26 04:11:08 -05:00
parent b239ae92f2
commit 5e63eaf84c

View File

@@ -16,19 +16,7 @@ class BuyScreen extends StatefulWidget {
class _BuyScreenState extends State<BuyScreen> { class _BuyScreenState extends State<BuyScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
TimeOfDay _time = TimeOfDay.now(); return ContentDisplay();
return Scaffold(
body: Column(
children: [
Container(
width: double.infinity,
child: ElevatedButton(
onPressed: () {}, child: Text("Choose A Different Location")),
),
const Expanded(child: ContentDisplay()),
],
),
);
} }
} }
@@ -173,255 +161,308 @@ class ContentDisplay extends StatefulWidget {
class _CampusGridViewState extends State<ContentDisplay> { class _CampusGridViewState extends State<ContentDisplay> {
CampusState _currentState = CampusState.campuses; CampusState _currentState = CampusState.campuses;
List<String> _diningOptions = List.empty(); List<String> _diningOptions = List.empty();
String selectedLocation = ""; String _selectedLocation = "";
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
switch (_currentState) { switch (_currentState) {
case CampusState.campuses: case CampusState.campuses:
return Center( return Scaffold(
child: GridView.count( body: Column(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
crossAxisCount: 2,
crossAxisSpacing: 15,
childAspectRatio: 1,
mainAxisSpacing: 15,
padding: EdgeInsets.all(10),
children: [ children: [
InkWell( Expanded(
onTap: () { child: Center(
setState(() { child: GridView.count(
_currentState = CampusState.list_options; shrinkWrap: true,
_diningOptions = eatingLocations[3]; physics: NeverScrollableScrollPhysics(),
}); crossAxisCount: 2,
}, crossAxisSpacing: 15,
child: ClipRRect( childAspectRatio: 1,
borderRadius: BorderRadius.all(Radius.circular(25)), mainAxisSpacing: 15,
child: Column( padding: EdgeInsets.all(10),
children: [
Expanded(
child: Image.asset(
'assets/ca_bg.jpg',
fit: BoxFit.cover,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.red,
child: Text(
"College Avenue",
textAlign: TextAlign.center,
),
),
],
),
),
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
children: [ children: [
Expanded( InkWell(
child: Image.asset( onTap: () {
'assets/busch_bg.jpg', setState(() {
fit: BoxFit.cover, _currentState = CampusState.list_options;
), _diningOptions = eatingLocations[3];
), });
Container( },
width: double.infinity, child: ClipRRect(
padding: EdgeInsets.all(8), borderRadius: BorderRadius.all(Radius.circular(25)),
color: Colors.green,
child: Text(
"Busch",
textAlign: TextAlign.center,
),
),
],
),
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
children: [
Expanded(
child: Image.asset(
'assets/livi_bg.jpg',
fit: BoxFit.cover,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.blue,
child: Text(
"Livingston",
textAlign: TextAlign.center,
),
),
],
),
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
children: [
Expanded(
child: Image.asset(
'assets/cd_bg.jpg',
fit: BoxFit.cover,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.yellow,
child: Text(
"Cook-Douglass",
textAlign: TextAlign.center,
),
),
],
),
),
],
),
);
case CampusState.list_options:
return ListView.builder(
itemCount: _diningOptions.length,
padding: EdgeInsets.zero,
itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
setState(() {
_currentState = CampusState.offers;
selectedLocation = _diningOptions.elementAt(index);
});
},
child: Container(
height: 80,
color: Colors.blue,
margin: const EdgeInsets.only(bottom: 4),
child: Row(
children: [
Container(
color: Colors.red,
margin: EdgeInsets.only(top: 4, left: 4, bottom: 4),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Expanded(
_diningOptions[index], child: Image.asset(
textAlign: TextAlign.start, 'assets/ca_bg.jpg',
overflow: TextOverflow.ellipsis, fit: BoxFit.cover,
style: const TextStyle(fontSize: 24), ),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.red,
child: Text(
"College Avenue",
textAlign: TextAlign.center,
),
), ),
], ],
), ),
), ),
], ),
), ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
children: [
Expanded(
child: Image.asset(
'assets/busch_bg.jpg',
fit: BoxFit.cover,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.green,
child: Text(
"Busch",
textAlign: TextAlign.center,
),
),
],
),
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
children: [
Expanded(
child: Image.asset(
'assets/livi_bg.jpg',
fit: BoxFit.cover,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.blue,
child: Text(
"Livingston",
textAlign: TextAlign.center,
),
),
],
),
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
children: [
Expanded(
child: Image.asset(
'assets/cd_bg.jpg',
fit: BoxFit.cover,
),
),
Container(
width: double.infinity,
padding: EdgeInsets.all(8),
color: Colors.yellow,
child: Text(
"Cook-Douglass",
textAlign: TextAlign.center,
),
),
],
),
),
],
), ),
); )),
}); ],
),
case CampusState.offers: );
return ListView.builder( case CampusState.list_options:
itemCount: 30, return Scaffold(
padding: EdgeInsets.zero, body: Column(
itemBuilder: (BuildContext context, int index) { children: [
return InkWell( Container(
onTap: () { width: double.infinity,
Dialogs.materialDialog( child: ElevatedButton(
color: Colors.white, onPressed: () {
customView: TransactionDetails(), setState(() {
customViewPosition: CustomViewPosition.BEFORE_ACTION, _currentState = CampusState.campuses;
msg: });
'Please read all the information below before purchasing.', },
title: 'Transaction Details', child: Text("Choose A Different Location")),
context: context, ),
actions: [ Expanded(
IconsOutlineButton( child: ListView.builder(
onPressed: () {}, physics: BouncingScrollPhysics(),
text: 'Cancel', itemCount: _diningOptions.length,
iconData: Icons.cancel_outlined, padding: EdgeInsets.zero,
textStyle: TextStyle(color: Colors.grey), itemBuilder: (BuildContext context, int index) {
iconColor: Colors.grey, return InkWell(
onTap: () {
setState(() {
_currentState = CampusState.offers;
_selectedLocation = _diningOptions.elementAt(index);
});
},
child: Container(
height: 80,
color: Colors.blue,
margin: const EdgeInsets.only(bottom: 4),
child: Row(
children: [
Container(
color: Colors.red,
margin: EdgeInsets.only(top: 4, left: 4, bottom: 4),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_diningOptions[index],
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 24),
),
],
),
),
],
), ),
IconsButton( ),
onPressed: () {},
text: 'Purchase',
iconData: Icons.done,
color: Colors.blue,
textStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
),
],
); );
}, },
child: Container( ),
height: 80, ),
color: Colors.blue, ],
margin: const EdgeInsets.only(bottom: 4), ));
child: Row( case CampusState.offers:
children: [ return Column(
Expanded( children: [
flex: 7, Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
child: Container( Flexible(
color: Colors.red, flex: 8,
margin: EdgeInsets.only(top: 4, left: 4, bottom: 4), fit: FlexFit.tight,
child: Column( child: ElevatedButton(
crossAxisAlignment: CrossAxisAlignment.start, onPressed: () {
children: [ setState(() {
Text( _currentState = CampusState.campuses;
entries[index % entries.length], });
textAlign: TextAlign.start, },
overflow: TextOverflow.ellipsis, child: const Text("Choose A Different Location")),
style: const TextStyle(fontSize: 24), ),
), Flexible(
Row( flex: 2,
children: const [ child: ElevatedButton(
Icon(Icons.star, size: 16), onPressed: () {}, child: const Icon(Icons.filter_list)))
Icon(Icons.star, size: 16), ]),
Icon(Icons.star, size: 16), Expanded(
Icon(Icons.star_half, size: 16), child: ListView.builder(
Icon(Icons.star_border, size: 16), physics: BouncingScrollPhysics(),
], itemCount: 30,
), padding: EdgeInsets.zero,
Expanded( itemBuilder: (BuildContext context, int index) {
return InkWell(
onTap: () {
Dialogs.materialDialog(
color: Colors.white,
customView: TransactionDetails(),
customViewPosition: CustomViewPosition.BEFORE_ACTION,
msg:
'Please read all the information below before purchasing.',
title: 'Transaction Details',
context: context,
actions: [
IconsOutlineButton(
onPressed: () {},
text: 'Cancel',
iconData: Icons.cancel_outlined,
textStyle: TextStyle(color: Colors.grey),
iconColor: Colors.grey,
),
IconsButton(
onPressed: () {},
text: 'Purchase',
iconData: Icons.done,
color: Colors.blue,
textStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
),
],
);
},
child: Container(
height: 80,
color: Colors.blue,
margin: const EdgeInsets.only(bottom: 4),
child: Row(
children: [
Expanded(
flex: 7,
child: Container(
color: Colors.red,
margin:
EdgeInsets.only(top: 4, left: 4, bottom: 4),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start,
children: const [ children: [
Text( Text(
'88:88PM - 88:88PM', entries[index % entries.length] +
" " +
_selectedLocation,
textAlign: TextAlign.start, textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 16), style: const TextStyle(fontSize: 24),
), ),
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_border, size: 16),
],
),
Expanded(
child: Column(
mainAxisAlignment:
MainAxisAlignment.end,
children: const [
Text(
'88:88PM - 88:88PM',
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 16),
),
],
),
)
], ],
), ),
) ),
], ),
), Expanded(
flex: 3,
child: Container(
color: Colors.orange,
child: const Text(
'\$88',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 44),
),
),
)
],
), ),
), ),
Expanded( );
flex: 3, }),
child: Container( ),
color: Colors.orange, ],
child: const Text( );
'\$88',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 44),
),
),
)
],
),
),
);
});
} }
} }
} }