fixed subspace create

This commit is contained in:
hannathkadher
2025-01-15 09:39:26 +04:00
parent cf2690123e
commit 0bb24604bc
4 changed files with 38 additions and 32 deletions

View File

@ -21,18 +21,20 @@ class CreateSubSpaceModelDialog extends StatelessWidget {
final List<String>? allTags;
final List<ProductModel>? products;
final SpaceTemplateModel? spaceModel;
final void Function(SpaceTemplateModel newModel)? onLoad;
const CreateSubSpaceModelDialog({
Key? key,
required this.isEdit,
required this.dialogTitle,
this.existingSubSpaces,
required this.allTags,
required this.spaceName,
required this.spaceTagModels,
required this.products,
required this.spaceModel,
}) : super(key: key);
const CreateSubSpaceModelDialog(
{Key? key,
required this.isEdit,
required this.dialogTitle,
this.existingSubSpaces,
required this.allTags,
required this.spaceName,
required this.spaceTagModels,
required this.products,
required this.spaceModel,
this.onLoad})
: super(key: key);
@override
Widget build(BuildContext context) {
@ -176,6 +178,7 @@ class CreateSubSpaceModelDialog extends StatelessWidget {
CreateSpaceModelDialog(
products: products,
allTags: allTags,
onLoad: onLoad,
spaceModel: SpaceTemplateModel(
modelName: spaceName ?? '',
subspaceModels: existingSubSpaces,
@ -203,6 +206,7 @@ class CreateSubSpaceModelDialog extends StatelessWidget {
CreateSpaceModelDialog(
products: products,
allTags: allTags,
onLoad: onLoad,
spaceModel: SpaceTemplateModel(
modelName: spaceName ?? '',
subspaceModels: subSpaces,

View File

@ -21,6 +21,7 @@ class CreateSpaceTemplate extends CreateSpaceModelEvent {
final SpaceTemplateModel spaceTemplate;
final Function(SpaceTemplateModel)? onCreate;
const CreateSpaceTemplate({
required this.spaceTemplate,
this.onCreate,

View File

@ -110,11 +110,12 @@ class CreateSpaceModelDialog extends StatelessWidget {
const SizedBox(height: 16),
SubspaceModelCreate(context,
subspaces: state.space.subspaceModels ?? [],
onLoad:onLoad,
allTags: allTags,
products: products,
spaceModel: spaceModel,
spaceTagModels: spaceModel?.tags ?? [],
spaceNameController: spaceNameController),
spaceNameController: spaceNameController,),
const SizedBox(height: 10),
TagChipDisplay(context,
screenWidth: screenWidth,

View File

@ -14,17 +14,18 @@ class SubspaceModelCreate extends StatelessWidget {
final List<String>? allTags;
final List<ProductModel>? products;
final SpaceTemplateModel? spaceModel;
final void Function(SpaceTemplateModel newModel)? onLoad;
const SubspaceModelCreate(
BuildContext context, {
Key? key,
required this.subspaces,
this.spaceTagModels,
required this.allTags,
required this.products,
required this.spaceModel,
required this.spaceNameController,
}) : super(key: key);
const SubspaceModelCreate(BuildContext context,
{Key? key,
required this.subspaces,
this.spaceTagModels,
required this.allTags,
required this.products,
required this.spaceModel,
required this.spaceNameController,
this.onLoad})
: super(key: key);
@override
Widget build(BuildContext context) {
@ -53,6 +54,7 @@ class SubspaceModelCreate extends StatelessWidget {
? 'Create Sub-space'
: 'Edit Sub-space',
existingSubSpaces: subspaces,
onLoad: onLoad,
);
},
);
@ -85,7 +87,8 @@ class SubspaceModelCreate extends StatelessWidget {
style: const TextStyle(
color: ColorsManager.spaceColor), // Text color
),
backgroundColor: ColorsManager.whiteColors, // Chip background color
backgroundColor:
ColorsManager.whiteColors, // Chip background color
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(16), // Rounded chip
@ -110,6 +113,7 @@ class SubspaceModelCreate extends StatelessWidget {
spaceTagModels: spaceTagModels,
products: products,
spaceModel: spaceModel,
onLoad: onLoad,
);
},
);
@ -117,16 +121,13 @@ class SubspaceModelCreate extends StatelessWidget {
child: Chip(
label: const Text(
'Edit',
style: TextStyle(
color: ColorsManager.spaceColor),
style: TextStyle(color: ColorsManager.spaceColor),
),
backgroundColor:
ColorsManager.whiteColors,
backgroundColor: ColorsManager.whiteColors,
shape: RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(16),
side: const BorderSide(
color: ColorsManager.spaceColor),
borderRadius: BorderRadius.circular(16),
side:
const BorderSide(color: ColorsManager.spaceColor),
),
),
),
@ -134,7 +135,6 @@ class SubspaceModelCreate extends StatelessWidget {
),
),
),
);
}
}