62 lines
2.0 KiB
Dart
62 lines
2.0 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> changePinCodeFromSetting(String pinCode) {
|
|
return (Store<AppState> store) async {
|
|
store.dispatch(SetSettingStateAction(SettingState(pinCode: pinCode)));
|
|
};
|
|
}
|
|
|
|
ThunkAction<AppState> changePinLockedFromSetting(bool locked) {
|
|
return (Store<AppState> store) async {
|
|
store.dispatch(SetSettingStateAction(SettingState(pinLocked: locked)));
|
|
};
|
|
}
|
|
|
|
ThunkAction<AppState> changePinSkipFromSetting(bool skip) {
|
|
return (Store<AppState> store) async {
|
|
store.dispatch(SetSettingStateAction(SettingState(pinSkip: skip)));
|
|
};
|
|
}
|
|
|
|
ThunkAction<AppState> selectPrinterFromSetting(BluetoothDevice device) {
|
|
return (Store<AppState> store) async {
|
|
store.dispatch(SetSettingStateAction(SettingState(printerBT: device )));
|
|
};
|
|
}
|
|
|
|
ThunkAction<AppState> selectPrinterEncodingFromSetting(String encoding) {
|
|
return (Store<AppState> store) async {
|
|
store.dispatch(SetSettingStateAction(SettingState(printerEncoding: encoding )));
|
|
};
|
|
}
|
|
|
|
ThunkAction<AppState> selectPrinterPaperSizeFromSetting(String paperSize) {
|
|
return (Store<AppState> store) async {
|
|
store.dispatch(SetSettingStateAction(SettingState(printerPaperSize: paperSize )));
|
|
};
|
|
} |