mirror of
https://github.com/wger-project/flutter.git
synced 2026-11-30 17:52:35 +01:00
This allows the user to use the system settings as well, and not always force light or dark mode in the app. Also move the logic to the UserProvider and do some light refactoring.
370 lines
13 KiB
Dart
370 lines
13 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'ingredients_database.dart';
|
|
|
|
// ignore_for_file: type=lint
|
|
class $IngredientsTable extends Ingredients with TableInfo<$IngredientsTable, IngredientTable> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$IngredientsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>('id', aliasedName, false,
|
|
type: DriftSqlType.int, requiredDuringInsert: true);
|
|
static const VerificationMeta _dataMeta = const VerificationMeta('data');
|
|
@override
|
|
late final GeneratedColumn<String> data = GeneratedColumn<String>('data', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
static const VerificationMeta _lastFetchedMeta = const VerificationMeta('lastFetched');
|
|
@override
|
|
late final GeneratedColumn<DateTime> lastFetched = GeneratedColumn<DateTime>(
|
|
'last_fetched', aliasedName, false,
|
|
type: DriftSqlType.dateTime, requiredDuringInsert: true);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, data, lastFetched];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'ingredients';
|
|
@override
|
|
VerificationContext validateIntegrity(Insertable<IngredientTable> instance,
|
|
{bool isInserting = false}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
} else if (isInserting) {
|
|
context.missing(_idMeta);
|
|
}
|
|
if (data.containsKey('data')) {
|
|
context.handle(_dataMeta, this.data.isAcceptableOrUnknown(data['data']!, _dataMeta));
|
|
} else if (isInserting) {
|
|
context.missing(_dataMeta);
|
|
}
|
|
if (data.containsKey('last_fetched')) {
|
|
context.handle(_lastFetchedMeta,
|
|
lastFetched.isAcceptableOrUnknown(data['last_fetched']!, _lastFetchedMeta));
|
|
} else if (isInserting) {
|
|
context.missing(_lastFetchedMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => const {};
|
|
@override
|
|
IngredientTable map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return IngredientTable(
|
|
id: attachedDatabase.typeMapping.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
data: attachedDatabase.typeMapping.read(DriftSqlType.string, data['${effectivePrefix}data'])!,
|
|
lastFetched: attachedDatabase.typeMapping
|
|
.read(DriftSqlType.dateTime, data['${effectivePrefix}last_fetched'])!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$IngredientsTable createAlias(String alias) {
|
|
return $IngredientsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class IngredientTable extends DataClass implements Insertable<IngredientTable> {
|
|
final int id;
|
|
final String data;
|
|
|
|
/// The date when the ingredient was last fetched from the server
|
|
final DateTime lastFetched;
|
|
const IngredientTable({required this.id, required this.data, required this.lastFetched});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['data'] = Variable<String>(data);
|
|
map['last_fetched'] = Variable<DateTime>(lastFetched);
|
|
return map;
|
|
}
|
|
|
|
IngredientsCompanion toCompanion(bool nullToAbsent) {
|
|
return IngredientsCompanion(
|
|
id: Value(id),
|
|
data: Value(data),
|
|
lastFetched: Value(lastFetched),
|
|
);
|
|
}
|
|
|
|
factory IngredientTable.fromJson(Map<String, dynamic> json, {ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return IngredientTable(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
data: serializer.fromJson<String>(json['data']),
|
|
lastFetched: serializer.fromJson<DateTime>(json['lastFetched']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'data': serializer.toJson<String>(data),
|
|
'lastFetched': serializer.toJson<DateTime>(lastFetched),
|
|
};
|
|
}
|
|
|
|
IngredientTable copyWith({int? id, String? data, DateTime? lastFetched}) => IngredientTable(
|
|
id: id ?? this.id,
|
|
data: data ?? this.data,
|
|
lastFetched: lastFetched ?? this.lastFetched,
|
|
);
|
|
IngredientTable copyWithCompanion(IngredientsCompanion data) {
|
|
return IngredientTable(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
data: data.data.present ? data.data.value : this.data,
|
|
lastFetched: data.lastFetched.present ? data.lastFetched.value : this.lastFetched,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('IngredientTable(')
|
|
..write('id: $id, ')
|
|
..write('data: $data, ')
|
|
..write('lastFetched: $lastFetched')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, data, lastFetched);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is IngredientTable &&
|
|
other.id == this.id &&
|
|
other.data == this.data &&
|
|
other.lastFetched == this.lastFetched);
|
|
}
|
|
|
|
class IngredientsCompanion extends UpdateCompanion<IngredientTable> {
|
|
final Value<int> id;
|
|
final Value<String> data;
|
|
final Value<DateTime> lastFetched;
|
|
final Value<int> rowid;
|
|
const IngredientsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.data = const Value.absent(),
|
|
this.lastFetched = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
IngredientsCompanion.insert({
|
|
required int id,
|
|
required String data,
|
|
required DateTime lastFetched,
|
|
this.rowid = const Value.absent(),
|
|
}) : id = Value(id),
|
|
data = Value(data),
|
|
lastFetched = Value(lastFetched);
|
|
static Insertable<IngredientTable> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? data,
|
|
Expression<DateTime>? lastFetched,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (data != null) 'data': data,
|
|
if (lastFetched != null) 'last_fetched': lastFetched,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
IngredientsCompanion copyWith(
|
|
{Value<int>? id, Value<String>? data, Value<DateTime>? lastFetched, Value<int>? rowid}) {
|
|
return IngredientsCompanion(
|
|
id: id ?? this.id,
|
|
data: data ?? this.data,
|
|
lastFetched: lastFetched ?? this.lastFetched,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (data.present) {
|
|
map['data'] = Variable<String>(data.value);
|
|
}
|
|
if (lastFetched.present) {
|
|
map['last_fetched'] = Variable<DateTime>(lastFetched.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('IngredientsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('data: $data, ')
|
|
..write('lastFetched: $lastFetched, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
abstract class _$IngredientDatabase extends GeneratedDatabase {
|
|
_$IngredientDatabase(QueryExecutor e) : super(e);
|
|
$IngredientDatabaseManager get managers => $IngredientDatabaseManager(this);
|
|
late final $IngredientsTable ingredients = $IngredientsTable(this);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [ingredients];
|
|
}
|
|
|
|
typedef $$IngredientsTableCreateCompanionBuilder = IngredientsCompanion Function({
|
|
required int id,
|
|
required String data,
|
|
required DateTime lastFetched,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$IngredientsTableUpdateCompanionBuilder = IngredientsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> data,
|
|
Value<DateTime> lastFetched,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
class $$IngredientsTableFilterComposer extends Composer<_$IngredientDatabase, $IngredientsTable> {
|
|
$$IngredientsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => ColumnFilters(column));
|
|
|
|
ColumnFilters<String> get data =>
|
|
$composableBuilder(column: $table.data, builder: (column) => ColumnFilters(column));
|
|
|
|
ColumnFilters<DateTime> get lastFetched =>
|
|
$composableBuilder(column: $table.lastFetched, builder: (column) => ColumnFilters(column));
|
|
}
|
|
|
|
class $$IngredientsTableOrderingComposer extends Composer<_$IngredientDatabase, $IngredientsTable> {
|
|
$$IngredientsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => ColumnOrderings(column));
|
|
|
|
ColumnOrderings<String> get data =>
|
|
$composableBuilder(column: $table.data, builder: (column) => ColumnOrderings(column));
|
|
|
|
ColumnOrderings<DateTime> get lastFetched =>
|
|
$composableBuilder(column: $table.lastFetched, builder: (column) => ColumnOrderings(column));
|
|
}
|
|
|
|
class $$IngredientsTableAnnotationComposer
|
|
extends Composer<_$IngredientDatabase, $IngredientsTable> {
|
|
$$IngredientsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id => $composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get data =>
|
|
$composableBuilder(column: $table.data, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get lastFetched =>
|
|
$composableBuilder(column: $table.lastFetched, builder: (column) => column);
|
|
}
|
|
|
|
class $$IngredientsTableTableManager extends RootTableManager<
|
|
_$IngredientDatabase,
|
|
$IngredientsTable,
|
|
IngredientTable,
|
|
$$IngredientsTableFilterComposer,
|
|
$$IngredientsTableOrderingComposer,
|
|
$$IngredientsTableAnnotationComposer,
|
|
$$IngredientsTableCreateCompanionBuilder,
|
|
$$IngredientsTableUpdateCompanionBuilder,
|
|
(IngredientTable, BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>),
|
|
IngredientTable,
|
|
PrefetchHooks Function()> {
|
|
$$IngredientsTableTableManager(_$IngredientDatabase db, $IngredientsTable table)
|
|
: super(TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () => $$IngredientsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () => $$IngredientsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$IngredientsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback: ({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> data = const Value.absent(),
|
|
Value<DateTime> lastFetched = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) =>
|
|
IngredientsCompanion(
|
|
id: id,
|
|
data: data,
|
|
lastFetched: lastFetched,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback: ({
|
|
required int id,
|
|
required String data,
|
|
required DateTime lastFetched,
|
|
Value<int> rowid = const Value.absent(),
|
|
}) =>
|
|
IngredientsCompanion.insert(
|
|
id: id,
|
|
data: data,
|
|
lastFetched: lastFetched,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) =>
|
|
p0.map((e) => (e.readTable(table), BaseReferences(db, table, e))).toList(),
|
|
prefetchHooksCallback: null,
|
|
));
|
|
}
|
|
|
|
typedef $$IngredientsTableProcessedTableManager = ProcessedTableManager<
|
|
_$IngredientDatabase,
|
|
$IngredientsTable,
|
|
IngredientTable,
|
|
$$IngredientsTableFilterComposer,
|
|
$$IngredientsTableOrderingComposer,
|
|
$$IngredientsTableAnnotationComposer,
|
|
$$IngredientsTableCreateCompanionBuilder,
|
|
$$IngredientsTableUpdateCompanionBuilder,
|
|
(IngredientTable, BaseReferences<_$IngredientDatabase, $IngredientsTable, IngredientTable>),
|
|
IngredientTable,
|
|
PrefetchHooks Function()>;
|
|
|
|
class $IngredientDatabaseManager {
|
|
final _$IngredientDatabase _db;
|
|
$IngredientDatabaseManager(this._db);
|
|
$$IngredientsTableTableManager get ingredients =>
|
|
$$IngredientsTableTableManager(_db, _db.ingredients);
|
|
}
|