mirror of https://github.com/AMT-Cheif/drift.git
Avoid superfluous import
This commit is contained in:
parent
d553a7f679
commit
008dfaf798
|
@ -1,9 +1,11 @@
|
|||
// ignore_for_file: type=lint
|
||||
import 'package:drift/drift.dart' as i0;
|
||||
import 'package:drift_docs/snippets/_shared/todo_tables.drift.dart' as i1;
|
||||
import 'package:drift/internal/modular.dart' as i2;
|
||||
|
||||
abstract class $MyDatabase extends i0.GeneratedDatabase {
|
||||
$MyDatabase(i0.QueryExecutor e) : super(e);
|
||||
$MyDatabaseManager get managers => $MyDatabaseManager(this);
|
||||
late final i1.$CategoriesTable categories = i1.$CategoriesTable(this);
|
||||
late final i1.$TodoItemsTable todoItems = i1.$TodoItemsTable(this);
|
||||
i0.Selectable<CategoriesWithCountResult> categoriesWithCount() {
|
||||
|
@ -28,6 +30,226 @@ abstract class $MyDatabase extends i0.GeneratedDatabase {
|
|||
[categories, todoItems];
|
||||
}
|
||||
|
||||
class $$CategoriesTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$CategoriesTable> {
|
||||
$$CategoriesTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get name => i0.ColumnFilters($table.name);
|
||||
i0.ComposableFilter todoItemsRefs(
|
||||
i0.ComposableFilter Function($$TodoItemsTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i2.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$TodoItemsTable>('todo_items'),
|
||||
getCurrentColumn: (f) => f.id,
|
||||
getReferencedColumn: (f) => f.category,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$TodoItemsTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$CategoriesTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$CategoriesTable> {
|
||||
$$CategoriesTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get name => i0.ColumnOrderings($table.name);
|
||||
}
|
||||
|
||||
class $$CategoriesTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$CategoriesTable,
|
||||
i1.Category,
|
||||
$$CategoriesTableFilterComposer,
|
||||
$$CategoriesTableOrderingComposer,
|
||||
$$CategoriesTableProcessedTableManager,
|
||||
$$CategoriesTableInsertCompanionBuilder,
|
||||
$$CategoriesTableUpdateCompanionBuilder> {
|
||||
const $$CategoriesTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$CategoriesTableInsertCompanionBuilder = i1.CategoriesCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String name,
|
||||
});
|
||||
typedef $$CategoriesTableUpdateCompanionBuilder = i1.CategoriesCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> name,
|
||||
});
|
||||
|
||||
class $$CategoriesTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$CategoriesTable,
|
||||
i1.Category,
|
||||
$$CategoriesTableFilterComposer,
|
||||
$$CategoriesTableOrderingComposer,
|
||||
$$CategoriesTableProcessedTableManager,
|
||||
$$CategoriesTableInsertCompanionBuilder,
|
||||
$$CategoriesTableUpdateCompanionBuilder> {
|
||||
$$CategoriesTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$CategoriesTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$CategoriesTableFilterComposer(db, table),
|
||||
orderingComposer: $$CategoriesTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$CategoriesTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> name = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.CategoriesCompanion(
|
||||
id: id,
|
||||
name: name,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String name,
|
||||
}) =>
|
||||
i1.CategoriesCompanion.insert(
|
||||
id: id,
|
||||
name: name,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$TodoItemsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$TodoItemsTable> {
|
||||
$$TodoItemsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get title => i0.ColumnFilters($table.title);
|
||||
i0.ColumnFilters<String> get content => i0.ColumnFilters($table.content);
|
||||
i0.ColumnFilters<int> get categoryId => i0.ColumnFilters($table.category);
|
||||
i0.ComposableFilter category(
|
||||
i0.ComposableFilter Function($$CategoriesTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i2.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$CategoriesTable>('categories'),
|
||||
getCurrentColumn: (f) => f.category,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$CategoriesTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
|
||||
i0.ColumnFilters<DateTime> get dueDate => i0.ColumnFilters($table.dueDate);
|
||||
}
|
||||
|
||||
class $$TodoItemsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$TodoItemsTable> {
|
||||
$$TodoItemsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get title => i0.ColumnOrderings($table.title);
|
||||
i0.ColumnOrderings get content => i0.ColumnOrderings($table.content);
|
||||
i0.ColumnOrderings get categoryId => i0.ColumnOrderings($table.category);
|
||||
i0.ComposableOrdering category(
|
||||
i0.ComposableOrdering Function($$CategoriesTableOrderingComposer o) o) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i2.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$CategoriesTable>('categories'),
|
||||
getCurrentColumn: (f) => f.category,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$CategoriesTableOrderingComposer(db, table),
|
||||
builder: o);
|
||||
}
|
||||
|
||||
i0.ColumnOrderings get dueDate => i0.ColumnOrderings($table.dueDate);
|
||||
}
|
||||
|
||||
class $$TodoItemsTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$TodoItemsTable,
|
||||
i1.TodoItem,
|
||||
$$TodoItemsTableFilterComposer,
|
||||
$$TodoItemsTableOrderingComposer,
|
||||
$$TodoItemsTableProcessedTableManager,
|
||||
$$TodoItemsTableInsertCompanionBuilder,
|
||||
$$TodoItemsTableUpdateCompanionBuilder> {
|
||||
const $$TodoItemsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$TodoItemsTableInsertCompanionBuilder = i1.TodoItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String title,
|
||||
required String content,
|
||||
i0.Value<int?> category,
|
||||
i0.Value<DateTime?> dueDate,
|
||||
});
|
||||
typedef $$TodoItemsTableUpdateCompanionBuilder = i1.TodoItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> title,
|
||||
i0.Value<String> content,
|
||||
i0.Value<int?> category,
|
||||
i0.Value<DateTime?> dueDate,
|
||||
});
|
||||
|
||||
class $$TodoItemsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$TodoItemsTable,
|
||||
i1.TodoItem,
|
||||
$$TodoItemsTableFilterComposer,
|
||||
$$TodoItemsTableOrderingComposer,
|
||||
$$TodoItemsTableProcessedTableManager,
|
||||
$$TodoItemsTableInsertCompanionBuilder,
|
||||
$$TodoItemsTableUpdateCompanionBuilder> {
|
||||
$$TodoItemsTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$TodoItemsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$TodoItemsTableFilterComposer(db, table),
|
||||
orderingComposer: $$TodoItemsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$TodoItemsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> title = const i0.Value.absent(),
|
||||
i0.Value<String> content = const i0.Value.absent(),
|
||||
i0.Value<int?> category = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> dueDate = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.TodoItemsCompanion(
|
||||
id: id,
|
||||
title: title,
|
||||
content: content,
|
||||
category: category,
|
||||
dueDate: dueDate,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String title,
|
||||
required String content,
|
||||
i0.Value<int?> category = const i0.Value.absent(),
|
||||
i0.Value<DateTime?> dueDate = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.TodoItemsCompanion.insert(
|
||||
id: id,
|
||||
title: title,
|
||||
content: content,
|
||||
category: category,
|
||||
dueDate: dueDate,
|
||||
)));
|
||||
}
|
||||
|
||||
class $MyDatabaseManager {
|
||||
final $MyDatabase _db;
|
||||
$MyDatabaseManager(this._db);
|
||||
$$CategoriesTableTableManager get categories =>
|
||||
$$CategoriesTableTableManager(_db, _db.categories);
|
||||
$$TodoItemsTableTableManager get todoItems =>
|
||||
$$TodoItemsTableTableManager(_db, _db.todoItems);
|
||||
}
|
||||
|
||||
class CategoriesWithCountResult {
|
||||
final int id;
|
||||
final String name;
|
||||
|
|
|
@ -7,6 +7,7 @@ import 'package:drift_docs/snippets/modular/many_to_many/json.dart' as i3;
|
|||
|
||||
abstract class $JsonBasedDatabase extends i0.GeneratedDatabase {
|
||||
$JsonBasedDatabase(i0.QueryExecutor e) : super(e);
|
||||
$JsonBasedDatabaseManager get managers => $JsonBasedDatabaseManager(this);
|
||||
late final i1.$BuyableItemsTable buyableItems = i1.$BuyableItemsTable(this);
|
||||
late final i2.$ShoppingCartsTable shoppingCarts =
|
||||
i2.$ShoppingCartsTable(this);
|
||||
|
@ -18,6 +19,174 @@ abstract class $JsonBasedDatabase extends i0.GeneratedDatabase {
|
|||
[buyableItems, shoppingCarts];
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get description =>
|
||||
i0.ColumnFilters($table.description);
|
||||
i0.ColumnFilters<int> get price => i0.ColumnFilters($table.price);
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get description => i0.ColumnOrderings($table.description);
|
||||
i0.ColumnOrderings get price => i0.ColumnOrderings($table.price);
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
const $$BuyableItemsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$BuyableItemsTableInsertCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String description,
|
||||
required int price,
|
||||
});
|
||||
typedef $$BuyableItemsTableUpdateCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> description,
|
||||
i0.Value<int> price,
|
||||
});
|
||||
|
||||
class $$BuyableItemsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
$$BuyableItemsTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$BuyableItemsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$BuyableItemsTableFilterComposer(db, table),
|
||||
orderingComposer: $$BuyableItemsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$BuyableItemsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> description = const i0.Value.absent(),
|
||||
i0.Value<int> price = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String description,
|
||||
required int price,
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion.insert(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get entriesValue => i0.ColumnFilters($table.entries);
|
||||
i0.ColumnWithTypeConverterFilters<i3.ShoppingCartEntries, String>
|
||||
get entries => i0.ColumnWithTypeConverterFilters($table.entries);
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get entries => i0.ColumnOrderings($table.entries);
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableProcessedTableManager
|
||||
extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
const $$ShoppingCartsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$ShoppingCartsTableInsertCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required i3.ShoppingCartEntries entries,
|
||||
});
|
||||
typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<i3.ShoppingCartEntries> entries,
|
||||
});
|
||||
|
||||
class $$ShoppingCartsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
$$ShoppingCartsTableTableManager(
|
||||
i0.GeneratedDatabase db, i2.$ShoppingCartsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$ShoppingCartsTableFilterComposer(db, table),
|
||||
orderingComposer: $$ShoppingCartsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$ShoppingCartsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<i3.ShoppingCartEntries> entries =
|
||||
const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion(
|
||||
id: id,
|
||||
entries: entries,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required i3.ShoppingCartEntries entries,
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion.insert(
|
||||
id: id,
|
||||
entries: entries,
|
||||
)));
|
||||
}
|
||||
|
||||
class $JsonBasedDatabaseManager {
|
||||
final $JsonBasedDatabase _db;
|
||||
$JsonBasedDatabaseManager(this._db);
|
||||
$$BuyableItemsTableTableManager get buyableItems =>
|
||||
$$BuyableItemsTableTableManager(_db, _db.buyableItems);
|
||||
$$ShoppingCartsTableTableManager get shoppingCarts =>
|
||||
$$ShoppingCartsTableTableManager(_db, _db.shoppingCarts);
|
||||
}
|
||||
|
||||
class $ShoppingCartsTable extends i3.ShoppingCarts
|
||||
with i0.TableInfo<$ShoppingCartsTable, i2.ShoppingCart> {
|
||||
@override
|
||||
|
|
|
@ -4,10 +4,12 @@ import 'package:drift_docs/snippets/modular/many_to_many/shared.drift.dart'
|
|||
as i1;
|
||||
import 'package:drift_docs/snippets/modular/many_to_many/relational.drift.dart'
|
||||
as i2;
|
||||
import 'package:drift_docs/snippets/modular/many_to_many/relational.dart' as i3;
|
||||
import 'package:drift/internal/modular.dart' as i3;
|
||||
import 'package:drift_docs/snippets/modular/many_to_many/relational.dart' as i4;
|
||||
|
||||
abstract class $RelationalDatabase extends i0.GeneratedDatabase {
|
||||
$RelationalDatabase(i0.QueryExecutor e) : super(e);
|
||||
$RelationalDatabaseManager get managers => $RelationalDatabaseManager(this);
|
||||
late final i1.$BuyableItemsTable buyableItems = i1.$BuyableItemsTable(this);
|
||||
late final i2.$ShoppingCartsTable shoppingCarts =
|
||||
i2.$ShoppingCartsTable(this);
|
||||
|
@ -21,7 +23,327 @@ abstract class $RelationalDatabase extends i0.GeneratedDatabase {
|
|||
[buyableItems, shoppingCarts, shoppingCartEntries];
|
||||
}
|
||||
|
||||
class $ShoppingCartsTable extends i3.ShoppingCarts
|
||||
class $$BuyableItemsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ColumnFilters<String> get description =>
|
||||
i0.ColumnFilters($table.description);
|
||||
i0.ColumnFilters<int> get price => i0.ColumnFilters($table.price);
|
||||
i0.ComposableFilter shoppingCartEntriesRefs(
|
||||
i0.ComposableFilter Function($$ShoppingCartEntriesTableFilterComposer f)
|
||||
f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartEntriesTable>('shopping_cart_entries'),
|
||||
getCurrentColumn: (f) => f.id,
|
||||
getReferencedColumn: (f) => f.item,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartEntriesTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i1.$BuyableItemsTable> {
|
||||
$$BuyableItemsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
i0.ColumnOrderings get description => i0.ColumnOrderings($table.description);
|
||||
i0.ColumnOrderings get price => i0.ColumnOrderings($table.price);
|
||||
}
|
||||
|
||||
class $$BuyableItemsTableProcessedTableManager extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
const $$BuyableItemsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$BuyableItemsTableInsertCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
required String description,
|
||||
required int price,
|
||||
});
|
||||
typedef $$BuyableItemsTableUpdateCompanionBuilder = i1.BuyableItemsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
i0.Value<String> description,
|
||||
i0.Value<int> price,
|
||||
});
|
||||
|
||||
class $$BuyableItemsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i1.$BuyableItemsTable,
|
||||
i1.BuyableItem,
|
||||
$$BuyableItemsTableFilterComposer,
|
||||
$$BuyableItemsTableOrderingComposer,
|
||||
$$BuyableItemsTableProcessedTableManager,
|
||||
$$BuyableItemsTableInsertCompanionBuilder,
|
||||
$$BuyableItemsTableUpdateCompanionBuilder> {
|
||||
$$BuyableItemsTableTableManager(
|
||||
i0.GeneratedDatabase db, i1.$BuyableItemsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$BuyableItemsTableFilterComposer(db, table),
|
||||
orderingComposer: $$BuyableItemsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$BuyableItemsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
i0.Value<String> description = const i0.Value.absent(),
|
||||
i0.Value<int> price = const i0.Value.absent(),
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
required String description,
|
||||
required int price,
|
||||
}) =>
|
||||
i1.BuyableItemsCompanion.insert(
|
||||
id: id,
|
||||
description: description,
|
||||
price: price,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableFilterComposer
|
||||
extends i0.FilterComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get id => i0.ColumnFilters($table.id);
|
||||
i0.ComposableFilter shoppingCartEntriesRefs(
|
||||
i0.ComposableFilter Function($$ShoppingCartEntriesTableFilterComposer f)
|
||||
f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartEntriesTable>('shopping_cart_entries'),
|
||||
getCurrentColumn: (f) => f.id,
|
||||
getReferencedColumn: (f) => f.shoppingCart,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartEntriesTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableOrderingComposer
|
||||
extends i0.OrderingComposer<i0.GeneratedDatabase, i2.$ShoppingCartsTable> {
|
||||
$$ShoppingCartsTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get id => i0.ColumnOrderings($table.id);
|
||||
}
|
||||
|
||||
class $$ShoppingCartsTableProcessedTableManager
|
||||
extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
const $$ShoppingCartsTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$ShoppingCartsTableInsertCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
});
|
||||
typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion
|
||||
Function({
|
||||
i0.Value<int> id,
|
||||
});
|
||||
|
||||
class $$ShoppingCartsTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartsTable,
|
||||
i2.ShoppingCart,
|
||||
$$ShoppingCartsTableFilterComposer,
|
||||
$$ShoppingCartsTableOrderingComposer,
|
||||
$$ShoppingCartsTableProcessedTableManager,
|
||||
$$ShoppingCartsTableInsertCompanionBuilder,
|
||||
$$ShoppingCartsTableUpdateCompanionBuilder> {
|
||||
$$ShoppingCartsTableTableManager(
|
||||
i0.GeneratedDatabase db, i2.$ShoppingCartsTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer: $$ShoppingCartsTableFilterComposer(db, table),
|
||||
orderingComposer: $$ShoppingCartsTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$ShoppingCartsTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion(
|
||||
id: id,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
i0.Value<int> id = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartsCompanion.insert(
|
||||
id: id,
|
||||
)));
|
||||
}
|
||||
|
||||
class $$ShoppingCartEntriesTableFilterComposer extends i0
|
||||
.FilterComposer<i0.GeneratedDatabase, i2.$ShoppingCartEntriesTable> {
|
||||
$$ShoppingCartEntriesTableFilterComposer(super.db, super.table);
|
||||
i0.ColumnFilters<int> get shoppingCartId =>
|
||||
i0.ColumnFilters($table.shoppingCart);
|
||||
i0.ComposableFilter shoppingCart(
|
||||
i0.ComposableFilter Function($$ShoppingCartsTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartsTable>('shopping_carts'),
|
||||
getCurrentColumn: (f) => f.shoppingCart,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartsTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
|
||||
i0.ColumnFilters<int> get itemId => i0.ColumnFilters($table.item);
|
||||
i0.ComposableFilter item(
|
||||
i0.ComposableFilter Function($$BuyableItemsTableFilterComposer f) f) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$BuyableItemsTable>('buyable_items'),
|
||||
getCurrentColumn: (f) => f.item,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$BuyableItemsTableFilterComposer(db, table),
|
||||
builder: f);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ShoppingCartEntriesTableOrderingComposer extends i0
|
||||
.OrderingComposer<i0.GeneratedDatabase, i2.$ShoppingCartEntriesTable> {
|
||||
$$ShoppingCartEntriesTableOrderingComposer(super.db, super.table);
|
||||
i0.ColumnOrderings get shoppingCartId =>
|
||||
i0.ColumnOrderings($table.shoppingCart);
|
||||
i0.ComposableOrdering shoppingCart(
|
||||
i0.ComposableOrdering Function($$ShoppingCartsTableOrderingComposer o)
|
||||
o) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i2.$ShoppingCartsTable>('shopping_carts'),
|
||||
getCurrentColumn: (f) => f.shoppingCart,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$ShoppingCartsTableOrderingComposer(db, table),
|
||||
builder: o);
|
||||
}
|
||||
|
||||
i0.ColumnOrderings get itemId => i0.ColumnOrderings($table.item);
|
||||
i0.ComposableOrdering item(
|
||||
i0.ComposableOrdering Function($$BuyableItemsTableOrderingComposer o) o) {
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: i3.ReadDatabaseContainer($db)
|
||||
.resultSet<i1.$BuyableItemsTable>('buyable_items'),
|
||||
getCurrentColumn: (f) => f.item,
|
||||
getReferencedColumn: (f) => f.id,
|
||||
getReferencedComposer: (db, table) =>
|
||||
$$BuyableItemsTableOrderingComposer(db, table),
|
||||
builder: o);
|
||||
}
|
||||
}
|
||||
|
||||
class $$ShoppingCartEntriesTableProcessedTableManager
|
||||
extends i0.ProcessedTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartEntriesTable,
|
||||
i2.ShoppingCartEntry,
|
||||
$$ShoppingCartEntriesTableFilterComposer,
|
||||
$$ShoppingCartEntriesTableOrderingComposer,
|
||||
$$ShoppingCartEntriesTableProcessedTableManager,
|
||||
$$ShoppingCartEntriesTableInsertCompanionBuilder,
|
||||
$$ShoppingCartEntriesTableUpdateCompanionBuilder> {
|
||||
const $$ShoppingCartEntriesTableProcessedTableManager(super.$state);
|
||||
}
|
||||
|
||||
typedef $$ShoppingCartEntriesTableInsertCompanionBuilder
|
||||
= i2.ShoppingCartEntriesCompanion Function({
|
||||
required int shoppingCart,
|
||||
required int item,
|
||||
});
|
||||
typedef $$ShoppingCartEntriesTableUpdateCompanionBuilder
|
||||
= i2.ShoppingCartEntriesCompanion Function({
|
||||
i0.Value<int> shoppingCart,
|
||||
i0.Value<int> item,
|
||||
});
|
||||
|
||||
class $$ShoppingCartEntriesTableTableManager extends i0.RootTableManager<
|
||||
i0.GeneratedDatabase,
|
||||
i2.$ShoppingCartEntriesTable,
|
||||
i2.ShoppingCartEntry,
|
||||
$$ShoppingCartEntriesTableFilterComposer,
|
||||
$$ShoppingCartEntriesTableOrderingComposer,
|
||||
$$ShoppingCartEntriesTableProcessedTableManager,
|
||||
$$ShoppingCartEntriesTableInsertCompanionBuilder,
|
||||
$$ShoppingCartEntriesTableUpdateCompanionBuilder> {
|
||||
$$ShoppingCartEntriesTableTableManager(
|
||||
i0.GeneratedDatabase db, i2.$ShoppingCartEntriesTable table)
|
||||
: super(i0.TableManagerState(
|
||||
db: db,
|
||||
table: table,
|
||||
filteringComposer:
|
||||
$$ShoppingCartEntriesTableFilterComposer(db, table),
|
||||
orderingComposer:
|
||||
$$ShoppingCartEntriesTableOrderingComposer(db, table),
|
||||
getChildManagerBuilder: (p0) =>
|
||||
$$ShoppingCartEntriesTableProcessedTableManager(p0),
|
||||
getUpdateCompanionBuilder: ({
|
||||
i0.Value<int> shoppingCart = const i0.Value.absent(),
|
||||
i0.Value<int> item = const i0.Value.absent(),
|
||||
}) =>
|
||||
i2.ShoppingCartEntriesCompanion(
|
||||
shoppingCart: shoppingCart,
|
||||
item: item,
|
||||
),
|
||||
getInsertCompanionBuilder: ({
|
||||
required int shoppingCart,
|
||||
required int item,
|
||||
}) =>
|
||||
i2.ShoppingCartEntriesCompanion.insert(
|
||||
shoppingCart: shoppingCart,
|
||||
item: item,
|
||||
)));
|
||||
}
|
||||
|
||||
class $RelationalDatabaseManager {
|
||||
final $RelationalDatabase _db;
|
||||
$RelationalDatabaseManager(this._db);
|
||||
$$BuyableItemsTableTableManager get buyableItems =>
|
||||
$$BuyableItemsTableTableManager(_db, _db.buyableItems);
|
||||
$$ShoppingCartsTableTableManager get shoppingCarts =>
|
||||
$$ShoppingCartsTableTableManager(_db, _db.shoppingCarts);
|
||||
$$ShoppingCartEntriesTableTableManager get shoppingCartEntries =>
|
||||
$$ShoppingCartEntriesTableTableManager(_db, _db.shoppingCartEntries);
|
||||
}
|
||||
|
||||
class $ShoppingCartsTable extends i4.ShoppingCarts
|
||||
with i0.TableInfo<$ShoppingCartsTable, i2.ShoppingCart> {
|
||||
@override
|
||||
final i0.GeneratedDatabase attachedDatabase;
|
||||
|
@ -163,7 +485,7 @@ class ShoppingCartsCompanion extends i0.UpdateCompanion<i2.ShoppingCart> {
|
|||
}
|
||||
}
|
||||
|
||||
class $ShoppingCartEntriesTable extends i3.ShoppingCartEntries
|
||||
class $ShoppingCartEntriesTable extends i4.ShoppingCartEntries
|
||||
with i0.TableInfo<$ShoppingCartEntriesTable, i2.ShoppingCartEntry> {
|
||||
@override
|
||||
final i0.GeneratedDatabase attachedDatabase;
|
||||
|
|
|
@ -411,6 +411,17 @@ class _TableWriter {
|
|||
_writeRootTable(leaf);
|
||||
}
|
||||
|
||||
String _referenceTable(DriftTable table) {
|
||||
if (scope.generationOptions.isModular) {
|
||||
final extension = scope.refUri(
|
||||
ModularAccessorWriter.modularSupport, 'ReadDatabaseContainer');
|
||||
final type = scope.dartCode(scope.entityInfoType(table));
|
||||
return "$extension(\$db).resultSet<$type>('${table.schemaName}')";
|
||||
} else {
|
||||
return '\$db.${table.dbGetterName}';
|
||||
}
|
||||
}
|
||||
|
||||
/// Add filters and orderings for the columns of this table
|
||||
void addFiltersAndOrderings(List<DriftTable> tables) {
|
||||
// Utility function to get the referenced table and column
|
||||
|
@ -482,9 +493,7 @@ class _TableWriter {
|
|||
final referencedTableNames =
|
||||
_TableWriter(referencedTable, scope, dbScope, databaseGenericName);
|
||||
final referencedColumnNames = _ColumnWriter(referencedCol.nameInDart);
|
||||
final String referencedTableField = scope.generationOptions.isModular
|
||||
? "\$db.resultSet<${referencedTableNames.tableClassName}>('${referencedTable.schemaName}')"
|
||||
: "\$db.${referencedTable.dbGetterName}";
|
||||
final referencedTableField = _referenceTable(referencedTable);
|
||||
|
||||
c.filters.add(_ReferencedFilterWriter(c.fieldGetter,
|
||||
fieldGetter: c.fieldGetter,
|
||||
|
@ -510,9 +519,7 @@ class _TableWriter {
|
|||
final referencedTableNames =
|
||||
_TableWriter(ot, scope, dbScope, databaseGenericName);
|
||||
final referencedColumnNames = _ColumnWriter(oc.nameInDart);
|
||||
final String referencedTableField = scope.generationOptions.isModular
|
||||
? "\$db.resultSet<${referencedTableNames.tableClassName}>('${ot.schemaName}')"
|
||||
: "\$db.${ot.dbGetterName}";
|
||||
final referencedTableField = _referenceTable(ot);
|
||||
|
||||
final filterName = oc.referenceName ??
|
||||
"${referencedTableNames.table.dbGetterName}Refs";
|
||||
|
@ -588,12 +595,6 @@ class ManagerWriter {
|
|||
void write() {
|
||||
final leaf = _scope.leaf();
|
||||
|
||||
// When generating with modular generation, we need to add the imports
|
||||
// for the internal `resultSet` helper
|
||||
if (_scope.generationOptions.isModular) {
|
||||
leaf.refUri(ModularAccessorWriter.modularSupport, '');
|
||||
}
|
||||
|
||||
// Write the manager class for each table
|
||||
final tableWriters = <_TableWriter>[];
|
||||
for (var table in _addedTables) {
|
||||
|
|
|
@ -5,7 +5,6 @@ import 'package:analyzer/file_system/memory_file_system.dart';
|
|||
import 'package:build/build.dart';
|
||||
import 'package:build_test/build_test.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:pub_semver/pub_semver.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../utils.dart';
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/internal/manager.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:flutter/material.dart' show Color;
|
||||
import 'package:manager/tables.dart';
|
||||
|
|
|
@ -960,7 +960,7 @@ class $$ProductsTableFilterComposer
|
|||
ColumnWithTypeConverterFilters($table.color);
|
||||
ComposableFilter listings(
|
||||
ComposableFilter Function($$ListingsTableFilterComposer f) f) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.listings,
|
||||
|
@ -1063,7 +1063,7 @@ class $$OwnerTableFilterComposer
|
|||
ColumnFilters<String> get name => ColumnFilters($table.name);
|
||||
ComposableFilter stores(
|
||||
ComposableFilter Function($$StoreTableFilterComposer f) f) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.store,
|
||||
|
@ -1146,7 +1146,7 @@ class $$StoreTableFilterComposer
|
|||
ColumnFilters<int> get ownerId => ColumnFilters($table.owner);
|
||||
ComposableFilter owner(
|
||||
ComposableFilter Function($$OwnerTableFilterComposer f) f) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.owner,
|
||||
|
@ -1159,7 +1159,7 @@ class $$StoreTableFilterComposer
|
|||
|
||||
ComposableFilter listings(
|
||||
ComposableFilter Function($$ListingsTableFilterComposer f) f) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.listings,
|
||||
|
@ -1179,7 +1179,7 @@ class $$StoreTableOrderingComposer
|
|||
ColumnOrderings get ownerId => ColumnOrderings($table.owner);
|
||||
ComposableOrdering owner(
|
||||
ComposableOrdering Function($$OwnerTableOrderingComposer o) o) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.owner,
|
||||
|
@ -1260,7 +1260,7 @@ class $$ListingsTableFilterComposer
|
|||
ColumnFilters<int> get productId => ColumnFilters($table.product);
|
||||
ComposableFilter product(
|
||||
ComposableFilter Function($$ProductsTableFilterComposer f) f) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.products,
|
||||
|
@ -1274,7 +1274,7 @@ class $$ListingsTableFilterComposer
|
|||
ColumnFilters<int> get storeId => ColumnFilters($table.store);
|
||||
ComposableFilter store(
|
||||
ComposableFilter Function($$StoreTableFilterComposer f) f) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.store,
|
||||
|
@ -1295,7 +1295,7 @@ class $$ListingsTableOrderingComposer
|
|||
ColumnOrderings get productId => ColumnOrderings($table.product);
|
||||
ComposableOrdering product(
|
||||
ComposableOrdering Function($$ProductsTableOrderingComposer o) o) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.products,
|
||||
|
@ -1309,7 +1309,7 @@ class $$ListingsTableOrderingComposer
|
|||
ColumnOrderings get storeId => ColumnOrderings($table.store);
|
||||
ComposableOrdering store(
|
||||
ComposableOrdering Function($$StoreTableOrderingComposer o) o) {
|
||||
return composeWithJoins(
|
||||
return $composeWithJoins(
|
||||
$db: $db,
|
||||
$table: $table,
|
||||
referencedTable: $db.store,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
@ -11,7 +10,7 @@ import 'package:manager/pages/store.dart';
|
|||
late final AppDatabase db;
|
||||
void main() {
|
||||
db = AppDatabase();
|
||||
runApp(ProviderScope(child: const MyApp()));
|
||||
runApp(const ProviderScope(child: MyApp()));
|
||||
}
|
||||
|
||||
class MyApp extends StatelessWidget {
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
@ -43,7 +42,7 @@ class ListingPage extends HookConsumerWidget {
|
|||
onPressed: () {
|
||||
db.managers.products.delete(product);
|
||||
},
|
||||
icon: Icon(Icons.delete)),
|
||||
icon: const Icon(Icons.delete)),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: product.color,
|
||||
),
|
||||
|
@ -66,14 +65,14 @@ class ListingPage extends HookConsumerWidget {
|
|||
final store = useState<StoreData?>(null);
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text("Add Listing"),
|
||||
title: const Text("Add Listing"),
|
||||
children: [
|
||||
TextField(
|
||||
controller: priceTextController,
|
||||
decoration: InputDecoration(labelText: "Price"),
|
||||
decoration: const InputDecoration(labelText: "Price"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Product"),
|
||||
title: const Text("Product"),
|
||||
subtitle: product.value == null
|
||||
? null
|
||||
: Text(product.value!.name),
|
||||
|
@ -86,7 +85,7 @@ class ListingPage extends HookConsumerWidget {
|
|||
db.managers.products.all().watch());
|
||||
final items = data.data ?? [];
|
||||
return SimpleDialog(
|
||||
title: Text("Select Product"),
|
||||
title: const Text("Select Product"),
|
||||
children: [
|
||||
...items.map((e) => ListTile(
|
||||
title: Text(e.name),
|
||||
|
@ -102,7 +101,7 @@ class ListingPage extends HookConsumerWidget {
|
|||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Store"),
|
||||
title: const Text("Store"),
|
||||
subtitle: store.value == null
|
||||
? null
|
||||
: Text(store.value!.name),
|
||||
|
@ -115,7 +114,7 @@ class ListingPage extends HookConsumerWidget {
|
|||
db.managers.store.all().watch());
|
||||
final items = data.data ?? [];
|
||||
return SimpleDialog(
|
||||
title: Text("Select Store"),
|
||||
title: const Text("Select Store"),
|
||||
children: [
|
||||
...items.map((e) => ListTile(
|
||||
title: Text(e.name),
|
||||
|
@ -138,13 +137,13 @@ class ListingPage extends HookConsumerWidget {
|
|||
store: store.value!.id));
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text("Add"))
|
||||
child: const Text("Add"))
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: body,
|
||||
);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:manager/database.dart';
|
||||
import 'package:manager/main.dart';
|
||||
import 'package:manager/tables.dart';
|
||||
|
||||
class OwnersPage extends HookConsumerWidget {
|
||||
const OwnersPage({super.key});
|
||||
|
@ -27,7 +25,7 @@ class OwnersPage extends HookConsumerWidget {
|
|||
onPressed: () {
|
||||
db.managers.owner.delete(product);
|
||||
},
|
||||
icon: Icon(Icons.delete)),
|
||||
icon: const Icon(Icons.delete)),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -45,11 +43,11 @@ class OwnersPage extends HookConsumerWidget {
|
|||
final nameTextController = useTextEditingController();
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text("Add Owner"),
|
||||
title: const Text("Add Owner"),
|
||||
children: [
|
||||
TextField(
|
||||
controller: nameTextController,
|
||||
decoration: InputDecoration(labelText: "Name"),
|
||||
decoration: const InputDecoration(labelText: "Name"),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
|
@ -58,13 +56,13 @@ class OwnersPage extends HookConsumerWidget {
|
|||
));
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text("Add"))
|
||||
child: const Text("Add"))
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: body,
|
||||
);
|
||||
|
|
|
@ -27,7 +27,7 @@ class ProductPage extends HookConsumerWidget {
|
|||
onPressed: () {
|
||||
db.managers.products.delete(product);
|
||||
},
|
||||
icon: Icon(Icons.delete)),
|
||||
icon: const Icon(Icons.delete)),
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: product.color,
|
||||
),
|
||||
|
@ -51,21 +51,21 @@ class ProductPage extends HookConsumerWidget {
|
|||
final releaseDate = useState<DateTime?>(null);
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text("Add Product"),
|
||||
title: const Text("Add Product"),
|
||||
children: [
|
||||
TextField(
|
||||
controller: nameTextController,
|
||||
decoration: InputDecoration(labelText: "Name"),
|
||||
decoration: const InputDecoration(labelText: "Name"),
|
||||
),
|
||||
TextField(
|
||||
controller: descriptionTextController,
|
||||
decoration: InputDecoration(labelText: "Description"),
|
||||
decoration: const InputDecoration(labelText: "Description"),
|
||||
),
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: color.value,
|
||||
),
|
||||
title: Text("Color"),
|
||||
title: const Text("Color"),
|
||||
onTap: () {
|
||||
showColorPickerDialog(
|
||||
context, color.value ?? Colors.blue)
|
||||
|
@ -73,8 +73,8 @@ class ProductPage extends HookConsumerWidget {
|
|||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.calendar_month),
|
||||
title: Text("Date"),
|
||||
leading: const Icon(Icons.calendar_month),
|
||||
title: const Text("Date"),
|
||||
subtitle: releaseDate.value != null
|
||||
? Text(releaseDate.value.toString())
|
||||
: null,
|
||||
|
@ -98,13 +98,13 @@ class ProductPage extends HookConsumerWidget {
|
|||
releaseDate: releaseDate.value!));
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text("Add"))
|
||||
child: const Text("Add"))
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: body,
|
||||
);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import 'package:flex_color_picker/flex_color_picker.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
@ -36,7 +35,7 @@ class StorePage extends HookConsumerWidget {
|
|||
onPressed: () {
|
||||
db.managers.store.delete(store);
|
||||
},
|
||||
icon: Icon(Icons.delete)),
|
||||
icon: const Icon(Icons.delete)),
|
||||
);
|
||||
},
|
||||
);
|
||||
|
@ -55,14 +54,14 @@ class StorePage extends HookConsumerWidget {
|
|||
final owner = useState<OwnerData?>(null);
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text("Add Store"),
|
||||
title: const Text("Add Store"),
|
||||
children: [
|
||||
TextField(
|
||||
controller: nameTextController,
|
||||
decoration: InputDecoration(labelText: "Name"),
|
||||
decoration: const InputDecoration(labelText: "Name"),
|
||||
),
|
||||
ListTile(
|
||||
title: Text("Owner"),
|
||||
title: const Text("Owner"),
|
||||
subtitle: Text(owner.value?.name ?? "Select Owner"),
|
||||
onTap: () {
|
||||
showDialog(
|
||||
|
@ -74,7 +73,7 @@ class StorePage extends HookConsumerWidget {
|
|||
final data = useStream(stream);
|
||||
|
||||
return SimpleDialog(
|
||||
title: Text("Select Owner"),
|
||||
title: const Text("Select Owner"),
|
||||
children: [
|
||||
if (data.hasData)
|
||||
for (final o in data.data!)
|
||||
|
@ -98,13 +97,13 @@ class StorePage extends HookConsumerWidget {
|
|||
owner: owner.value!.id));
|
||||
Navigator.of(ctx).pop();
|
||||
},
|
||||
child: Text("Add"))
|
||||
child: const Text("Add"))
|
||||
],
|
||||
);
|
||||
});
|
||||
});
|
||||
},
|
||||
child: Icon(Icons.add),
|
||||
child: const Icon(Icons.add),
|
||||
),
|
||||
body: body,
|
||||
);
|
||||
|
|
|
@ -33,9 +33,3 @@ dev_dependencies:
|
|||
|
||||
flutter:
|
||||
uses-material-design: true
|
||||
|
||||
dependency_overrides:
|
||||
drift_dev:
|
||||
path: C:/Users/dicke/drift/drift_dev
|
||||
drift:
|
||||
path: C:/Users/dicke/drift/drift
|
||||
|
|
Loading…
Reference in New Issue