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> {
@override
Widget build(BuildContext context) {
TimeOfDay _time = TimeOfDay.now();
return Scaffold(
body: Column(
children: [
Container(
width: double.infinity,
child: ElevatedButton(
onPressed: () {}, child: Text("Choose A Different Location")),
),
const Expanded(child: ContentDisplay()),
],
),
);
return ContentDisplay();
}
}
@@ -173,255 +161,308 @@ class ContentDisplay extends StatefulWidget {
class _CampusGridViewState extends State<ContentDisplay> {
CampusState _currentState = CampusState.campuses;
List<String> _diningOptions = List.empty();
String selectedLocation = "";
String _selectedLocation = "";
@override
Widget build(BuildContext context) {
switch (_currentState) {
case CampusState.campuses:
return Center(
child: GridView.count(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
crossAxisCount: 2,
crossAxisSpacing: 15,
childAspectRatio: 1,
mainAxisSpacing: 15,
padding: EdgeInsets.all(10),
return Scaffold(
body: Column(
children: [
InkWell(
onTap: () {
setState(() {
_currentState = CampusState.list_options;
_diningOptions = eatingLocations[3];
});
},
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
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(
Expanded(
child: Center(
child: GridView.count(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
crossAxisCount: 2,
crossAxisSpacing: 15,
childAspectRatio: 1,
mainAxisSpacing: 15,
padding: EdgeInsets.all(10),
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.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),
InkWell(
onTap: () {
setState(() {
_currentState = CampusState.list_options;
_diningOptions = eatingLocations[3];
});
},
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_diningOptions[index],
textAlign: TextAlign.start,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 24),
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: [
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(
itemCount: 30,
padding: EdgeInsets.zero,
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,
)),
],
),
);
case CampusState.list_options:
return Scaffold(
body: Column(
children: [
Container(
width: double.infinity,
child: ElevatedButton(
onPressed: () {
setState(() {
_currentState = CampusState.campuses;
});
},
child: Text("Choose A Different Location")),
),
Expanded(
child: ListView.builder(
physics: BouncingScrollPhysics(),
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(
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(
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: 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(
),
),
],
));
case CampusState.offers:
return Column(
children: [
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
Flexible(
flex: 8,
fit: FlexFit.tight,
child: ElevatedButton(
onPressed: () {
setState(() {
_currentState = CampusState.campuses;
});
},
child: const Text("Choose A Different Location")),
),
Flexible(
flex: 2,
child: ElevatedButton(
onPressed: () {}, child: const Icon(Icons.filter_list)))
]),
Expanded(
child: ListView.builder(
physics: BouncingScrollPhysics(),
itemCount: 30,
padding: EdgeInsets.zero,
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(
mainAxisAlignment: MainAxisAlignment.end,
children: const [
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'88:88PM - 88:88PM',
entries[index % entries.length] +
" " +
_selectedLocation,
textAlign: TextAlign.start,
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),
),
),
)
],
),
),
);
});
);
}),
),
],
);
}
}
}