fixing wireframe issue

This commit is contained in:
Azmat-7860
2026-09-23 23:04:22 +05:30
parent 012969ae21
commit 90a8524b83
4 changed files with 37 additions and 16 deletions
+9 -5
View File
@@ -40,14 +40,17 @@ class DatabaseHelper {
var openDb = await openDatabase(
path,
version: 1,
onCreate: (db, version) => _createDatabaseTables(db),
// OLD: version: 1,
version: 2,
// OLD: onCreate: (db, version) => _createDatabaseTables(db),
onCreate: (db, version) async => await _createDatabaseTables(db),
onUpgrade: (db, int oldversion, int newversion) async {
if (oldversion < newversion) {
print("Version Upgrade");
// OLD: print("Version Upgrade");
await _createDatabaseTables(db);
}
},
);
); // fix version upgrade + await table creation - by Azmat on 23-sep
// Check if the table exists
// var tableResult = await openDb.query('sqlite_master',
@@ -71,7 +74,8 @@ class DatabaseHelper {
}
Future<void> _createDatabaseTables(Database db) async {
tablequery.createOtherTable(db);
// OLD: tablequery.createOtherTable(db);
await tablequery.createOtherTable(db); // await table creation before queries run - by Azmat on 23-sep
}
// create other table
+6 -4
View File
@@ -43,9 +43,10 @@ class TableQuery {
extn15 TEXT,
phone TEXT,
nme TEXT,
imageupload TEXT,
// OLD: imageupload TEXT,
imageupload TEXT // fix trailing comma sqlite error - by Azmat on 23-sep
)''');
)''');
} else {
print('$tableName table exist');
}
@@ -81,9 +82,10 @@ class TableQuery {
extn14 TEXT,
extn15 TEXT,
college TEXT,
Name TEXT,
// OLD: Name TEXT,
Name TEXT // fix trailing comma sqlite error - by Azmat on 23-sep
)''');
)''');
} else {
print('$tableName table exist');
}
+11 -3
View File
@@ -21,7 +21,8 @@ class UniController {
// entity['active'] = entity['active'] ? 1 : 0;
// Insert data
var entityId = await db.insert(tableName, entity);
// OLD: var entityId = await db.insert(tableName, entity);
var entityId = await db.insert(tableName, entity, conflictAlgorithm: ConflictAlgorithm.replace); // overwrite same id instead of crash - by Azmat on 23-sep
if (entityId != null && entityId > 0) {
print('$tableName Id data is inserted. $tableName Id ID: $entityId');
} else {
@@ -40,10 +41,12 @@ class UniController {
print('multiple entity is com is $entities');
for (var entity in entities) {
insertEntity(entity, tableName);
// OLD: insertEntity(entity, tableName);
batch.insert(tableName, entity, conflictAlgorithm: ConflictAlgorithm.replace);
}
await batch.commit();
// OLD: await batch.commit();
await batch.commit(); // real batch write with overwrite - by Azmat on 23-sep
}
// update Entity
@@ -81,6 +84,11 @@ class UniController {
return rowsAffected;
}
Future<int> deleteAll(String tableName) async {
Database db = await conn.database;
return await db.delete(tableName); // clear table for fresh server sync - by Azmat on 23-sep
}
// get count
Future<int> getDataCount(String tableNmae) async {
Database db = await conn.database;
+11 -4
View File
@@ -1,3 +1,5 @@
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
@@ -21,10 +23,15 @@ import 'screens/splash_screen/splash_screen.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
print(sqlite3.version);
sqfliteFfiInit();
// Initialize the database factory for sqflite_common_ffi
databaseFactory = databaseFactoryFfi;
// OLD: print(sqlite3.version);
// OLD: sqfliteFfiInit();
// OLD: // Initialize the database factory for sqflite_common_ffi
// OLD: databaseFactory = databaseFactoryFfi;
if (!kIsWeb && !Platform.isAndroid && !Platform.isIOS) { // ffi only for desktop, mobile uses native sqflite - by Azmat on 23-sep
print(sqlite3.version);
sqfliteFfiInit();
databaseFactory = databaseFactoryFfi;
}
//Request notification permissions
// await _requestNotificationPermissions();