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