Skip to content

Instantly share code, notes, and snippets.

@mahmudahsan
Created September 11, 2020 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mahmudahsan/4b352ccc5d3a401e3543666df7691405 to your computer and use it in GitHub Desktop.
Save mahmudahsan/4b352ccc5d3a401e3543666df7691405 to your computer and use it in GitHub Desktop.
part of 'settings_bloc.dart';
@immutable
abstract class SettingsState {
final double sliderFontSize;
final bool isBold;
final bool isItalic;
SettingsState({this.sliderFontSize, this.isBold, this.isItalic});
double get fontSize => sliderFontSize * 30;
}
class InitialSettingsState extends SettingsState {
InitialSettingsState()
: super(sliderFontSize: 0.5, isBold: false, isItalic: false);
}
class NewSettingState extends SettingsState {
NewSettingState.fromOldSettingState(SettingsState oldState,
{double sliderFontSize, bool isBold, bool isItalic})
: super(
sliderFontSize: sliderFontSize ?? oldState.sliderFontSize,
isBold: isBold ?? oldState.isBold,
isItalic: isItalic ?? oldState.isItalic,
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment