added initial flow

This commit is contained in:
hannathkadher
2025-01-18 00:32:48 +04:00
parent ec5b7d4395
commit 440263e2f9
7 changed files with 152 additions and 83 deletions

View File

@ -118,13 +118,28 @@ class CreateSpaceModelDialog extends StatelessWidget {
},
),
const SizedBox(height: 10),
TagChipDisplay(context,
screenWidth: screenWidth,
spaceModel: updatedSpaceModel,
products: products,
subspaces: subspaces,
allTags: allTags,
spaceNameController: spaceNameController),
TagChipDisplay(
context,
screenWidth: screenWidth,
spaceModel: updatedSpaceModel,
products: products,
subspaces: subspaces,
allTags: allTags,
spaceNameController: spaceNameController,
onLoad: (tags, subspaces) {
if(subspaces!=null){
context
.read<CreateSpaceModelBloc>()
.add(AddSubspacesToSpaceTemplate(subspaces));
}
if(tags!=null){
context
.read<CreateSpaceModelBloc>()
.add(AddTagsToSpaceTemplate(tags));
}
},
),
const SizedBox(height: 20),
SizedBox(
width: screenWidth * 0.25,

View File

@ -16,17 +16,19 @@ class TagChipDisplay extends StatelessWidget {
final List<SubspaceTemplateModel>? subspaces;
final List<String>? allTags;
final TextEditingController spaceNameController;
final void Function(
List<TagModel>? tags, List<SubspaceTemplateModel>? subspaces)? onLoad;
const TagChipDisplay(
BuildContext context, {
Key? key,
required this.screenWidth,
required this.spaceModel,
required this.products,
required this.subspaces,
required this.allTags,
required this.spaceNameController,
}) : super(key: key);
const TagChipDisplay(BuildContext context,
{Key? key,
required this.screenWidth,
required this.spaceModel,
required this.products,
required this.subspaces,
required this.allTags,
required this.spaceNameController,
this.onLoad})
: super(key: key);
@override
Widget build(BuildContext context) {
@ -104,15 +106,12 @@ class TagChipDisplay 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),
),
),
),
@ -122,7 +121,7 @@ class TagChipDisplay extends StatelessWidget {
)
: TextButton(
onPressed: () async {
final result = await showDialog<bool>(
await showDialog<bool>(
barrierDismissible: false,
context: context,
builder: (context) => AddDeviceTypeModelWidget(
@ -131,9 +130,13 @@ class TagChipDisplay extends StatelessWidget {
allTags: allTags,
spaceName: spaceNameController.text,
isCreate: true,
onLoad: (tags, subspaces) {
if (onLoad != null) {
onLoad!(tags, subspaces);
}
},
),
);
if (result == true) {}
},
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
@ -189,5 +192,4 @@ class TagChipDisplay extends StatelessWidget {
))
.toList();
}
}