mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
fixed edit dialog
This commit is contained in:
@ -2,22 +2,36 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/cancel_button.dart';
|
||||
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/product_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/create_subspace_model/bloc/subspace_model_bloc.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/create_subspace_model/bloc/subspace_model_event.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/create_subspace_model/bloc/subspace_model_state.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/space_template_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/subspace_template_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/space_model/models/tag_model.dart';
|
||||
import 'package:syncrow_web/pages/spaces_management/space_model/widgets/dialog/create_space_model_dialog.dart';
|
||||
import 'package:syncrow_web/utils/color_manager.dart';
|
||||
|
||||
class CreateSubSpaceModelDialog extends StatelessWidget {
|
||||
final bool isEdit;
|
||||
final String dialogTitle;
|
||||
final List<SubspaceTemplateModel>? existingSubSpaces;
|
||||
final String? spaceName;
|
||||
final List<TagModel>? spaceTagModels;
|
||||
final List<String>? allTags;
|
||||
final List<ProductModel>? products;
|
||||
final SpaceTemplateModel? spaceModel;
|
||||
|
||||
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);
|
||||
|
||||
@override
|
||||
@ -153,20 +167,49 @@ class CreateSubSpaceModelDialog extends StatelessWidget {
|
||||
Expanded(
|
||||
child: CancelButton(
|
||||
label: 'Cancel',
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
await showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
CreateSpaceModelDialog(
|
||||
products: products,
|
||||
allTags: allTags,
|
||||
spaceModel: SpaceTemplateModel(
|
||||
modelName: spaceName ?? '',
|
||||
subspaceModels: existingSubSpaces,
|
||||
tags: spaceTagModels,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: DefaultButton(
|
||||
onPressed: () {
|
||||
onPressed: () async {
|
||||
final subSpaces = context
|
||||
.read<SubSpaceModelBloc>()
|
||||
.state
|
||||
.subSpaces;
|
||||
Navigator.of(context).pop(subSpaces);
|
||||
Navigator.of(context).pop();
|
||||
|
||||
await showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (context) =>
|
||||
CreateSpaceModelDialog(
|
||||
products: products,
|
||||
allTags: allTags,
|
||||
spaceModel: SpaceTemplateModel(
|
||||
modelName: spaceName ?? '',
|
||||
subspaceModels: subSpaces,
|
||||
tags: spaceTagModels,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
borderRadius: 10,
|
||||
|
Reference in New Issue
Block a user