diff --git a/lib/sell.dart b/lib/sell.dart index 03211d7..f28b608 100644 --- a/lib/sell.dart +++ b/lib/sell.dart @@ -10,6 +10,7 @@ class SellScreen extends StatefulWidget { class _SellScreenState extends State { @override Widget build(BuildContext context) { + TimeOfDay _time = TimeOfDay.now(); return Scaffold( appBar: AppBar( title: const Text('Sell'), @@ -19,9 +20,21 @@ class _SellScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(Icons.store_mall_directory, color: Colors.red), - Expanded( - child: const Text('Place'), + 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); + }); + }, ), + LocationDropdown(), Icon(Icons.access_time, color: Colors.red), Expanded( child: const Text('Time'), @@ -35,3 +48,41 @@ class _SellScreenState extends State { ); } } + +const List list = [ + 'Brower', + 'BDH', + 'LDH', + 'Neilson', + 'Woody\'s' +]; + +class LocationDropdown extends StatefulWidget { + const LocationDropdown({super.key}); + + @override + State createState() => _LocationDropdownState(); +} + +class _LocationDropdownState extends State { + String dropdownValue = list.first; + + @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(), + ); + } +}