mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 07:07:19 +00:00
SP-1189-FE-Add-Button-Not-clickable-Opening-Pop-up-in-Community-Screen
This commit is contained in:
@ -1,32 +1,51 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
||||||
|
import 'package:syncrow_web/pages/spaces_management/create_community/view/create_community_dialog.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
|
|
||||||
class SidebarAddCommunityButton extends StatelessWidget {
|
class SidebarAddCommunityButton extends StatelessWidget {
|
||||||
const SidebarAddCommunityButton({super.key});
|
const SidebarAddCommunityButton({
|
||||||
|
required this.existingCommunityNames,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
final List<String> existingCommunityNames;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return GestureDetector(
|
return SizedBox.square(
|
||||||
onTap: () => _navigateToBlank(context),
|
dimension: 30,
|
||||||
child: Container(
|
child: IconButton(
|
||||||
width: 30,
|
style: IconButton.styleFrom(
|
||||||
height: 30,
|
iconSize: 20,
|
||||||
decoration: const BoxDecoration(
|
backgroundColor: ColorsManager.circleImageBackground,
|
||||||
color: ColorsManager.whiteColors,
|
shape: const CircleBorder(
|
||||||
shape: BoxShape.circle,
|
side: BorderSide(
|
||||||
),
|
color: ColorsManager.lightGrayBorderColor,
|
||||||
child: Center(
|
width: 3,
|
||||||
child: SvgPicture.asset(
|
|
||||||
Assets.roundedAddIcon,
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
onPressed: () => _showCreateCommunityDialog(context),
|
||||||
|
icon: SvgPicture.asset(Assets.addIcon),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _navigateToBlank(BuildContext context) {}
|
void _showCreateCommunityDialog(BuildContext context) => showDialog<void>(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => CreateCommunityDialog(
|
||||||
|
isEditMode: false,
|
||||||
|
existingCommunityNames: existingCommunityNames,
|
||||||
|
onCreateCommunity: (name, description) {
|
||||||
|
context.read<SpaceManagementBloc>().add(
|
||||||
|
CreateCommunityEvent(name, description, context),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -5,13 +5,15 @@ 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 SidebarHeader extends StatelessWidget {
|
class SidebarHeader extends StatelessWidget {
|
||||||
const SidebarHeader({super.key});
|
const SidebarHeader({required this.existingCommunityNames, super.key});
|
||||||
|
|
||||||
|
final List<String> existingCommunityNames;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
decoration: subSectionContainerDecoration,
|
decoration: subSectionContainerDecoration,
|
||||||
padding: const EdgeInsets.all(16.0),
|
padding: const EdgeInsets.all(16),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@ -21,7 +23,7 @@ class SidebarHeader extends StatelessWidget {
|
|||||||
color: ColorsManager.blackColor,
|
color: ColorsManager.blackColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SidebarAddCommunityButton(),
|
SidebarAddCommunityButton(existingCommunityNames: existingCommunityNames),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -94,7 +94,10 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
const SidebarHeader(),
|
SidebarHeader(
|
||||||
|
existingCommunityNames:
|
||||||
|
widget.communities.map((community) => community.name).toList(),
|
||||||
|
),
|
||||||
CustomSearchBar(
|
CustomSearchBar(
|
||||||
onSearchChanged: (query) => setState(() => _searchQuery = query),
|
onSearchChanged: (query) => setState(() => _searchQuery = query),
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user