Added a background color for the space tree

This commit is contained in:
Abdullah Alassaf
2025-03-11 23:54:39 +03:00
parent dd01a7fddb
commit c806b5f59d

View File

@ -33,14 +33,12 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BlocBuilder<SpaceTreeBloc, SpaceTreeState>( return BlocBuilder<SpaceTreeBloc, SpaceTreeState>(builder: (context, state) {
builder: (context, state) { List<CommunityModel> list = state.isSearching ? state.filteredCommunity : state.communityList;
List<CommunityModel> list =
state.isSearching ? state.filteredCommunity : state.communityList;
return Container( return Container(
height: MediaQuery.sizeOf(context).height, height: MediaQuery.sizeOf(context).height,
decoration: color: ColorsManager.whiteColors,
widget.isSide == true ? subSectionContainerDecoration : null, decoration: widget.isSide == true ? subSectionContainerDecoration : null,
child: state is SpaceTreeLoadingState child: state is SpaceTreeLoadingState
? const Center(child: CircularProgressIndicator()) ? const Center(child: CircularProgressIndicator())
: Column( : Column(
@ -50,8 +48,7 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
decoration: const BoxDecoration( decoration: const BoxDecoration(
color: ColorsManager.circleRolesBackground, color: ColorsManager.circleRolesBackground,
borderRadius: BorderRadius.only( borderRadius: BorderRadius.only(
topRight: Radius.circular(20), topRight: Radius.circular(20), topLeft: Radius.circular(20)),
topLeft: Radius.circular(20)),
), ),
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
@ -60,35 +57,27 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
Expanded( Expanded(
child: Container( child: Container(
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: const BorderRadius.all( borderRadius: const BorderRadius.all(Radius.circular(20)),
Radius.circular(20)), border: Border.all(color: ColorsManager.grayBorder)),
border: Border.all(
color: ColorsManager.grayBorder)),
child: TextFormField( child: TextFormField(
style: style: const TextStyle(color: Colors.black),
const TextStyle(color: Colors.black),
onChanged: (value) { onChanged: (value) {
context context.read<SpaceTreeBloc>().add(SearchQueryEvent(value));
.read<SpaceTreeBloc>()
.add(SearchQueryEvent(value));
}, },
decoration: textBoxDecoration(radios: 20)! decoration: textBoxDecoration(radios: 20)!.copyWith(
.copyWith(
fillColor: Colors.white, fillColor: Colors.white,
suffixIcon: Padding( suffixIcon: Padding(
padding: padding: const EdgeInsets.only(right: 16),
const EdgeInsets.only(right: 16),
child: SvgPicture.asset( child: SvgPicture.asset(
Assets.textFieldSearch, Assets.textFieldSearch,
width: 24, width: 24,
height: 24, height: 24,
), ),
), ),
hintStyle: context.textTheme.bodyMedium hintStyle: context.textTheme.bodyMedium?.copyWith(
?.copyWith( fontWeight: FontWeight.w400,
fontWeight: FontWeight.w400, fontSize: 12,
fontSize: 12, color: ColorsManager.textGray),
color: ColorsManager.textGray),
), ),
), ),
), ),
@ -99,9 +88,7 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
) )
: CustomSearchBar( : CustomSearchBar(
onSearchChanged: (query) { onSearchChanged: (query) {
context context.read<SpaceTreeBloc>().add(SearchQueryEvent(query));
.read<SpaceTreeBloc>()
.add(SearchQueryEvent(query));
}, },
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -117,18 +104,14 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
? Center( ? Center(
child: Text( child: Text(
'No results found', 'No results found',
style: Theme.of(context) style: Theme.of(context).textTheme.bodySmall!.copyWith(
.textTheme
.bodySmall!
.copyWith(
color: ColorsManager.lightGrayColor, color: ColorsManager.lightGrayColor,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
), ),
), ),
) )
: Scrollbar( : Scrollbar(
scrollbarOrientation: scrollbarOrientation: ScrollbarOrientation.left,
ScrollbarOrientation.left,
thumbVisibility: true, thumbVisibility: true,
controller: _scrollController, controller: _scrollController,
child: Padding( child: Padding(
@ -138,39 +121,30 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
shrinkWrap: true, shrinkWrap: true,
children: list children: list
.map( .map(
(community) => (community) => CustomExpansionTileSpaceTree(
CustomExpansionTileSpaceTree(
title: community.name, title: community.name,
isSelected: state isSelected: state.selectedCommunities
.selectedCommunities
.contains(community.uuid), .contains(community.uuid),
isSoldCheck: state isSoldCheck: state.selectedCommunities
.selectedCommunities
.contains(community.uuid), .contains(community.uuid),
onExpansionChanged: () { onExpansionChanged: () {
context context
.read<SpaceTreeBloc>() .read<SpaceTreeBloc>()
.add(OnCommunityExpanded( .add(OnCommunityExpanded(community.uuid));
community.uuid));
}, },
isExpanded: state isExpanded: state.expandedCommunities
.expandedCommunities
.contains(community.uuid), .contains(community.uuid),
onItemSelected: () { onItemSelected: () {
context context.read<SpaceTreeBloc>().add(
.read<SpaceTreeBloc>() OnCommunitySelected(
.add(OnCommunitySelected( community.uuid, community.spaces));
community.uuid,
community.spaces));
widget.onSelect(); widget.onSelect();
}, },
children: children: community.spaces.map((space) {
community.spaces.map((space) {
return CustomExpansionTileSpaceTree( return CustomExpansionTileSpaceTree(
title: space.name, title: space.name,
isExpanded: state isExpanded:
.expandedSpaces state.expandedSpaces.contains(space.uuid),
.contains(space.uuid),
onItemSelected: () { onItemSelected: () {
context.read<SpaceTreeBloc>().add( context.read<SpaceTreeBloc>().add(
OnSpaceSelected(community, space.uuid ?? '', OnSpaceSelected(community, space.uuid ?? '',
@ -178,20 +152,14 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
widget.onSelect(); widget.onSelect();
}, },
onExpansionChanged: () { onExpansionChanged: () {
context context.read<SpaceTreeBloc>().add(
.read<SpaceTreeBloc>() OnSpaceExpanded(
.add(OnSpaceExpanded( community.uuid, space.uuid ?? ''));
community.uuid,
space.uuid ?? ''));
}, },
isSelected: state isSelected:
.selectedSpaces state.selectedSpaces.contains(space.uuid) ||
.contains( state.soldCheck.contains(space.uuid),
space.uuid) || isSoldCheck: state.soldCheck.contains(space.uuid),
state.soldCheck
.contains(space.uuid),
isSoldCheck: state.soldCheck
.contains(space.uuid),
children: _buildNestedSpaces( children: _buildNestedSpaces(
context, state, space, community), context, state, space, community),
); );
@ -279,8 +247,8 @@ class _SpaceTreeViewState extends State<SpaceTreeView> {
BuildContext context, SpaceTreeState state, SpaceModel space, CommunityModel community) { BuildContext context, SpaceTreeState state, SpaceModel space, CommunityModel community) {
return space.children.map((child) { return space.children.map((child) {
return CustomExpansionTileSpaceTree( return CustomExpansionTileSpaceTree(
isSelected: state.selectedSpaces.contains(child.uuid) || isSelected:
state.soldCheck.contains(child.uuid), state.selectedSpaces.contains(child.uuid) || state.soldCheck.contains(child.uuid),
isSoldCheck: state.soldCheck.contains(child.uuid), isSoldCheck: state.soldCheck.contains(child.uuid),
title: child.name, title: child.name,
isExpanded: state.expandedSpaces.contains(child.uuid), isExpanded: state.expandedSpaces.contains(child.uuid),