add blank space

This commit is contained in:
hannathkadher
2024-11-23 23:02:25 +04:00
parent 59d9a34c4e
commit 7806d3de7d
4 changed files with 98 additions and 2 deletions

View File

@ -0,0 +1,73 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_web/pages/spaces_management/bloc/space_management_bloc.dart';
import 'package:syncrow_web/pages/spaces_management/bloc/space_management_event.dart';
import 'package:syncrow_web/pages/spaces_management/widgets/dialogs/create_community_dialog.dart';
import 'package:syncrow_web/utils/color_manager.dart';
class BlankCommunityWidget extends StatelessWidget {
const BlankCommunityWidget({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Expanded(
child: Container(
color: ColorsManager.whiteColors, // Parent container with white background
child: GridView.builder(
padding: const EdgeInsets.only(left: 40.0, top: 20.0),
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 400, // Each item's width will be 400 or less
mainAxisSpacing: 10, // Spacing between items
crossAxisSpacing: 10, // Spacing between items
childAspectRatio: 2.0, // Aspect ratio for width:height (e.g., 300:150 = 2.0)
),
itemCount: 1, // Only one item
itemBuilder: (context, index) {
return GestureDetector(
onTap: () => _showCreateCommunityDialog(context),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center, // Center align the content
children: [
Container(
width: 400, // Explicitly set item width
height: 150, // Item height
decoration: ShapeDecoration(
shape: RoundedRectangleBorder(
side: BorderSide(
width: 4,
strokeAlign: BorderSide.strokeAlignOutside,
color: ColorsManager.borderColor,
),
borderRadius: BorderRadius.circular(5),
),
),
),
const SizedBox(height: 9), // Space between item and text
Text('Blank', // Text below the item
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
color: ColorsManager.blackColor,
)),
],
));
},
),
),
);
}
void _showCreateCommunityDialog(BuildContext parentContext) {
showDialog(
context: parentContext,
builder: (context) => CreateCommunityDialog(
onCreateCommunity: (String communityName, String description) {
parentContext.read<SpaceManagementBloc>().add(
CreateCommunityEvent(
name: communityName,
description: description,
),
);
},
),
);
}
}

View File

@ -11,6 +11,7 @@ import 'package:syncrow_web/pages/spaces_management/model/selected_product_model
import 'package:syncrow_web/pages/spaces_management/model/space_model.dart';
import 'package:syncrow_web/pages/spaces_management/model/community_model.dart';
import 'package:syncrow_web/pages/spaces_management/model/connection_model.dart';
import 'package:syncrow_web/pages/spaces_management/widgets/blank_community_widget.dart';
import 'package:syncrow_web/pages/spaces_management/widgets/community_stricture_header_widget.dart';
import 'package:syncrow_web/pages/spaces_management/widgets/dialogs/create_space_dialog.dart';
import 'package:syncrow_web/pages/spaces_management/widgets/curved_line_painter.dart';
@ -92,6 +93,10 @@ class _CommunityStructureAreaState extends State<CommunityStructureArea> {
@override
Widget build(BuildContext context) {
if (widget.selectedCommunity == null) {
return BlankCommunityWidget();
}
Size screenSize = MediaQuery.of(context).size;
return Expanded(
child: GestureDetector(

View File

@ -15,14 +15,14 @@ class LoadedSpaceView extends StatefulWidget {
final List<ProductModel>? products;
const LoadedSpaceView({
Key? key,
super.key,
required this.communities,
this.selectedCommunity,
this.selectedSpace,
required this.onCommunitySelected,
required this.onSpaceSelected,
this.products,
}) : super(key: key);
});
@override
_LoadedStateViewState createState() => _LoadedStateViewState();

View File

@ -0,0 +1,18 @@
import 'package:syncrow_web/utils/constants/assets.dart';
const List<String> spaceIconList = [
Assets.location,
Assets.villa,
Assets.gym,
Assets.sauna,
Assets.bbq,
Assets.building,
Assets.desk,
Assets.door,
Assets.parking,
Assets.pool,
Assets.stair,
Assets.steamRoom,
Assets.street,
Assets.unit,
];