mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-16 01:56:24 +00:00
validation fix
This commit is contained in:
@ -52,12 +52,14 @@ class CreateSpaceModelDialog extends StatelessWidget {
|
||||
create: (_) {
|
||||
final bloc = CreateSpaceModelBloc(_spaceModelApi);
|
||||
if (spaceModel != null) {
|
||||
bloc.add(UpdateSpaceTemplate(spaceModel!,otherSpaceModels));
|
||||
bloc.add(UpdateSpaceTemplate(spaceModel!, otherSpaceModels));
|
||||
} else {
|
||||
bloc.add(UpdateSpaceTemplate(SpaceTemplateModel(
|
||||
modelName: '',
|
||||
subspaceModels: const [],
|
||||
),otherSpaceModels));
|
||||
bloc.add(UpdateSpaceTemplate(
|
||||
SpaceTemplateModel(
|
||||
modelName: '',
|
||||
subspaceModels: const [],
|
||||
),
|
||||
otherSpaceModels));
|
||||
}
|
||||
|
||||
spaceNameController.addListener(() {
|
||||
@ -127,11 +129,6 @@ class CreateSpaceModelDialog extends StatelessWidget {
|
||||
context
|
||||
.read<CreateSpaceModelBloc>()
|
||||
.add(AddSubspacesToSpaceTemplate(updatedSubspaces));
|
||||
|
||||
context.read<CreateSpaceModelBloc>().add(
|
||||
UpdateSpaceTemplateName(
|
||||
name: spaceNameController.text,
|
||||
allModels: otherSpaceModels ?? []));
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
@ -163,10 +160,8 @@ class CreateSpaceModelDialog extends StatelessWidget {
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: DefaultButton(
|
||||
onPressed: ( state.errorMessage == null) &&
|
||||
isNameValid
|
||||
onPressed: (state.errorMessage == null)
|
||||
? () {
|
||||
|
||||
final updatedSpaceTemplate =
|
||||
updatedSpaceModel.copyWith(
|
||||
modelName:
|
||||
@ -243,10 +238,10 @@ class CreateSpaceModelDialog extends StatelessWidget {
|
||||
: null,
|
||||
backgroundColor: ColorsManager.secondaryColor,
|
||||
borderRadius: 10,
|
||||
foregroundColor:
|
||||
state.errorMessage == null && isNameValid
|
||||
? ColorsManager.whiteColors
|
||||
: ColorsManager.whiteColorsWithOpacity,
|
||||
foregroundColor: (state.errorMessage != null &&
|
||||
state.errorMessage != '')
|
||||
? ColorsManager.whiteColorsWithOpacity
|
||||
: ColorsManager.whiteColors,
|
||||
child: const Text('OK'),
|
||||
),
|
||||
),
|
||||
|
Reference in New Issue
Block a user