|
|
@ -8,7 +8,7 @@ class CollectionEditPage extends StatefulWidget {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class _CollectionEditPageState extends State<CollectionEditPage> {
|
|
|
|
class _CollectionEditPageState extends State<CollectionEditPage> {
|
|
|
|
List<Map<String, dynamic>> collections = []; // 存储数据库查询结果
|
|
|
|
List<Map<String, dynamic>> collections = [];
|
|
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
void initState() {
|
|
|
@ -18,8 +18,9 @@ class _CollectionEditPageState extends State<CollectionEditPage> {
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> _loadCollectionsFromDatabase() async {
|
|
|
|
Future<void> _loadCollectionsFromDatabase() async {
|
|
|
|
final databasePath = await getDatabasesPath();
|
|
|
|
final databasePath = await getDatabasesPath();
|
|
|
|
print(databasePath);
|
|
|
|
final path = join(databasePath, 'travelguide.db');
|
|
|
|
final database = await openDatabase(join(databasePath, 'travelguide.db'));
|
|
|
|
|
|
|
|
|
|
|
|
final database = await openDatabase(path);
|
|
|
|
|
|
|
|
|
|
|
|
// 查询CollectionInfo表中的数据
|
|
|
|
// 查询CollectionInfo表中的数据
|
|
|
|
final result = await database.query('CollectionInfo');
|
|
|
|
final result = await database.query('CollectionInfo');
|
|
|
@ -47,7 +48,6 @@ class _CollectionEditPageState extends State<CollectionEditPage> {
|
|
|
|
|
|
|
|
|
|
|
|
return ListTile(
|
|
|
|
return ListTile(
|
|
|
|
title: Text('CollectionID: $collectionID'),
|
|
|
|
title: Text('CollectionID: $collectionID'),
|
|
|
|
|
|
|
|
|
|
|
|
subtitle: Text('CollectionName: $collectionName'),
|
|
|
|
subtitle: Text('CollectionName: $collectionName'),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
},
|
|
|
|
},
|
|
|
|