mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-11-26 11:34:55 +00:00
formatted all files.
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/routines/create_new_routines/dropdown_menu_content.dart';
|
||||
import 'package:syncrow_web/pages/routines/create_new_routines/space_tree_dropdown_bloc.dart';
|
||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_state.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
import 'space_tree_dropdown_bloc.dart';
|
||||
|
||||
class SpaceTreeDropdown extends StatefulWidget {
|
||||
final String? selectedSpaceId;
|
||||
@ -68,7 +68,7 @@ class _SpaceTreeDropdownState extends State<SpaceTreeDropdown> {
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Text(
|
||||
"Community",
|
||||
'Community',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_event.dart';
|
||||
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_state.dart';
|
||||
import 'package:syncrow_web/pages/routines/bloc/create_routine_bloc/create_routine_bloc.dart';
|
||||
import 'package:syncrow_web/pages/routines/create_new_routines/commu_dropdown.dart';
|
||||
import 'package:syncrow_web/pages/routines/create_new_routines/space_dropdown.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
@ -27,11 +27,11 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
|
||||
CreateRoutineBloc()..add(const FetchCommunityEvent()),
|
||||
child: BlocBuilder<CreateRoutineBloc, CreateRoutineState>(
|
||||
builder: (context, state) {
|
||||
final _bloc = BlocProvider.of<CreateRoutineBloc>(context);
|
||||
final spaces = _bloc.spacesOnlyWithDevices;
|
||||
final bloc = BlocProvider.of<CreateRoutineBloc>(context);
|
||||
final spaces = bloc.spacesOnlyWithDevices;
|
||||
final isLoadingCommunities = state is CommunitiesLoadingState;
|
||||
final isLoadingSpaces = state is SpaceWithDeviceLoadingState;
|
||||
String spaceHint = 'Please Select';
|
||||
var spaceHint = 'Please Select';
|
||||
if (_selectedCommunity != null) {
|
||||
if (isLoadingSpaces) {
|
||||
spaceHint = 'Loading spaces...';
|
||||
@ -77,9 +77,9 @@ class _CreateNewRoutinesDialogState extends State<CreateNewRoutinesDialog> {
|
||||
SpaceTreeDropdown(
|
||||
selectedSpaceId: _selectedId,
|
||||
onChanged: (String? newValue) {
|
||||
setState(() => _selectedId = newValue!);
|
||||
setState(() => _selectedId = newValue);
|
||||
if (_selectedId != null) {
|
||||
_bloc.add(SpaceOnlyWithDevicesEvent(
|
||||
bloc.add(SpaceOnlyWithDevicesEvent(
|
||||
_selectedId!));
|
||||
}
|
||||
},
|
||||
|
||||
@ -1,7 +1,3 @@
|
||||
|
||||
|
||||
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||
@ -14,6 +10,7 @@ class DropdownMenuContent extends StatefulWidget {
|
||||
final VoidCallback onClose;
|
||||
|
||||
const DropdownMenuContent({
|
||||
super.key,
|
||||
required this.selectedSpaceId,
|
||||
required this.onChanged,
|
||||
required this.onClose,
|
||||
@ -45,7 +42,7 @@ class _DropdownMenuContentState extends State<DropdownMenuContent> {
|
||||
final state = bloc.state;
|
||||
if (_scrollController.position.pixels >=
|
||||
_scrollController.position.maxScrollExtent - 30) {
|
||||
if (state is SpaceTreeState && !state.paginationIsLoading) {
|
||||
if (!state.paginationIsLoading) {
|
||||
bloc.add(PaginationEvent(state.paginationModel, state.communityList));
|
||||
}
|
||||
}
|
||||
@ -126,7 +123,7 @@ class _DropdownMenuContentState extends State<DropdownMenuContent> {
|
||||
_searchController.text.isEmpty
|
||||
? context
|
||||
.read<SpaceTreeBloc>()
|
||||
.add(SearchQueryEvent(''))
|
||||
.add(const SearchQueryEvent(''))
|
||||
: context.read<SpaceTreeBloc>().add(
|
||||
SearchQueryEvent(_searchController.text));
|
||||
});
|
||||
|
||||
@ -10,12 +10,12 @@ class SpaceDropdown extends StatelessWidget {
|
||||
final String hintMessage;
|
||||
|
||||
const SpaceDropdown({
|
||||
Key? key,
|
||||
super.key,
|
||||
required this.spaces,
|
||||
required this.selectedValue,
|
||||
required this.onChanged,
|
||||
required this.hintMessage,
|
||||
}) : super(key: key);
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -25,7 +25,7 @@ class SpaceDropdown extends StatelessWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
"Space",
|
||||
'Space',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(
|
||||
fontWeight: FontWeight.w400,
|
||||
fontSize: 13,
|
||||
@ -67,7 +67,7 @@ class SpaceDropdown extends StatelessWidget {
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: onChanged,
|
||||
style: TextStyle(color: Colors.black),
|
||||
style: const TextStyle(color: Colors.black),
|
||||
hint: Padding(
|
||||
padding: const EdgeInsets.only(left: 10),
|
||||
child: Text(
|
||||
|
||||
@ -24,4 +24,4 @@ class SpaceTreeDropdownBloc
|
||||
) {
|
||||
emit(SpaceTreeDropdownState(selectedSpaceId: event.initialId));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -12,4 +12,4 @@ class SpaceTreeDropdownResetEvent extends SpaceTreeDropdownEvent {
|
||||
final String? initialId;
|
||||
|
||||
SpaceTreeDropdownResetEvent(this.initialId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,4 +4,4 @@ class SpaceTreeDropdownState {
|
||||
final String? selectedSpaceId;
|
||||
|
||||
SpaceTreeDropdownState({this.selectedSpaceId});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user