Make showUnit nullable
This commit is contained in:
parent
69f7e0c87b
commit
74b25e4e8f
|
@ -13,7 +13,7 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
final String? sound;
|
final String? sound;
|
||||||
final bool notify;
|
final bool notify;
|
||||||
final bool images;
|
final bool images;
|
||||||
final bool showUnit;
|
final bool? showUnit;
|
||||||
final String? lightColor;
|
final String? lightColor;
|
||||||
final String? darkColor;
|
final String? darkColor;
|
||||||
final bool steps;
|
final bool steps;
|
||||||
|
@ -29,7 +29,7 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
this.sound,
|
this.sound,
|
||||||
required this.notify,
|
required this.notify,
|
||||||
required this.images,
|
required this.images,
|
||||||
required this.showUnit,
|
this.showUnit,
|
||||||
this.lightColor,
|
this.lightColor,
|
||||||
this.darkColor,
|
this.darkColor,
|
||||||
required this.steps,
|
required this.steps,
|
||||||
|
@ -54,7 +54,7 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
images: const BoolType()
|
images: const BoolType()
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}images'])!,
|
.mapFromDatabaseResponse(data['${effectivePrefix}images'])!,
|
||||||
showUnit: const BoolType()
|
showUnit: const BoolType()
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}show_unit'])!,
|
.mapFromDatabaseResponse(data['${effectivePrefix}show_unit']),
|
||||||
lightColor: const StringType()
|
lightColor: const StringType()
|
||||||
.mapFromDatabaseResponse(data['${effectivePrefix}light_color']),
|
.mapFromDatabaseResponse(data['${effectivePrefix}light_color']),
|
||||||
darkColor: const StringType()
|
darkColor: const StringType()
|
||||||
|
@ -85,7 +85,9 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
}
|
}
|
||||||
map['notify'] = Variable<bool>(notify);
|
map['notify'] = Variable<bool>(notify);
|
||||||
map['images'] = Variable<bool>(images);
|
map['images'] = Variable<bool>(images);
|
||||||
map['show_unit'] = Variable<bool>(showUnit);
|
if (!nullToAbsent || showUnit != null) {
|
||||||
|
map['show_unit'] = Variable<bool?>(showUnit);
|
||||||
|
}
|
||||||
if (!nullToAbsent || lightColor != null) {
|
if (!nullToAbsent || lightColor != null) {
|
||||||
map['light_color'] = Variable<String?>(lightColor);
|
map['light_color'] = Variable<String?>(lightColor);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +112,9 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
sound == null && nullToAbsent ? const Value.absent() : Value(sound),
|
sound == null && nullToAbsent ? const Value.absent() : Value(sound),
|
||||||
notify: Value(notify),
|
notify: Value(notify),
|
||||||
images: Value(images),
|
images: Value(images),
|
||||||
showUnit: Value(showUnit),
|
showUnit: showUnit == null && nullToAbsent
|
||||||
|
? const Value.absent()
|
||||||
|
: Value(showUnit),
|
||||||
lightColor: lightColor == null && nullToAbsent
|
lightColor: lightColor == null && nullToAbsent
|
||||||
? const Value.absent()
|
? const Value.absent()
|
||||||
: Value(lightColor),
|
: Value(lightColor),
|
||||||
|
@ -136,7 +140,7 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
sound: serializer.fromJson<String?>(json['sound']),
|
sound: serializer.fromJson<String?>(json['sound']),
|
||||||
notify: serializer.fromJson<bool>(json['notify']),
|
notify: serializer.fromJson<bool>(json['notify']),
|
||||||
images: serializer.fromJson<bool>(json['images']),
|
images: serializer.fromJson<bool>(json['images']),
|
||||||
showUnit: serializer.fromJson<bool>(json['showUnit']),
|
showUnit: serializer.fromJson<bool?>(json['showUnit']),
|
||||||
lightColor: serializer.fromJson<String?>(json['lightColor']),
|
lightColor: serializer.fromJson<String?>(json['lightColor']),
|
||||||
darkColor: serializer.fromJson<String?>(json['darkColor']),
|
darkColor: serializer.fromJson<String?>(json['darkColor']),
|
||||||
steps: serializer.fromJson<bool>(json['steps']),
|
steps: serializer.fromJson<bool>(json['steps']),
|
||||||
|
@ -157,7 +161,7 @@ class Setting extends DataClass implements Insertable<Setting> {
|
||||||
'sound': serializer.toJson<String?>(sound),
|
'sound': serializer.toJson<String?>(sound),
|
||||||
'notify': serializer.toJson<bool>(notify),
|
'notify': serializer.toJson<bool>(notify),
|
||||||
'images': serializer.toJson<bool>(images),
|
'images': serializer.toJson<bool>(images),
|
||||||
'showUnit': serializer.toJson<bool>(showUnit),
|
'showUnit': serializer.toJson<bool?>(showUnit),
|
||||||
'lightColor': serializer.toJson<String?>(lightColor),
|
'lightColor': serializer.toJson<String?>(lightColor),
|
||||||
'darkColor': serializer.toJson<String?>(darkColor),
|
'darkColor': serializer.toJson<String?>(darkColor),
|
||||||
'steps': serializer.toJson<bool>(steps),
|
'steps': serializer.toJson<bool>(steps),
|
||||||
|
@ -269,7 +273,7 @@ class SettingsCompanion extends UpdateCompanion<Setting> {
|
||||||
final Value<String?> sound;
|
final Value<String?> sound;
|
||||||
final Value<bool> notify;
|
final Value<bool> notify;
|
||||||
final Value<bool> images;
|
final Value<bool> images;
|
||||||
final Value<bool> showUnit;
|
final Value<bool?> showUnit;
|
||||||
final Value<String?> lightColor;
|
final Value<String?> lightColor;
|
||||||
final Value<String?> darkColor;
|
final Value<String?> darkColor;
|
||||||
final Value<bool> steps;
|
final Value<bool> steps;
|
||||||
|
@ -302,7 +306,7 @@ class SettingsCompanion extends UpdateCompanion<Setting> {
|
||||||
this.sound = const Value.absent(),
|
this.sound = const Value.absent(),
|
||||||
required bool notify,
|
required bool notify,
|
||||||
required bool images,
|
required bool images,
|
||||||
required bool showUnit,
|
this.showUnit = const Value.absent(),
|
||||||
this.lightColor = const Value.absent(),
|
this.lightColor = const Value.absent(),
|
||||||
this.darkColor = const Value.absent(),
|
this.darkColor = const Value.absent(),
|
||||||
required bool steps,
|
required bool steps,
|
||||||
|
@ -316,7 +320,6 @@ class SettingsCompanion extends UpdateCompanion<Setting> {
|
||||||
vibrate = Value(vibrate),
|
vibrate = Value(vibrate),
|
||||||
notify = Value(notify),
|
notify = Value(notify),
|
||||||
images = Value(images),
|
images = Value(images),
|
||||||
showUnit = Value(showUnit),
|
|
||||||
steps = Value(steps),
|
steps = Value(steps),
|
||||||
date = Value(date),
|
date = Value(date),
|
||||||
showDate = Value(showDate),
|
showDate = Value(showDate),
|
||||||
|
@ -330,7 +333,7 @@ class SettingsCompanion extends UpdateCompanion<Setting> {
|
||||||
Expression<String?>? sound,
|
Expression<String?>? sound,
|
||||||
Expression<bool>? notify,
|
Expression<bool>? notify,
|
||||||
Expression<bool>? images,
|
Expression<bool>? images,
|
||||||
Expression<bool>? showUnit,
|
Expression<bool?>? showUnit,
|
||||||
Expression<String?>? lightColor,
|
Expression<String?>? lightColor,
|
||||||
Expression<String?>? darkColor,
|
Expression<String?>? darkColor,
|
||||||
Expression<bool>? steps,
|
Expression<bool>? steps,
|
||||||
|
@ -366,7 +369,7 @@ class SettingsCompanion extends UpdateCompanion<Setting> {
|
||||||
Value<String?>? sound,
|
Value<String?>? sound,
|
||||||
Value<bool>? notify,
|
Value<bool>? notify,
|
||||||
Value<bool>? images,
|
Value<bool>? images,
|
||||||
Value<bool>? showUnit,
|
Value<bool?>? showUnit,
|
||||||
Value<String?>? lightColor,
|
Value<String?>? lightColor,
|
||||||
Value<String?>? darkColor,
|
Value<String?>? darkColor,
|
||||||
Value<bool>? steps,
|
Value<bool>? steps,
|
||||||
|
@ -414,7 +417,7 @@ class SettingsCompanion extends UpdateCompanion<Setting> {
|
||||||
map['images'] = Variable<bool>(images.value);
|
map['images'] = Variable<bool>(images.value);
|
||||||
}
|
}
|
||||||
if (showUnit.present) {
|
if (showUnit.present) {
|
||||||
map['show_unit'] = Variable<bool>(showUnit.value);
|
map['show_unit'] = Variable<bool?>(showUnit.value);
|
||||||
}
|
}
|
||||||
if (lightColor.present) {
|
if (lightColor.present) {
|
||||||
map['light_color'] = Variable<String?>(lightColor.value);
|
map['light_color'] = Variable<String?>(lightColor.value);
|
||||||
|
@ -510,9 +513,9 @@ class $SettingsTable extends Settings with TableInfo<$SettingsTable, Setting> {
|
||||||
final VerificationMeta _showUnitMeta = const VerificationMeta('showUnit');
|
final VerificationMeta _showUnitMeta = const VerificationMeta('showUnit');
|
||||||
@override
|
@override
|
||||||
late final GeneratedColumn<bool?> showUnit = GeneratedColumn<bool?>(
|
late final GeneratedColumn<bool?> showUnit = GeneratedColumn<bool?>(
|
||||||
'show_unit', aliasedName, false,
|
'show_unit', aliasedName, true,
|
||||||
type: const BoolType(),
|
type: const BoolType(),
|
||||||
requiredDuringInsert: true,
|
requiredDuringInsert: false,
|
||||||
defaultConstraints: 'CHECK (show_unit IN (0, 1))');
|
defaultConstraints: 'CHECK (show_unit IN (0, 1))');
|
||||||
final VerificationMeta _lightColorMeta = const VerificationMeta('lightColor');
|
final VerificationMeta _lightColorMeta = const VerificationMeta('lightColor');
|
||||||
@override
|
@override
|
||||||
|
@ -627,8 +630,6 @@ class $SettingsTable extends Settings with TableInfo<$SettingsTable, Setting> {
|
||||||
if (data.containsKey('show_unit')) {
|
if (data.containsKey('show_unit')) {
|
||||||
context.handle(_showUnitMeta,
|
context.handle(_showUnitMeta,
|
||||||
showUnit.isAcceptableOrUnknown(data['show_unit']!, _showUnitMeta));
|
showUnit.isAcceptableOrUnknown(data['show_unit']!, _showUnitMeta));
|
||||||
} else if (isInserting) {
|
|
||||||
context.missing(_showUnitMeta);
|
|
||||||
}
|
}
|
||||||
if (data.containsKey('light_color')) {
|
if (data.containsKey('light_color')) {
|
||||||
context.handle(
|
context.handle(
|
||||||
|
|
|
@ -25,7 +25,7 @@ class Settings extends Table {
|
||||||
TextColumn get sound => text().nullable()();
|
TextColumn get sound => text().nullable()();
|
||||||
BoolColumn get notify => boolean()();
|
BoolColumn get notify => boolean()();
|
||||||
BoolColumn get images => boolean()();
|
BoolColumn get images => boolean()();
|
||||||
BoolColumn get showUnit => boolean()();
|
BoolColumn get showUnit => boolean().nullable()();
|
||||||
TextColumn get lightColor => text().nullable()();
|
TextColumn get lightColor => text().nullable()();
|
||||||
TextColumn get darkColor => text().nullable()();
|
TextColumn get darkColor => text().nullable()();
|
||||||
BoolColumn get steps => boolean()();
|
BoolColumn get steps => boolean()();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user