changed (hopefully) everything to new List with TextEditingControllers
time forgot to save sth ig
This commit is contained in:
@@ -7,15 +7,15 @@ abstract interface class IDb {
|
|||||||
|
|
||||||
onCreateDatabases(Database excursionDB, int version);
|
onCreateDatabases(Database excursionDB, int version);
|
||||||
|
|
||||||
Future<int> addMainEntry(Map<String, dynamic> excursion);
|
Future<int> addMainEntry(Map<String, String> excursion);
|
||||||
|
|
||||||
Future<void> updateMainEntry(Map<String, dynamic> excursion);
|
Future<void> updateMainEntry(Map<String, String> excursion);
|
||||||
|
|
||||||
Future<void> updateSent(int id);
|
Future<void> updateSent(int id);
|
||||||
|
|
||||||
Future<void> addTemplate(Map<String, dynamic> templates);
|
Future<void> addTemplate(Map<String, String> templates);
|
||||||
|
|
||||||
Future<void> updateTemplate(Map<String, dynamic> template);
|
Future<void> updateTemplate(Map<String, String> template);
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> getAllMainEntries();
|
Future<List<Map<String, dynamic>>> getAllMainEntries();
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ class ExcursionDBHelper implements IDb{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// The function that helps
|
// The function that helps
|
||||||
|
// TODO Change to right cols
|
||||||
@override
|
@override
|
||||||
onCreateDatabases(Database excursionDB, int version) async {
|
onCreateDatabases(Database excursionDB, int version) async {
|
||||||
await excursionDB.execute(
|
await excursionDB.execute(
|
||||||
@@ -41,7 +42,7 @@ class ExcursionDBHelper implements IDb{
|
|||||||
|
|
||||||
// Function to add a finished entry and return its ID
|
// Function to add a finished entry and return its ID
|
||||||
@override
|
@override
|
||||||
Future<int> addMainEntry(Map<String, dynamic> excursion) async {
|
Future<int> addMainEntry(Map<String, String> excursion) async {
|
||||||
var excursionDBClient = await dB;
|
var excursionDBClient = await dB;
|
||||||
final existingID = await excursionDBClient.query(
|
final existingID = await excursionDBClient.query(
|
||||||
'excursion',
|
'excursion',
|
||||||
@@ -64,7 +65,7 @@ class ExcursionDBHelper implements IDb{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateMainEntry(Map<String, dynamic> excursion) async {
|
Future<void> updateMainEntry(Map<String, String> excursion) async {
|
||||||
var excursionDBClient = await dB;
|
var excursionDBClient = await dB;
|
||||||
|
|
||||||
await excursionDBClient
|
await excursionDBClient
|
||||||
@@ -82,7 +83,7 @@ class ExcursionDBHelper implements IDb{
|
|||||||
|
|
||||||
// same thing as before but with templatews
|
// same thing as before but with templatews
|
||||||
@override
|
@override
|
||||||
Future<void> addTemplate(Map<String, dynamic> templates) async {
|
Future<void> addTemplate(Map<String, String> templates) async {
|
||||||
var excursionDBClient = await dB;
|
var excursionDBClient = await dB;
|
||||||
|
|
||||||
final existingCID = await excursionDBClient.query(
|
final existingCID = await excursionDBClient.query(
|
||||||
@@ -103,7 +104,7 @@ class ExcursionDBHelper implements IDb{
|
|||||||
|
|
||||||
// Updates a existing template
|
// Updates a existing template
|
||||||
@override
|
@override
|
||||||
Future<void> updateTemplate(Map<String, dynamic> template) async {
|
Future<void> updateTemplate(Map<String, String> template) async {
|
||||||
var excursionDBClient = await dB;
|
var excursionDBClient = await dB;
|
||||||
|
|
||||||
await excursionDBClient.update(
|
await excursionDBClient.update(
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ class PlaceDBHelper implements IDb{
|
|||||||
|
|
||||||
// Function to add a finished entry and return its ID
|
// Function to add a finished entry and return its ID
|
||||||
@override
|
@override
|
||||||
Future<int> addMainEntry(Map<String, dynamic> place) async {
|
Future<int> addMainEntry(Map<String, String> place) async {
|
||||||
var placeDBClient = await dB;
|
var placeDBClient = await dB;
|
||||||
final existingID = await placeDBClient.query(
|
final existingID = await placeDBClient.query(
|
||||||
'place',
|
'place',
|
||||||
@@ -64,7 +64,7 @@ class PlaceDBHelper implements IDb{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateMainEntry(Map<String, dynamic> place) async {
|
Future<void> updateMainEntry(Map<String, String> place) async {
|
||||||
var placeDBClient = await dB;
|
var placeDBClient = await dB;
|
||||||
|
|
||||||
await placeDBClient
|
await placeDBClient
|
||||||
@@ -82,7 +82,7 @@ class PlaceDBHelper implements IDb{
|
|||||||
|
|
||||||
// same thing as before but with templatews
|
// same thing as before but with templatews
|
||||||
@override
|
@override
|
||||||
Future<void> addTemplate(Map<String, dynamic> templates) async {
|
Future<void> addTemplate(Map<String, String> templates) async {
|
||||||
var placeDBClient = await dB;
|
var placeDBClient = await dB;
|
||||||
|
|
||||||
final existingCID = await placeDBClient.query(
|
final existingCID = await placeDBClient.query(
|
||||||
@@ -103,7 +103,7 @@ class PlaceDBHelper implements IDb{
|
|||||||
|
|
||||||
// Updates a existing template
|
// Updates a existing template
|
||||||
@override
|
@override
|
||||||
Future<void> updateTemplate(Map<String, dynamic> template) async {
|
Future<void> updateTemplate(Map<String, String> template) async {
|
||||||
var placeDBClient = await dB;
|
var placeDBClient = await dB;
|
||||||
|
|
||||||
await placeDBClient.update(
|
await placeDBClient.update(
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -85,8 +85,7 @@ class KarteState extends State<Karte> {
|
|||||||
widget.onPositionChange(updatedPosition!);
|
widget.onPositionChange(updatedPosition!);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// ignore: use_build_context_synchronously
|
if (context.mounted) Navigator.pop(context);
|
||||||
Navigator.pop(context);
|
|
||||||
},
|
},
|
||||||
child: const Icon(Icons.save),
|
child: const Icon(Icons.save),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||||||
class DialogHelper {
|
class DialogHelper {
|
||||||
// Function to show the dialog where the user has to choose if he want to safe his values as a template
|
// Function to show the dialog where the user has to choose if he want to safe his values as a template
|
||||||
static Future<void> showTemplateDialog(BuildContext context,
|
static Future<void> showTemplateDialog(BuildContext context,
|
||||||
List<String> emptyField, Map<String, dynamic> saveData) async {
|
List<String> emptyField, Map<String, String> saveData) async {
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
barrierDismissible: false,
|
barrierDismissible: false,
|
||||||
@@ -39,7 +39,7 @@ class DialogHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<dynamic> showServerErrorDialog(
|
static Future<dynamic> showServerErrorDialog(
|
||||||
BuildContext context, Map<String, dynamic> saveData, bool isTemplate) {
|
BuildContext context, Map<String, String> saveData, bool isTemplate) {
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
|
|
||||||
return showDialog(
|
return showDialog(
|
||||||
@@ -89,7 +89,7 @@ class DialogHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> showSaveOptionsDialog(BuildContext context,
|
static Future<void> showSaveOptionsDialog(BuildContext context,
|
||||||
Map<String, dynamic> saveData, bool isTemplate) async {
|
Map<String, String> saveData, bool isTemplate) async {
|
||||||
bool isLoading = false;
|
bool isLoading = false;
|
||||||
|
|
||||||
return showDialog(
|
return showDialog(
|
||||||
@@ -155,7 +155,7 @@ class DialogHelper {
|
|||||||
SaveFileMethod.saveFile(
|
SaveFileMethod.saveFile(
|
||||||
saveData,
|
saveData,
|
||||||
AppLocalizations.of(context)!.savefilefailed,
|
AppLocalizations.of(context)!.savefilefailed,
|
||||||
saveData["CID"]);
|
saveData["CID"]!);
|
||||||
setState(() => isLoading = false);
|
setState(() => isLoading = false);
|
||||||
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import 'package:dio/dio.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class HttpRequest {
|
class HttpRequest {
|
||||||
static Future<int> httpRequest({Map<String, dynamic>? saveDataMap, String? saveDataString}) async {
|
static Future<int> httpRequest({Map<String, String>? saveDataMap, String? saveDataString}) async {
|
||||||
// print(jsonEncode(place));
|
// print(jsonEncode(place));
|
||||||
|
|
||||||
final dio = Dio();
|
final dio = Dio();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ import 'package:file_picker/file_picker.dart';
|
|||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
class SaveFileMethod {
|
class SaveFileMethod {
|
||||||
static Future<void> saveFile(Map<String, dynamic> place, String fileNameLocalization, String placeID) async {
|
static Future<void> saveFile(Map<String, String> place, String fileNameLocalization, String placeID) async {
|
||||||
String? selectedDirectory = await FilePicker.platform.getDirectoryPath();
|
String? selectedDirectory = await FilePicker.platform.getDirectoryPath();
|
||||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||||
String jsonPlace = jsonEncode(place);
|
String jsonPlace = jsonEncode(place);
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:fforte/methods/place_db_helper.dart';
|
|||||||
|
|
||||||
class SaveMainEntryMethod {
|
class SaveMainEntryMethod {
|
||||||
static void saveEntry(
|
static void saveEntry(
|
||||||
{required Map<String, dynamic> entryData,
|
{required Map<String, String> entryData,
|
||||||
required bool isTemplate,
|
required bool isTemplate,
|
||||||
bool sent = false}) async {
|
bool sent = false}) async {
|
||||||
var placeDB = PlaceDBHelper();
|
var placeDB = PlaceDBHelper();
|
||||||
@@ -15,7 +15,7 @@ class SaveMainEntryMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isTemplate) {
|
if (isTemplate) {
|
||||||
await placeDB.deleteTemplateById(entryData["CID"]);
|
await placeDB.deleteTemplateById(entryData["CID"]!);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import 'package:fforte/interfaces/i_db.dart';
|
|||||||
import 'package:fforte/methods/excursion_db_helper.dart';
|
import 'package:fforte/methods/excursion_db_helper.dart';
|
||||||
import 'package:fforte/methods/place_db_helper.dart';
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
|
|
||||||
void saveTemplate(Map<String, dynamic> templateData, DatabasesEnum dbType,
|
void saveTemplate(Map<String, String> templateData, DatabasesEnum dbType,
|
||||||
bool update) async {
|
bool update) async {
|
||||||
IDb dbHelper;
|
IDb dbHelper;
|
||||||
if (dbType == DatabasesEnum.place) {
|
if (dbType == DatabasesEnum.place) {
|
||||||
|
|||||||
Reference in New Issue
Block a user