// ignore_for_file: prefer_const_constructors import 'package:flutter/material.dart'; import 'package:ruswipeshare/meetings.dart'; class SellScreen extends StatefulWidget { const SellScreen({Key? key}) : super(key: key); @override _SellScreenState createState() => _SellScreenState(); } Map values = { 'Brower Dining Hall': false, 'Cafe West': false, 'Livingston Dining Hall': false, 'Kilmer\'s Market': false, 'Sbarro\'s': false, 'Neilson Dining Hall': false, 'Cook Cafe': false, 'Douglass Cafe': false, 'Harvest INFH': false, 'Red Pine Pizza': false, }; class _SellScreenState extends State { String startTime = 'Start Time'; DateTime startTimeTime = DateTime.now(); String endTime = 'End Time'; DateTime endTimeTime = DateTime.now(); bool? is24HoursFormat; @override Widget build(BuildContext context) { bool is24HoursFormat = MediaQuery.of(context).alwaysUse24HourFormat; return Scaffold( body: Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.store_mall_directory, color: Colors.red), Text('Place'), ], ), ConstrainedBox( constraints: const BoxConstraints.expand(height: 250), child: ListView.builder( itemCount: values.length, itemBuilder: (context, index) => CheckboxListTile( title: Text(values.keys.elementAt(index)), value: values.values.elementAt(index), onChanged: (bool? value) { setState(() { values[values.keys.elementAt(index)] = value!; }); }, ), ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.access_time, color: Colors.red), Text('Time'), ], ), SizedBox( height: 100, child: Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ Text( startTime, style: TextStyle(fontSize: 35), ), Text( "to", style: TextStyle(fontSize: 20), ), Text( endTime, style: TextStyle(fontSize: 35), ), ], ), ), Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ ElevatedButton( onPressed: () async { final TimeOfDay? picked = await showTimePicker( context: context, initialTime: TimeOfDay.fromDateTime(startTimeTime), ); if (picked != null && picked != TimeOfDay.fromDateTime(startTimeTime)) { setState(() { startTimeTime = DateTime.fromMicrosecondsSinceEpoch(picked.hour * 60 * 60 * 1000000 + picked.minute * 60 * 1000000, isUtc: true); startTime = startTimeTime.hour.toString() + ":" + startTimeTime.minute.toString() + ((is24HoursFormat) ? "" : ((startTimeTime.hour > 12) ? "PM" : "AM")); }); } }, child: const Text('Select Start Time'), ), ElevatedButton( onPressed: () async { final TimeOfDay? picked = await showTimePicker( context: context, initialTime: TimeOfDay.fromDateTime(endTimeTime), ); if (picked != null && picked != TimeOfDay.fromDateTime(endTimeTime)) { setState(() { endTimeTime = DateTime.fromMicrosecondsSinceEpoch(picked.hour * 60 * 60 * 1000000 + picked.minute * 60 * 1000000, isUtc: true); endTime = endTimeTime.hour.toString() + ":" + endTimeTime.minute.toString() + ((is24HoursFormat) ? "" : ((endTimeTime.hour > 12) ? "PM" : "AM")); }); } }, child: const Text('Select End Time'), ), ], ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.attach_money, color: Colors.red), Text('Cost'), ], ), //make a row with a text selector for min and max swipe cost Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: const [ SizedBox( width: 150, child: TextField( decoration: InputDecoration( border: OutlineInputBorder(), hintText: 'Min price', ), ), ), SizedBox( width: 150, child: TextField( decoration: InputDecoration( border: OutlineInputBorder(), hintText: 'Max price', ), ), ), ], ), ElevatedButton( onPressed: () {}, style: ButtonStyle( backgroundColor: MaterialStateColor.resolveWith((states) => Colors.blue), ), child: const Text('Next'), ), ], ), ); } } class LocationDropdown extends StatefulWidget { const LocationDropdown({super.key}); @override State createState() => _LocationDropdownState(); } const List list = [ 'Busch', 'College Ave', 'Cook/Doug', 'Livingston', ]; class _LocationDropdownState extends State { String dropdownValue = 'Busch'; @override Widget build(BuildContext context) { return DropdownButton( value: dropdownValue, onChanged: (String? value) { // This is called when the user selects an item. setState(() { dropdownValue = value!; }); }, items: list.map>((String value) { return DropdownMenuItem( value: value, child: Text(value), ); }).toList(), ); } }