Commit 6d5b01b7 authored by 张宏's avatar 张宏

1111111111111

parent d9aad985
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:laki_icu_app/blocs/device_threshold_config/device_threshold_config.dart'; import 'package:laki_icu_app/blocs/device_threshold_config/device_threshold_config.dart';
import 'package:laki_icu_app/utils/toast_utils.dart';
import 'factory_settings_index_state.dart'; import 'factory_settings_index_state.dart';
...@@ -77,8 +78,13 @@ class FactorySettingsIndexCubit extends Cubit<FactorySettingsIndexState> { ...@@ -77,8 +78,13 @@ class FactorySettingsIndexCubit extends Cubit<FactorySettingsIndexState> {
} }
void applyChanges() { void applyChanges() {
_thresholdConfigBloc.updateConfig(state.editingConfig); try {
emit(state.copyWith(isDirty: false)); _thresholdConfigBloc.updateConfig(state.editingConfig);
emit(state.copyWith(isDirty: false));
showToast('操作成功');
} catch (e) {
showToast('操作失败');
}
} }
void resetEdits() { void resetEdits() {
......
...@@ -146,7 +146,7 @@ class _FactoryActionColumn extends StatelessWidget { ...@@ -146,7 +146,7 @@ class _FactoryActionColumn extends StatelessWidget {
Expanded( Expanded(
child: _FactoryButton( child: _FactoryButton(
text: '应用更改', text: '应用更改',
onPressed: isDirty ? () => cubit.applyChanges() : null, onPressed: () => cubit.applyChanges(),
), ),
), ),
], ],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment