YuYouShui_Branch
黎超凡 2 years ago
parent 8c955d3167
commit 7bc74fa8ed

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"sqflite","path":"C:\\\\Users\\\\17651\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"sqflite","path":"C:\\\\Users\\\\17651\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.0\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\17651\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.0\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"sqflite","dependencies":[]}],"date_created":"2023-11-09 11:11:11.867067","version":"3.13.3"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"sqflite","path":"C:\\\\Users\\\\17651\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.0\\\\","native_build":true,"dependencies":[]}],"android":[{"name":"sqflite","path":"C:\\\\Users\\\\17651\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.0\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"sqflite","path":"C:\\\\Users\\\\17651\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\sqflite-2.3.0\\\\","native_build":true,"dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"sqflite","dependencies":[]}],"date_created":"2023-11-10 15:39:50.902757","version":"3.13.3"}

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="dataSourceStorageLocal" created-in="IU-211.7628.21"> <component name="dataSourceStorageLocal" created-in="IU-211.7628.21">
<data-source name="travelguide" uuid="1c4f5c08-c312-4a8a-8868-0f8ff6be536a"> <data-source name="travelguide" uuid="e282f56a-94d6-49a3-a567-05358c5c2a23">
<database-info product="SQLite" version="3.43.0" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.43.0.0" dbms="SQLITE" exact-version="3.43.0" exact-driver-version="3.43"> <database-info product="SQLite" version="3.43.0" jdbc-version="4.2" driver-name="SQLite JDBC" driver-version="3.43.0.0" dbms="SQLITE" exact-version="3.43.0" exact-driver-version="3.43">
<identifier-quote-string>&quot;</identifier-quote-string> <identifier-quote-string>&quot;</identifier-quote-string>
</database-info> </database-info>
@ -9,7 +9,7 @@
<auth-provider>no-auth</auth-provider> <auth-provider>no-auth</auth-provider>
<schema-mapping> <schema-mapping>
<introspection-scope> <introspection-scope>
<node kind="schema" qname="@" /> <node kind="schema" negative="1" />
</introspection-scope> </introspection-scope>
</schema-mapping> </schema-mapping>
</data-source> </data-source>

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="DataSourceManagerImpl" format="xml" multifile-model="true"> <component name="DataSourceManagerImpl" format="xml" multifile-model="true">
<data-source source="LOCAL" name="travelguide" uuid="1c4f5c08-c312-4a8a-8868-0f8ff6be536a"> <data-source source="LOCAL" name="travelguide" uuid="e282f56a-94d6-49a3-a567-05358c5c2a23">
<driver-ref>sqlite.xerial</driver-ref> <driver-ref>sqlite.xerial</driver-ref>
<synchronize>true</synchronize> <synchronize>true</synchronize>
<jdbc-driver>org.sqlite.JDBC</jdbc-driver> <jdbc-driver>org.sqlite.JDBC</jdbc-driver>
<jdbc-url>jdbc:sqlite:C:\Users\17651\Documents\AndroidStudio\DeviceExplorer\Pixel_3_XL_API_30 [emulator-5554]\data\data\com.example.travelguide\databases\travelguide.db</jdbc-url> <jdbc-url>jdbc:sqlite:C:\Users\17651\Documents\AndroidStudio\DeviceExplorer\Pixel_3_XL_API_30 [emulator-5554]\data\user\0\com.example.travelguide\databases\travelguide.db</jdbc-url>
<working-dir>$ProjectFileDir$</working-dir> <working-dir>$ProjectFileDir$</working-dir>
<libraries> <libraries>
<library> <library>

File diff suppressed because one or more lines are too long

@ -1,4 +1,4 @@
#Thu Nov 09 11:11:49 CST 2023 #Fri Nov 10 15:40:01 CST 2023
base.0=E\:\\travelguideProject\\src\\build\\app\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex base.0=E\:\\travelguideProject\\src\\build\\app\\intermediates\\dex\\debug\\mergeDexDebug\\classes.dex
renamed.0=classes.dex renamed.0=classes.dex
path.0=classes.dex path.0=classes.dex

@ -1 +1 @@
56f09655ff532597ed660d7244a6919bcafca0d8 aca343814e8365b95f3f807b66851379065436e0

@ -18,26 +18,53 @@ void main() async{
// //
final database = await MyDatabase.initDatabase(); final database = await MyDatabase.initDatabase();
Future<void> insertMuseumInfoData() async {
final databasePath = await getDatabasesPath();
final path = join(databasePath, 'travelguide.db');
final database = await openDatabase(path);
await database.insert('MuseumInfo', {
'MuseumName': '',
'MuseumDetail': '',
'ImagePath': ''
});
await database.close();
}
insertMuseumInfoData();
Future<void> deleteMuseumInfoData() async {
final databasePath = await getDatabasesPath();
final path = join(databasePath, 'travelguide.db');
final database = await openDatabase(path);
await database.rawDelete(
'DELETE FROM MuseumInfo WHERE MuseumName = **'
);
await database.close();
}
deleteMuseumInfoData();
Future<void> insertCollectionInfoData() async { Future<void> insertCollectionInfoData() async {
final databasePath = await getDatabasesPath(); final databasePath = await getDatabasesPath();
final path = join(databasePath, 'travelguide.db'); final path = join(databasePath, 'travelguide.db');
final database = await openDatabase(path); final database = await openDatabase(path);
//
await database.insert('CollectionInfo', { await database.insert('CollectionInfo', {
'CollectionID': 0, 'CollectionID': 1,
'MuseumName': '', 'MuseumName': '天津市博物馆',
'CollectionName': '', 'CollectionName': '',
'CollectionDetail': 'CollectionDetail':
'', ' ',
'ImagePath':'' 'ImagePath':''
}); });
await database.close(); await database.close();
} }
insertCollectionInfoData(); insertCollectionInfoData();
//
Future<void> deleteCollectionInfoData() async { Future<void> deleteCollectionInfoData() async {
final databasePath = await getDatabasesPath(); final databasePath = await getDatabasesPath();
final path = join(databasePath, 'travelguide.db'); final path = join(databasePath, 'travelguide.db');
@ -51,35 +78,65 @@ void main() async{
} }
deleteCollectionInfoData(); deleteCollectionInfoData();
Future<void> insertMuseumInfoData() async { // Future<void> insertCommunityInfoData() async {
// final databasePath = await getDatabasesPath();
// final path = join(databasePath, 'travelguide.db');
// final database = await openDatabase(path);
//
// await database.insert('CommunityInfo', {
// 'CommunityID': '',
// 'MuseumName': '',
// 'Author': '',
// 'PostTime':'',
// 'Comment':''
// });
//
// await database.close();
// }
// insertCommunityInfoData();
Future<void> deleteCommunityInfoData() async {
final databasePath = await getDatabasesPath(); final databasePath = await getDatabasesPath();
final path = join(databasePath, 'travelguide.db'); final path = join(databasePath, 'travelguide.db');
final database = await openDatabase(path); final database = await openDatabase(path);
await database.insert('MuseumInfo', { await database.rawDelete(
'MuseumName': '', 'DELETE FROM CommunityInfo WHERE CommunityID = 1'
'MuseumDetail': '', );
'ImagePath': ''
});
await database.close(); await database.close();
} }
deleteCommunityInfoData();
insertMuseumInfoData();
// Future<void> insertServiceInfoData() async {
Future<void> deleteMuseumInfoData() async { // final databasePath = await getDatabasesPath();
// final path = join(databasePath, 'travelguide.db');
// final database = await openDatabase(path);
//
// await database.insert('ServiceInfo', {
// 'ServiceID': '',
// 'MuseumName': '',
// 'Service': ''
// });
//
// await database.close();
// }
// insertServiceInfoData();
Future<void> deleteServiceInfoData() async {
final databasePath = await getDatabasesPath(); final databasePath = await getDatabasesPath();
final path = join(databasePath, 'travelguide.db'); final path = join(databasePath, 'travelguide.db');
final database = await openDatabase(path); final database = await openDatabase(path);
await database.rawDelete( await database.rawDelete(
'DELETE FROM MuseumInfo WHERE MuseumName = **' 'DELETE FROM ServiceInfo WHERE ServiceID = 1'
); );
await database.close(); await database.close();
} }
deleteServiceInfoData();
deleteMuseumInfoData();
runApp(MaterialApp( runApp(MaterialApp(
initialRoute: '/', // initialRoute: '/', //

@ -19,6 +19,8 @@ class MyDatabase {
static Future<void> _createTables(Database db, int version) async { static Future<void> _createTables(Database db, int version) async {
// await _createMuseumInfoTable(db, version); // await _createMuseumInfoTable(db, version);
// await _createCollectionInfoTable(db, version); // await _createCollectionInfoTable(db, version);
await _createCommunityInfoTable(db, version);
await _createServiceInfoTable(db, version);
} }
static Future<void> _createMuseumInfoTable(Database db, int version) async { static Future<void> _createMuseumInfoTable(Database db, int version) async {
@ -46,6 +48,33 @@ class MyDatabase {
print("CollectionInfoTable create success"); print("CollectionInfoTable create success");
} }
static Future<void> _createCommunityInfoTable(Database db, int version) async {
await db.execute('''
CREATE TABLE IF NOT EXISTS CommunityInfo(
CommunityID INTEGER PRIMARY KEY,
MuseumName TEXT,
Author TEXT,
PostTime TEXT,
Comment TEXT,
FOREIGN KEY (MuseumName) REFERENCES MuseumInfo(MuseumName)
);
''');
print("CommunityInfoTable create success");
}
static Future<void> _createServiceInfoTable(Database db, int version) async {
await db.execute('''
CREATE TABLE IF NOT EXISTS ServiceInfo(
ServiceID INTEGER PRIMARY KEY,
MuseumName TEXT,
Service TEXT,
FOREIGN KEY (MuseumName) REFERENCES MuseumInfo(MuseumName)
);
''');
print("ServiceInfoTable create success");
}
static Future<void> reBuildDatabase() async { static Future<void> reBuildDatabase() async {
final databasePath = await getDatabasesPath(); final databasePath = await getDatabasesPath();
final path = join(databasePath, 'tma.db'); final path = join(databasePath, 'tma.db');

@ -87,10 +87,74 @@ class _collection1State extends State<collection1> {
}); });
}, },
children: [ children: [
_buildImage('assets/collection1-1.jpg', 150, 0, 1.5), FutureBuilder<List<CollectionInfo>>(
_buildImage('assets/collection1-2.jpg', 150, 0, 1.5), future: CollectionControl.fetchCollectionData(1),
_buildImage('assets/collection1-3.jpg', 150, 0, 1.5), builder: (context, snapshot) {
_buildImage('assets/collection1-4.jpg', 150, 0, 1.5), if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
List<String> imagePaths = snapshot.data![0].imagePath.split(', ');
return _buildImage(imagePaths[0], 150, 0, 2.0);
} else {
return Text('No data available');
}
}
},
),
FutureBuilder<List<CollectionInfo>>(
future: CollectionControl.fetchCollectionData(1),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
List<String> imagePaths = snapshot.data![0].imagePath.split(', ');
return _buildImage(imagePaths[1], 150, 0, 1.5);
} else {
return Text('No data available');
}
}
},
),
FutureBuilder<List<CollectionInfo>>(
future: CollectionControl.fetchCollectionData(1),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
List<String> imagePaths = snapshot.data![0].imagePath.split(', ');
return _buildImage(imagePaths[2], 150, 0, 2.0);
} else {
return Text('No data available');
}
}
},
),
FutureBuilder<List<CollectionInfo>>(
future: CollectionControl.fetchCollectionData(1),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
} else if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
} else {
if (snapshot.hasData && snapshot.data!.isNotEmpty) {
List<String> imagePaths = snapshot.data![0].imagePath.split(', ');
return _buildImage(imagePaths[3], 150, 0, 2.0);
} else {
return Text('No data available');
}
}
},
),
], ],
), ),
), ),

Loading…
Cancel
Save