mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
Refactor HomeBloc and GarageDoorBloc event handling; update CreateNewRoutinesDialog to use SpaceTreeDropdown; add settings button SVG.
This commit is contained in:
@ -18,6 +18,7 @@ class CreateNewRoutinesDialog extends StatefulWidget {
|
||||
class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
|
||||
String? _selectedCommunity;
|
||||
String? _selectedSpace;
|
||||
String? _selectedId;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -40,7 +41,10 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
|
||||
spaceHint = 'Select Space';
|
||||
}
|
||||
}
|
||||
|
||||
if (_selectedId != null && _selectedCommunity != _selectedId) {
|
||||
_selectedSpace = null;
|
||||
_selectedCommunity = _selectedId;
|
||||
}
|
||||
return AlertDialog(
|
||||
backgroundColor: Colors.white,
|
||||
insetPadding: EdgeInsets.zero,
|
||||
@ -61,25 +65,17 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
|
||||
children: [
|
||||
const Divider(),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
child: CommunityDropdown(
|
||||
communities: _bloc.communities..sort(
|
||||
(a, b) => a.name.toLowerCase().compareTo(
|
||||
b.name.toLowerCase(),
|
||||
),
|
||||
),
|
||||
selectedValue: _selectedCommunity,
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
_selectedCommunity = newValue;
|
||||
_selectedSpace = null;
|
||||
});
|
||||
if (newValue != null) {
|
||||
_bloc.add(SpaceOnlyWithDevicesEvent(newValue));
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
child: SpaceTreeDropdown(
|
||||
selectedSpaceId: _selectedId,
|
||||
onChanged: (String? newValue) {
|
||||
setState(() => _selectedId = newValue!);
|
||||
if (_selectedId != null) {
|
||||
_bloc.add(
|
||||
SpaceOnlyWithDevicesEvent(_selectedId!));
|
||||
}
|
||||
},
|
||||
)),
|
||||
const SizedBox(height: 5),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 15, right: 15),
|
||||
|
Reference in New Issue
Block a user