From 8f2727d93450a13b9275aa1a223883d88f89705f Mon Sep 17 00:00:00 2001 From: NATHANIEL ENDICK Date: Sat, 25 Feb 2023 22:33:07 -0500 Subject: [PATCH 1/2] Buy menu basic list setup --- lib/buy.dart | 43 +++++++++++++++++++++++++++++++++++++++++++ lib/home.dart | 3 ++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 lib/buy.dart diff --git a/lib/buy.dart b/lib/buy.dart new file mode 100644 index 0000000..ddc2963 --- /dev/null +++ b/lib/buy.dart @@ -0,0 +1,43 @@ +import 'package:flutter/material.dart'; + +class BuyScreen extends StatefulWidget { + const BuyScreen({Key? key}) : super(key: key); + + @override + _BuyScreenState createState() => _BuyScreenState(); +} + +class _BuyScreenState extends State { + @override + Widget build(BuildContext context) { + TimeOfDay _time = TimeOfDay.now(); + return Scaffold( + appBar: AppBar( + title: const Text('Sell'), + automaticallyImplyLeading: false, + ), + body: OffersListView(), + ); + } +} + +final List entries = ['A', 'B', 'C']; +final List colorCodes = [600, 500, 100]; + +class OffersListView extends StatelessWidget { + const OffersListView({super.key}); + + @override + Widget build(BuildContext context) { + return ListView.builder( + padding: const EdgeInsets.all(8), + itemCount: 30, + itemBuilder: (BuildContext context, int index) { + return Container( + height: 80, + color: Colors.amber[colorCodes[index % 3]], + child: Center(child: Text('Entry ${entries[index % 3]}')), + ); + }); + } +} diff --git a/lib/home.dart b/lib/home.dart index 90c4dd4..6bfee45 100644 --- a/lib/home.dart +++ b/lib/home.dart @@ -1,5 +1,6 @@ import 'package:flutter/material.dart'; import 'package:persistent_bottom_nav_bar/persistent_tab_view.dart'; +import 'package:ruswipeshare/buy.dart'; import 'package:ruswipeshare/sell.dart'; import 'profile_screen_custom.dart'; import 'main_screen.dart'; @@ -20,7 +21,7 @@ class _HomeScreenState extends State { } List _buildScreens() => [ - const MainScreen(), + const BuyScreen(), const SellScreen(), const ProfileScreenCustom(), const MainScreen(), From 3774d3cf3101a56d62c6d33ec7ee32a1a5609398 Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Sat, 25 Feb 2023 22:37:56 -0500 Subject: [PATCH 2/2] sell fixes --- lib/sell.dart | 66 +++++++++++++++++++++++++++++++++++---------------- 1 file changed, 46 insertions(+), 20 deletions(-) diff --git a/lib/sell.dart b/lib/sell.dart index f28b608..3734616 100644 --- a/lib/sell.dart +++ b/lib/sell.dart @@ -8,9 +8,25 @@ class SellScreen extends StatefulWidget { } class _SellScreenState extends State { + Map values = { + 'Busch Dining Hall': false, + 'Livingston Dining Hall': false, + 'Brower Dining Hall': false, + 'Neilson Dining Hall': false, + 'Cafe West': false, + 'Cook Cafe': false, + 'Douglass Cafe': false, + 'Harvest INFH': false, + 'Kilmer\'s Market': false, + 'College Ave Dining Hall': false, + 'Red Pine Pizza': false, + 'Rock Cafe': false, + 'Sbarro': false, + 'Woody\'s Cafe': false, + }; @override Widget build(BuildContext context) { - TimeOfDay _time = TimeOfDay.now(); + TimeOfDay time = TimeOfDay.now(); return Scaffold( appBar: AppBar( title: const Text('Sell'), @@ -21,24 +37,40 @@ class _SellScreenState extends State { children: [ Icon(Icons.store_mall_directory, color: Colors.red), const Text('Place'), - ListTile( - title: Text(_time.format(context)), - onTap: () { - Future selectedTime = showTimePicker( - context: context, - initialTime: _time, - ); - setState(() { - selectedTime.then((value) => _time = value!); - _time = TimeOfDay(hour: 10, minute: 00); - }); - }, + ConstrainedBox( + constraints: BoxConstraints.expand(height: 100), + child: ListView( + children: values.keys.map((String key) { + return CheckboxListTile( + title: Text(key), + value: values[key], + onChanged: (bool? value) { + setState(() { + values[key] = value!; + }); + }, + ); + }).toList(), + ), ), LocationDropdown(), Icon(Icons.access_time, color: Colors.red), Expanded( child: const Text('Time'), ), + ListTile( + title: Text(time.format(context)), + onTap: () { + Future selectedTime = showTimePicker( + context: context, + initialTime: time, + ); + setState(() { + selectedTime.then((value) => time = value!); + time = TimeOfDay(hour: 10, minute: 00); + }); + }, + ), Icon(Icons.attach_money, color: Colors.red), Expanded( child: const Text('Cost'), @@ -49,13 +81,7 @@ class _SellScreenState extends State { } } -const List list = [ - 'Brower', - 'BDH', - 'LDH', - 'Neilson', - 'Woody\'s' -]; +const List list = ['Brower', 'BDH', 'LDH', 'Neilson', 'Woody\'s']; class LocationDropdown extends StatefulWidget { const LocationDropdown({super.key});