mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
SP-1330.
This commit is contained in:
@ -11,6 +11,8 @@ import 'package:syncrow_web/pages/spaces_management/all_spaces/widgets/space_til
|
|||||||
import 'package:syncrow_web/pages/spaces_management/create_community/view/create_community_dialog.dart';
|
import 'package:syncrow_web/pages/spaces_management/create_community/view/create_community_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/structure_selector/bloc/center_body_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/structure_selector/bloc/center_body_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/structure_selector/bloc/center_body_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/structure_selector/bloc/center_body_event.dart';
|
||||||
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
import 'package:syncrow_web/utils/style.dart';
|
import 'package:syncrow_web/utils/style.dart';
|
||||||
|
|
||||||
class SidebarWidget extends StatefulWidget {
|
class SidebarWidget extends StatefulWidget {
|
||||||
@ -30,6 +32,8 @@ class SidebarWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SidebarWidgetState extends State<SidebarWidget> {
|
class _SidebarWidgetState extends State<SidebarWidget> {
|
||||||
|
late final ScrollController _scrollController;
|
||||||
|
|
||||||
String _searchQuery = '';
|
String _searchQuery = '';
|
||||||
String? _selectedSpaceUuid;
|
String? _selectedSpaceUuid;
|
||||||
String? _selectedId;
|
String? _selectedId;
|
||||||
@ -37,9 +41,16 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
_selectedId = widget.selectedSpaceUuid;
|
_selectedId = widget.selectedSpaceUuid;
|
||||||
|
_scrollController = ScrollController();
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_scrollController.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(covariant SidebarWidget oldWidget) {
|
void didUpdateWidget(covariant SidebarWidget oldWidget) {
|
||||||
if (widget.selectedSpaceUuid != oldWidget.selectedSpaceUuid) {
|
if (widget.selectedSpaceUuid != oldWidget.selectedSpaceUuid) {
|
||||||
@ -86,12 +97,14 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
return isSpaceSelected || anySubSpaceIsSelected;
|
return isSpaceSelected || anySubSpaceIsSelected;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const _width = 300.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final filteredCommunities = _filteredCommunities();
|
final filteredCommunities = _filteredCommunities();
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
width: 300,
|
width: _width,
|
||||||
decoration: subSectionContainerDecoration,
|
decoration: subSectionContainerDecoration,
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
@ -103,10 +116,42 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
Expanded(
|
Expanded(
|
||||||
|
child: Visibility(
|
||||||
|
visible: filteredCommunities.isNotEmpty,
|
||||||
|
replacement: Center(
|
||||||
|
child: Text(
|
||||||
|
'No results found',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: context.textTheme.bodySmall?.copyWith(
|
||||||
|
color: ColorsManager.lightGreyColor,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: filteredCommunities
|
shrinkWrap: true,
|
||||||
.map((community) => _buildCommunityTile(context, community))
|
scrollDirection: Axis.horizontal,
|
||||||
.toList(),
|
children: [
|
||||||
|
SizedBox(
|
||||||
|
width: context.screenWidth * 0.5,
|
||||||
|
child: Scrollbar(
|
||||||
|
scrollbarOrientation: ScrollbarOrientation.left,
|
||||||
|
thumbVisibility: true,
|
||||||
|
controller: _scrollController,
|
||||||
|
child: ListView.builder(
|
||||||
|
padding: const EdgeInsetsDirectional.only(start: 16),
|
||||||
|
shrinkWrap: true,
|
||||||
|
itemCount: filteredCommunities.length,
|
||||||
|
controller: _scrollController,
|
||||||
|
itemBuilder: (context, index) => _buildCommunityTile(
|
||||||
|
context,
|
||||||
|
filteredCommunities[index],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -134,11 +179,12 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
},
|
},
|
||||||
onExpansionChanged: (title, expanded) {},
|
onExpansionChanged: (title, expanded) {},
|
||||||
children: community.spaces
|
children: community.spaces
|
||||||
.where((space) {
|
.where(
|
||||||
final isDeleted = space.status != SpaceStatus.deleted;
|
(space) => {
|
||||||
final isParentDeleted = space.status != SpaceStatus.parentDeleted;
|
SpaceStatus.deleted,
|
||||||
return (isDeleted || isParentDeleted);
|
SpaceStatus.parentDeleted,
|
||||||
})
|
}.contains(space.status),
|
||||||
|
)
|
||||||
.map((space) => _buildSpaceTile(space: space, community: community))
|
.map((space) => _buildSpaceTile(space: space, community: community))
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user