added trailing commas wherever neccessary in CreateSubSpaceDialog.

This commit is contained in:
Faris Armoush
2025-04-17 09:35:33 +03:00
parent 62bf4f2944
commit 18c886753d

View File

@ -22,15 +22,16 @@ class CreateSubSpaceDialog extends StatelessWidget {
final List<ProductModel>? products;
final void Function(List<SubspaceModel>?)? onSave;
const CreateSubSpaceDialog(
{super.key,
const CreateSubSpaceDialog({
super.key,
required this.isEdit,
required this.dialogTitle,
this.existingSubSpaces,
required this.spaceName,
required this.spaceTags,
required this.products,
required this.onSave});
required this.onSave,
});
@override
Widget build(BuildContext context) {
@ -44,7 +45,7 @@ class CreateSubSpaceDialog extends StatelessWidget {
create: (_) {
final bloc = SubSpaceBloc();
if (existingSubSpaces != null) {
for (var subSpace in existingSubSpaces!) {
for (final subSpace in existingSubSpaces ?? []) {
bloc.add(AddSubSpace(subSpace));
}
}
@ -64,16 +65,17 @@ class CreateSubSpaceDialog extends StatelessWidget {
children: [
Text(
dialogTitle,
style: Theme.of(context)
.textTheme
.headlineLarge
?.copyWith(color: ColorsManager.blackColor),
style: Theme.of(context).textTheme.headlineLarge?.copyWith(
color: ColorsManager.blackColor,
),
),
const SizedBox(height: 16),
Container(
width: context.screenWidth * 0.35,
padding: const EdgeInsets.symmetric(
vertical: 10.0, horizontal: 16.0),
vertical: 10.0,
horizontal: 16.0,
),
decoration: BoxDecoration(
color: ColorsManager.boxColor,
borderRadius: BorderRadius.circular(10),
@ -108,9 +110,9 @@ class CreateSubSpaceDialog extends StatelessWidget {
disabled: entry.value.disabled,
),
isDuplicate: isDuplicate,
onDeleted: () => context
.read<SubSpaceBloc>()
.add(RemoveSubSpace(subSpace)),
onDeleted: () => context.read<SubSpaceBloc>().add(
RemoveSubSpace(subSpace),
),
);
},
),
@ -127,18 +129,24 @@ class CreateSubSpaceDialog extends StatelessWidget {
.textTheme
.bodySmall
?.copyWith(
color:
ColorsManager.lightGrayColor)),
color: ColorsManager.lightGrayColor,
),
),
onSubmitted: (value) {
if (value.trim().isNotEmpty) {
context.read<SubSpaceBloc>().add(AddSubSpace(
context.read<SubSpaceBloc>().add(
AddSubSpace(
SubspaceModel(
subspaceName: value.trim(),
disabled: false)));
disabled: false,
),
),
);
textController.clear();
}
},
style: Theme.of(context).textTheme.bodyMedium),
style: Theme.of(context).textTheme.bodyMedium,
),
),
],
),
@ -146,11 +154,12 @@ class CreateSubSpaceDialog extends StatelessWidget {
if (state.errorMessage.isNotEmpty)
Padding(
padding: const EdgeInsets.only(top: 8.0),
child: Text(state.errorMessage,
style:
Theme.of(context).textTheme.bodySmall?.copyWith(
child: Text(
state.errorMessage,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: ColorsManager.warningRed,
)),
),
),
),
const SizedBox(height: 16),
Row(
@ -189,7 +198,8 @@ class CreateSubSpaceDialog extends StatelessWidget {
],
),
),
));
),
);
},
),
),