aman-kassa-flutter/lib/redux/actions/setting_actions.dart

32 lines
1.1 KiB
Dart

import 'package:aman_kassa_flutter/redux/constants/setting_const.dart';
import 'package:aman_kassa_flutter/redux/state/setting_state.dart';
import 'package:meta/meta.dart';
import 'package:redux/redux.dart';
import 'package:redux_thunk/redux_thunk.dart';
import 'package:flutter_bluetooth_basic/src/bluetooth_device.dart';
import '../store.dart';
@immutable
class SetSettingStateAction {
final SettingState settingState;
SetSettingStateAction(this.settingState);
}
ThunkAction<AppState> changeModeFromSetting(bool isKassa) {
return (Store<AppState> store) async {
store.dispatch(SetSettingStateAction(SettingState(mode: isKassa? SettingModeKassa: SettingModeCalc )));
};
}
ThunkAction<AppState> changeTradeTypeFromSetting(String tradeType) {
return (Store<AppState> store) async {
store.dispatch(SetSettingStateAction(SettingState(tradeType: tradeType )));
};
}
ThunkAction<AppState> selectPrinterFromSetting(BluetoothDevice device) {
return (Store<AppState> store) async {
store.dispatch(SetSettingStateAction(SettingState(printerBT: device )));
};
}