Created
September 11, 2020 12:09
-
-
Save mahmudahsan/4b352ccc5d3a401e3543666df7691405 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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