elCaribe app - customization and branding
This commit is contained in:
42
news-app/lib/data/models/SettingsModel.dart
Normal file
42
news-app/lib/data/models/SettingsModel.dart
Normal file
@@ -0,0 +1,42 @@
|
||||
class SettingsModel {
|
||||
bool showIntroSlider;
|
||||
bool notification;
|
||||
String languageCode;
|
||||
String theme;
|
||||
String token;
|
||||
|
||||
SettingsModel({
|
||||
required this.languageCode,
|
||||
required this.showIntroSlider,
|
||||
required this.theme,
|
||||
required this.notification,
|
||||
required this.token,
|
||||
});
|
||||
|
||||
static SettingsModel fromJson(var settingsJson) {
|
||||
//to see the json response go to getCurrentSettings() function in settingsRepository
|
||||
return SettingsModel(
|
||||
theme: settingsJson['theme'],
|
||||
showIntroSlider: settingsJson['showIntroSlider'],
|
||||
notification: settingsJson['notification'],
|
||||
languageCode: settingsJson['languageCode'],
|
||||
token: settingsJson['token'],
|
||||
);
|
||||
}
|
||||
|
||||
SettingsModel copyWith({
|
||||
String? theme,
|
||||
bool? showIntroSlider,
|
||||
bool? notification,
|
||||
String? languageCode,
|
||||
String? token,
|
||||
}) {
|
||||
return SettingsModel(
|
||||
theme: theme ?? this.theme,
|
||||
notification: notification ?? this.notification,
|
||||
showIntroSlider: showIntroSlider ?? this.showIntroSlider,
|
||||
languageCode: languageCode ?? this.languageCode,
|
||||
token: token ?? this.token,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user