continued hinweise widget (doesnt save the strings yet); splittet up databases
This commit is contained in:
4
lib/enums/databases.dart
Normal file
4
lib/enums/databases.dart
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
enum DatabasesEnum {
|
||||||
|
place,
|
||||||
|
excursion,
|
||||||
|
}
|
||||||
151
lib/methods/excursion_db_helper.dart
Normal file
151
lib/methods/excursion_db_helper.dart
Normal file
@@ -0,0 +1,151 @@
|
|||||||
|
import 'package:path_provider/path_provider.dart';
|
||||||
|
import 'package:sqflite/sqflite.dart';
|
||||||
|
import 'dart:io' as io;
|
||||||
|
import 'package:path/path.dart';
|
||||||
|
|
||||||
|
// * Gives the complete functionality for the databases
|
||||||
|
// ! functions may not be named complete correctly
|
||||||
|
|
||||||
|
class ExcursionDBHelper {
|
||||||
|
static Database? _excursionDB;
|
||||||
|
|
||||||
|
// checks if the databses are existing and creates them with the initPlaceDatabase function if not
|
||||||
|
Future<Database> get excursionDB async {
|
||||||
|
if (_excursionDB != null) {
|
||||||
|
return _excursionDB!;
|
||||||
|
}
|
||||||
|
_excursionDB = await initExcursionDatabase();
|
||||||
|
return _excursionDB!;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Creates the databases with help from the _onCreateExcursion function
|
||||||
|
initExcursionDatabase() async {
|
||||||
|
io.Directory documentsDirectory = await getApplicationCacheDirectory();
|
||||||
|
String path = join(documentsDirectory.path, 'excursionDB.db');
|
||||||
|
var excursionDB =
|
||||||
|
await openDatabase(path, version: 1, onCreate: _onCreateExcursion);
|
||||||
|
return excursionDB;
|
||||||
|
}
|
||||||
|
|
||||||
|
// The function that helps
|
||||||
|
_onCreateExcursion(Database excursionDB, int version) async {
|
||||||
|
await excursionDB.execute(
|
||||||
|
'CREATE TABLE excursion (ID INTEGER PRIMARY KEY AUTOINCREMENT, Datum TEXT, Rudel TEXT, Teilnehmer TEXT, Jahr TEXT, Mjahr TEXT, Monat INTEGER, Saison TEXT, Dauer TEXT, BLjahr TEXT, BLand, TEXT, Lkr TEXT, BeiOrt TEXT, Wetter TEXT, Temperat TEXT, RegenVor TEXT, KmAuto TEXT, KmFuss TEXT, KmRad TEXT, KmTotal TEXT, KmAuProf TEXT, KmFuProz TEXT, KmRaProz TEXT, SpGut TEXT, SpSchlecht TEXT, SpurFund TEXT, SpurLang TEXT, SpurTiere Text, SpSicher TEXT, WelpenSp TEXT, WelpenAnz TEXT, WpSicher TEXT, LosungGes TEXT, LosunAnz TEXT, LosunGen TEXT, UrinAnz TEXT, UrinGen TEXT, OestrAnz TEXT, OestrGen TEXT, HaarAnz TEXT, HaarGen TEXT, LosungKm TEXT, GenetiKm TEXT, Hinweise TEXT, Bemerk TEXT, IntKomm TEXT, BimaNr TEXT, BimaName TEXT, BimaNutzer TEXT, BimaAGV TEXT, FallNum INTEGER, MHund TEXT, MLeine TEXT, LogDat TEXT, HinweiseSonstiges TEXT)');
|
||||||
|
await excursionDB.execute(
|
||||||
|
'CREATE TABLE excursionTemplates (ID INTEGER PRIMARY KEY AUTOINCREMENT, Datum TEXT, Rudel TEXT, Teilnehmer TEXT, Jahr TEXT, Mjahr TEXT, Monat INTEGER, Saison TEXT, Dauer TEXT, BLjahr TEXT, BLand, TEXT, Lkr TEXT, BeiOrt TEXT, Wetter TEXT, Temperat TEXT, RegenVor TEXT, KmAuto TEXT, KmFuss TEXT, KmRad TEXT, KmTotal TEXT, KmAuProf TEXT, KmFuProz TEXT, KmRaProz TEXT, SpGut TEXT, SpSchlecht TEXT, SpurFund TEXT, SpurLang TEXT, SpurTiere Text, SpSicher TEXT, WelpenSp TEXT, WelpenAnz TEXT, WpSicher TEXT, LosungGes TEXT, LosunAnz TEXT, LosunGen TEXT, UrinAnz TEXT, UrinGen TEXT, OestrAnz TEXT, OestrGen TEXT, HaarAnz TEXT, HaarGen TEXT, LosungKm TEXT, GenetiKm TEXT, Hinweise TEXT, Bemerk TEXT, IntKomm TEXT, BimaNr TEXT, BimaName TEXT, BimaNutzer TEXT, BimaAGV TEXT, FallNum INTEGER, MHund TEXT, MLeine TEXT, LogDat TEXT, HinweiseSonstiges TEXT)');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Function to add a finished entry and return its ID
|
||||||
|
Future<int> addExcursion(Map<String, dynamic> excursion) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
final existingID = await excursionDBClient.query(
|
||||||
|
'excursion',
|
||||||
|
where: 'ID = ?',
|
||||||
|
whereArgs: [excursion['ID']],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (existingID.isNotEmpty) {
|
||||||
|
updateExcursion(excursion);
|
||||||
|
return existingID.first['ID'] as int; // Return existing ID
|
||||||
|
}
|
||||||
|
|
||||||
|
int id = await excursionDBClient.insert(
|
||||||
|
'excursion',
|
||||||
|
excursion,
|
||||||
|
//conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
|
);
|
||||||
|
|
||||||
|
return id; // Return the ID of the newly inserted entry
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> updateExcursion(Map<String, dynamic> excursion) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
|
||||||
|
await excursionDBClient
|
||||||
|
.update('excursion', excursion, where: "ID = ?", whereArgs: [excursion['ID']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// function to update the sent value
|
||||||
|
Future<void> updateSent(int id) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
|
||||||
|
await excursionDBClient.update('excursion', {'Sent': 1},
|
||||||
|
where: 'ID = ?', whereArgs: [id]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// same thing as before but with templatews
|
||||||
|
Future<void> addTemplate(Map<String, dynamic> templates) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
|
||||||
|
final existingCID = await excursionDBClient.query(
|
||||||
|
'excursionTemplates',
|
||||||
|
where: 'ID = ?',
|
||||||
|
whereArgs: [templates['ID']],
|
||||||
|
);
|
||||||
|
if (existingCID.isNotEmpty) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await excursionDBClient.insert(
|
||||||
|
'excursionTemplates',
|
||||||
|
templates,
|
||||||
|
// conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Updates a existing template
|
||||||
|
Future<void> updateTemplate(Map<String, dynamic> template) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
|
||||||
|
await excursionDBClient.update(
|
||||||
|
'excursionTemplates',
|
||||||
|
template,
|
||||||
|
where: "ID = ?",
|
||||||
|
whereArgs: [template['ID']],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the finished entries from db
|
||||||
|
Future<List<Map<String, dynamic>>> getExcursionen() async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
return await excursionDBClient.query('excursion');
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the finished templates from db
|
||||||
|
Future<List<Map<String, dynamic>>> getTemplates() async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
return await excursionDBClient.query('excursionTemplates');
|
||||||
|
}
|
||||||
|
|
||||||
|
// deletes all finished entries from the db LOCALLY
|
||||||
|
Future<void> deleteAllExcursionen() async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
await excursionDBClient.delete('excursion');
|
||||||
|
}
|
||||||
|
|
||||||
|
// deletes all templates from the db LOCALLY
|
||||||
|
Future<void> deleteAllTemplates() async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
await excursionDBClient.delete('excursionTemplates');
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete specific template
|
||||||
|
Future<void> deleteTemplate(String id) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
await excursionDBClient.delete(
|
||||||
|
'excursionTemplates',
|
||||||
|
where: 'ID = ?',
|
||||||
|
whereArgs: [id],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// delete specific excursion
|
||||||
|
Future<void> deleteExcursion(String id) async {
|
||||||
|
var excursionDBClient = await excursionDB;
|
||||||
|
await excursionDBClient.delete(
|
||||||
|
'excursion',
|
||||||
|
where: 'ID = ?',
|
||||||
|
whereArgs: [id],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,7 @@ import 'package:path/path.dart';
|
|||||||
// * Gives the complete functionality for the databases
|
// * Gives the complete functionality for the databases
|
||||||
// ! functions may not be named complete correctly
|
// ! functions may not be named complete correctly
|
||||||
|
|
||||||
class DBHelper {
|
class PlaceDBHelper {
|
||||||
static Database? _placeDB;
|
static Database? _placeDB;
|
||||||
|
|
||||||
// checks if the databses are existing and creates them with the initPlaceDatabase function if not
|
// checks if the databses are existing and creates them with the initPlaceDatabase function if not
|
||||||
@@ -32,7 +32,7 @@ class DBHelper {
|
|||||||
await placeDB.execute(
|
await placeDB.execute(
|
||||||
'CREATE TABLE place (ID INTEGER PRIMARY KEY AUTOINCREMENT, CID TEXT, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8), Sent INTEGER DEFAULT 0)');
|
'CREATE TABLE place (ID INTEGER PRIMARY KEY AUTOINCREMENT, CID TEXT, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8), Sent INTEGER DEFAULT 0)');
|
||||||
await placeDB.execute(
|
await placeDB.execute(
|
||||||
'CREATE TABLE templates (ID INTEGER PRIMARY KEY AUTOINCREMENT, CID TEXT, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8))');
|
'CREATE TABLE placeTemplates (ID INTEGER PRIMARY KEY AUTOINCREMENT, CID TEXT, Standort TEXT, Rudel TEXT, Datum DATE, Adresse1 TEXT, Adresse2 TEXT, Adresse3 TEXT, BLand TEXT, Lkr TEXT, BeiOrt TEXT, OrtInfo TEXT, Status TEXT, FFTyp TEXT, FotoFilm TEXT, MEZ TEXT, Platzung TEXT, KSchloNr TEXT, KontDat DATE, Betreuung TEXT, AbbauDat DATE, Auftrag TEXT, KontAbsp TEXT, SonstBem TEXT, FKontakt1 TEXT, FKontakt2 TEXT, FKontakt3 TEXT, KTage1 INTEGER, KTage2 INTEGER, ProtoAm DATE, IntKomm TEXT, DECLNG DECIMALS(4,8), DECLAT DECIMALS(4,8))');
|
||||||
await placeDB.execute(
|
await placeDB.execute(
|
||||||
'CREATE TABLE excursion (ID INTEGER PRIMARY KEY AUTOINCREMENT, Datum TEXT, Rudel TEXT, Teilnehmer TEXT, Jahr TEXT, Mjahr TEXT, Monat INTEGER, Saison TEXT, Dauer TEXT, BLjahr TEXT, BLand, TEXT, Lkr TEXT, BeiOrt TEXT, Wetter TEXT, Temperat TEXT, RegenVor TEXT, KmAuto TEXT, KmFuss TEXT, KmRad TEXT, KmTotal TEXT, KmAuProf TEXT, KmFuProz TEXT, KmRaProz TEXT, SpGut TEXT, SpSchlecht TEXT, SpurFund TEXT, SpurLang TEXT, SpurTiere Text, SpSicher TEXT, WelpenSp TEXT, WelpenAnz TEXT, WpSicher TEXT, LosungGes TEXT, LosunAnz TEXT, LosunGen TEXT, UrinAnz TEXT, UrinGen TEXT, OestrAnz TEXT, OestrGen TEXT, HaarAnz TEXT, HaarGen TEXT, LosungKm TEXT, GenetiKm TEXT, Hinweise TEXT, Bemerk TEXT, IntKomm TEXT, BimaNr TEXT, BimaName TEXT, BimaNutzer TEXT, BimaAGV TEXT, FallNum INTEGER, MHund TEXT, MLeine TEXT, LogDat TEXT)');
|
'CREATE TABLE excursion (ID INTEGER PRIMARY KEY AUTOINCREMENT, Datum TEXT, Rudel TEXT, Teilnehmer TEXT, Jahr TEXT, Mjahr TEXT, Monat INTEGER, Saison TEXT, Dauer TEXT, BLjahr TEXT, BLand, TEXT, Lkr TEXT, BeiOrt TEXT, Wetter TEXT, Temperat TEXT, RegenVor TEXT, KmAuto TEXT, KmFuss TEXT, KmRad TEXT, KmTotal TEXT, KmAuProf TEXT, KmFuProz TEXT, KmRaProz TEXT, SpGut TEXT, SpSchlecht TEXT, SpurFund TEXT, SpurLang TEXT, SpurTiere Text, SpSicher TEXT, WelpenSp TEXT, WelpenAnz TEXT, WpSicher TEXT, LosungGes TEXT, LosunAnz TEXT, LosunGen TEXT, UrinAnz TEXT, UrinGen TEXT, OestrAnz TEXT, OestrGen TEXT, HaarAnz TEXT, HaarGen TEXT, LosungKm TEXT, GenetiKm TEXT, Hinweise TEXT, Bemerk TEXT, IntKomm TEXT, BimaNr TEXT, BimaName TEXT, BimaNutzer TEXT, BimaAGV TEXT, FallNum INTEGER, MHund TEXT, MLeine TEXT, LogDat TEXT)');
|
||||||
}
|
}
|
||||||
@@ -80,7 +80,7 @@ class DBHelper {
|
|||||||
var placeDBClient = await placeDB;
|
var placeDBClient = await placeDB;
|
||||||
|
|
||||||
final existingCID = await placeDBClient.query(
|
final existingCID = await placeDBClient.query(
|
||||||
'templates',
|
'placeTemplates',
|
||||||
where: 'ID = ?',
|
where: 'ID = ?',
|
||||||
whereArgs: [templates['ID']],
|
whereArgs: [templates['ID']],
|
||||||
);
|
);
|
||||||
@@ -89,7 +89,7 @@ class DBHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await placeDBClient.insert(
|
await placeDBClient.insert(
|
||||||
'templates',
|
'placeTemplates',
|
||||||
templates,
|
templates,
|
||||||
// conflictAlgorithm: ConflictAlgorithm.replace,
|
// conflictAlgorithm: ConflictAlgorithm.replace,
|
||||||
);
|
);
|
||||||
@@ -100,7 +100,7 @@ class DBHelper {
|
|||||||
var placeDBClient = await placeDB;
|
var placeDBClient = await placeDB;
|
||||||
|
|
||||||
await placeDBClient.update(
|
await placeDBClient.update(
|
||||||
'templates',
|
'placeTemplates',
|
||||||
template,
|
template,
|
||||||
where: "ID = ?",
|
where: "ID = ?",
|
||||||
whereArgs: [template['ID']],
|
whereArgs: [template['ID']],
|
||||||
@@ -116,7 +116,7 @@ class DBHelper {
|
|||||||
// get the finished templates from db
|
// get the finished templates from db
|
||||||
Future<List<Map<String, dynamic>>> getTemplates() async {
|
Future<List<Map<String, dynamic>>> getTemplates() async {
|
||||||
var placeDBClient = await placeDB;
|
var placeDBClient = await placeDB;
|
||||||
return await placeDBClient.query('templates');
|
return await placeDBClient.query('placeTemplates');
|
||||||
}
|
}
|
||||||
|
|
||||||
// deletes all finished entries from the db LOCALLY
|
// deletes all finished entries from the db LOCALLY
|
||||||
@@ -128,14 +128,14 @@ class DBHelper {
|
|||||||
// deletes all templates from the db LOCALLY
|
// deletes all templates from the db LOCALLY
|
||||||
Future<void> deleteAllTemplates() async {
|
Future<void> deleteAllTemplates() async {
|
||||||
var placeDBClient = await placeDB;
|
var placeDBClient = await placeDB;
|
||||||
await placeDBClient.delete('templates');
|
await placeDBClient.delete('placeTemplates');
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete specific template
|
// delete specific template
|
||||||
Future<void> deleteTemplate(String id) async {
|
Future<void> deleteTemplate(String id) async {
|
||||||
var placeDBClient = await placeDB;
|
var placeDBClient = await placeDB;
|
||||||
await placeDBClient.delete(
|
await placeDBClient.delete(
|
||||||
'templates',
|
'placeTemplates',
|
||||||
where: 'ID = ?',
|
where: 'ID = ?',
|
||||||
whereArgs: [id],
|
whereArgs: [id],
|
||||||
);
|
);
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'package:animations/animations.dart';
|
import 'package:animations/animations.dart';
|
||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
import 'package:fforte/screens/Excursion/widgets/anzahlen.dart';
|
import 'package:fforte/screens/Excursion/widgets/anzahlen.dart';
|
||||||
import 'package:fforte/screens/Excursion/widgets/bima_nutzer.dart';
|
import 'package:fforte/screens/Excursion/widgets/bima_nutzer.dart';
|
||||||
import 'package:fforte/screens/Excursion/widgets/hinweise.dart';
|
import 'package:fforte/screens/Excursion/widgets/hinweise.dart';
|
||||||
@@ -108,7 +109,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["Rudel"]!,
|
textController: getTextFields()["Rudel"]!,
|
||||||
localization: AppLocalizations.of(context)!.rudel,
|
localization: AppLocalizations.of(context)!.rudel,
|
||||||
dbName: "Rudel",
|
dbName: "Rudel",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -117,6 +120,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
localization: AppLocalizations.of(context)!.teilnehmer,
|
localization: AppLocalizations.of(context)!.teilnehmer,
|
||||||
dbName: "Teilnehm",
|
dbName: "Teilnehm",
|
||||||
required: false,
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
@@ -125,7 +129,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["Dauer"]!,
|
textController: getTextFields()["Dauer"]!,
|
||||||
localization: AppLocalizations.of(context)!.dauer,
|
localization: AppLocalizations.of(context)!.dauer,
|
||||||
dbName: "Dauer",
|
dbName: "Dauer",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -143,7 +149,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["BLand"]!,
|
textController: getTextFields()["BLand"]!,
|
||||||
localization: AppLocalizations.of(context)!.bland,
|
localization: AppLocalizations.of(context)!.bland,
|
||||||
dbName: "BLand",
|
dbName: "BLand",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -151,7 +159,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["Lkr"]!,
|
textController: getTextFields()["Lkr"]!,
|
||||||
localization: AppLocalizations.of(context)!.lkr,
|
localization: AppLocalizations.of(context)!.lkr,
|
||||||
dbName: "Lkr",
|
dbName: "Lkr",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -159,7 +169,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["BeiOrt"]!,
|
textController: getTextFields()["BeiOrt"]!,
|
||||||
localization: AppLocalizations.of(context)!.beiort,
|
localization: AppLocalizations.of(context)!.beiort,
|
||||||
dbName: "BeiOrt",
|
dbName: "BeiOrt",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -171,7 +183,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["BimaNr"]!,
|
textController: getTextFields()["BimaNr"]!,
|
||||||
localization: AppLocalizations.of(context)!.bimaNr,
|
localization: AppLocalizations.of(context)!.bimaNr,
|
||||||
dbName: "BimaNr",
|
dbName: "BimaNr",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -179,7 +193,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["BimaName"]!,
|
textController: getTextFields()["BimaName"]!,
|
||||||
localization: AppLocalizations.of(context)!.bimaName,
|
localization: AppLocalizations.of(context)!.bimaName,
|
||||||
dbName: "BimaName",
|
dbName: "BimaName",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 10,
|
height: 10,
|
||||||
),
|
),
|
||||||
@@ -195,7 +211,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["BimaAGV"]!,
|
textController: getTextFields()["BimaAGV"]!,
|
||||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||||
dbName: "BimaAGV",
|
dbName: "BimaAGV",
|
||||||
required: false)
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
Step(
|
Step(
|
||||||
@@ -206,13 +224,17 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
textController: getTextFields()["Wetter"]!,
|
textController: getTextFields()["Wetter"]!,
|
||||||
localization: "Wetter",
|
localization: "Wetter",
|
||||||
dbName: "Wetter",
|
dbName: "Wetter",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: getTextFields()["Temperat"]!,
|
textController: getTextFields()["Temperat"]!,
|
||||||
localization: "Temperatur",
|
localization: "Temperatur",
|
||||||
dbName: "Temperat",
|
dbName: "Temperat",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
LetzterNiederschlag(controller: getTextFields()["RegenVor"]!),
|
LetzterNiederschlag(controller: getTextFields()["RegenVor"]!),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
@@ -253,7 +275,10 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
Hinweise(),
|
const Divider(),
|
||||||
|
Hinweise(
|
||||||
|
hinweise: getTextFields()["Hinweise"]!,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -265,12 +290,18 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
VarTextField(textController: getTextFields()["Bemerk"]!,
|
VarTextField(textController: getTextFields()["Bemerk"]!,
|
||||||
localization: "Bemerkungen",
|
localization: "Bemerkungen",
|
||||||
dbName: "Bemerk",
|
dbName: "Bemerk",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
|
||||||
const SizedBox(height: 20,),
|
const SizedBox(height: 20,),
|
||||||
VarTextField(textController: getTextFields()["IntKomm"]!,
|
VarTextField(
|
||||||
|
textController: getTextFields()["IntKomm"]!,
|
||||||
localization: "Interne Kommunikation",
|
localization: "Interne Kommunikation",
|
||||||
dbName: "IntKomm", required: false),
|
dbName: "IntKomm",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,18 +1,76 @@
|
|||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
|
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class Hinweise extends StatefulWidget {
|
class Hinweise extends StatefulWidget {
|
||||||
const Hinweise({super.key});
|
final TextEditingController hinweise;
|
||||||
|
|
||||||
|
const Hinweise({super.key, required this.hinweise});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<Hinweise> createState() => _HinweiseState();
|
State<Hinweise> createState() => _HinweiseState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _HinweiseState extends State<Hinweise> {
|
class _HinweiseState extends State<Hinweise> {
|
||||||
|
// Vars for Checkboxes
|
||||||
|
bool liegestelleChecked = false;
|
||||||
|
bool kadaverChecked = false;
|
||||||
|
bool sichtungChecked = false;
|
||||||
|
bool heulenChecked = false;
|
||||||
|
bool sonstigesChecked = false;
|
||||||
|
|
||||||
|
// for sonstiges textfield
|
||||||
|
TextEditingController sonstigesController = TextEditingController();
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return SizedBox(
|
return
|
||||||
height: 30,
|
Column(
|
||||||
child: const Placeholder());
|
children: [
|
||||||
|
CheckboxListTile(
|
||||||
|
title: Text("Liegestelle"),
|
||||||
|
value: liegestelleChecked,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() => liegestelleChecked = value ?? false);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
|
||||||
|
CheckboxListTile(
|
||||||
|
title: Text("Wildtierkadaver"),
|
||||||
|
value: kadaverChecked,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() => kadaverChecked = value ?? false);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
|
||||||
|
CheckboxListTile(
|
||||||
|
title: Text("Sichtung"),
|
||||||
|
value: sichtungChecked,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() => sichtungChecked = value ?? false);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
|
||||||
|
CheckboxListTile(
|
||||||
|
title: Text("Heulen"),
|
||||||
|
value: heulenChecked,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() => heulenChecked = value ?? false);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
CheckboxListTile(
|
||||||
|
title: Text("Sonstiges"),
|
||||||
|
value: liegestelleChecked,
|
||||||
|
onChanged: (bool? value) {
|
||||||
|
setState(() => sonstigesChecked = value ?? false);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
|
||||||
|
if (sonstigesChecked)
|
||||||
|
VarTextField(textController: sonstigesController, localization: "Sonstiges", dbName: "HinweiseSonstiges", required: false, dbDesignation: DatabasesEnum.excursion,)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
import 'package:fforte/screens/addCam/cam_widgets.dart';
|
import 'package:fforte/screens/addCam/cam_widgets.dart';
|
||||||
import 'package:fforte/methods/db_helper.dart';
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
import 'package:fforte/methods/http_request.dart';
|
import 'package:fforte/methods/http_request.dart';
|
||||||
import 'package:fforte/screens/sharedWidgets/datum.dart';
|
import 'package:fforte/screens/sharedWidgets/datum.dart';
|
||||||
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||||
@@ -363,11 +364,11 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(AppLocalizations.of(context)!.successful),
|
title: Text(AppLocalizations.of(context)!.successful),
|
||||||
actions: [
|
actions: [
|
||||||
/* TextButton(
|
/* TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: Text(AppLocalizations.of(context)!.back)), */
|
child: Text(AppLocalizations.of(context)!.back)), */
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pushNamedAndRemoveUntil(
|
Navigator.pushNamedAndRemoveUntil(
|
||||||
@@ -460,7 +461,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
// If the user decides to safe his values as a template this function is called to save the values in the database
|
// If the user decides to safe his values as a template this function is called to save the values in the database
|
||||||
// If the user already edits a template this template will be upadted otherwise a new one will be created
|
// If the user already edits a template this template will be upadted otherwise a new one will be created
|
||||||
void saveTemplate() async {
|
void saveTemplate() async {
|
||||||
var placeDB = DBHelper();
|
var placeDB = PlaceDBHelper();
|
||||||
|
|
||||||
Map<String, dynamic> templates = getPlace();
|
Map<String, dynamic> templates = getPlace();
|
||||||
|
|
||||||
@@ -474,7 +475,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
// If the user has filled all needed values this function will be called to safe them in the database
|
// If the user has filled all needed values this function will be called to safe them in the database
|
||||||
// * also creates a json string to send it to the server later
|
// * also creates a json string to send it to the server later
|
||||||
void saveData([bool sent = false]) async {
|
void saveData([bool sent = false]) async {
|
||||||
var placeDB = DBHelper();
|
var placeDB = PlaceDBHelper();
|
||||||
Map<String, dynamic> place = getPlace();
|
Map<String, dynamic> place = getPlace();
|
||||||
|
|
||||||
// Get the ID of the newly added or updated place
|
// Get the ID of the newly added or updated place
|
||||||
@@ -507,6 +508,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
dbName: "Standort",
|
dbName: "Standort",
|
||||||
textController: standortC,
|
textController: standortC,
|
||||||
localization: AppLocalizations.of(context)!.altstort,
|
localization: AppLocalizations.of(context)!.altstort,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
@@ -535,7 +537,9 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: betreuungC,
|
textController: betreuungC,
|
||||||
localization: AppLocalizations.of(context)!.betreuung,
|
localization: AppLocalizations.of(context)!.betreuung,
|
||||||
dbName: "Betreuung",
|
dbName: "Betreuung",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
@@ -543,12 +547,16 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: cid,
|
textController: cid,
|
||||||
localization: AppLocalizations.of(context)!.camLink,
|
localization: AppLocalizations.of(context)!.camLink,
|
||||||
dbName: "CID",
|
dbName: "CID",
|
||||||
required: true),
|
required: true,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: ffTypC,
|
textController: ffTypC,
|
||||||
localization: AppLocalizations.of(context)!.fftyp,
|
localization: AppLocalizations.of(context)!.fftyp,
|
||||||
dbName: "FFTyp",
|
dbName: "FFTyp",
|
||||||
required: true),
|
required: true,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
@@ -578,7 +586,9 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: kSchloNrC,
|
textController: kSchloNrC,
|
||||||
localization: AppLocalizations.of(context)!.kschlonr,
|
localization: AppLocalizations.of(context)!.kschlonr,
|
||||||
dbName: "KSchloNr",
|
dbName: "KSchloNr",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 5,
|
height: 5,
|
||||||
),
|
),
|
||||||
@@ -586,7 +596,9 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: rudelC,
|
textController: rudelC,
|
||||||
localization: AppLocalizations.of(context)!.rudel,
|
localization: AppLocalizations.of(context)!.rudel,
|
||||||
dbName: "Rudel",
|
dbName: "Rudel",
|
||||||
required: true),
|
required: true,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
@@ -650,23 +662,30 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
localization: AppLocalizations.of(context)!.bland,
|
localization: AppLocalizations.of(context)!.bland,
|
||||||
dbName: "BLand",
|
dbName: "BLand",
|
||||||
required: true,
|
required: true,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
defaultValue: "bLand",
|
defaultValue: "bLand",
|
||||||
),
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: lkrC,
|
textController: lkrC,
|
||||||
localization: AppLocalizations.of(context)!.lkr,
|
localization: AppLocalizations.of(context)!.lkr,
|
||||||
dbName: "Lkr",
|
dbName: "Lkr",
|
||||||
required: true),
|
required: true,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: beiOrtC,
|
textController: beiOrtC,
|
||||||
localization: AppLocalizations.of(context)!.beiort,
|
localization: AppLocalizations.of(context)!.beiort,
|
||||||
dbName: "BeiOrt",
|
dbName: "BeiOrt",
|
||||||
required: true),
|
required: true,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: ortInfoC,
|
textController: ortInfoC,
|
||||||
localization: AppLocalizations.of(context)!.ortinfo,
|
localization: AppLocalizations.of(context)!.ortinfo,
|
||||||
dbName: "OrtInfo",
|
dbName: "OrtInfo",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
@@ -735,7 +754,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
const SizedBox(width: 15,),
|
const SizedBox(width: 15,),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: VarTextField(otherDefault: "24", textController: kTage1C, localization: AppLocalizations.of(context)!.ktage1, dbName: "KTage1", required: true))
|
child: VarTextField(otherDefault: "24", textController: kTage1C, localization: AppLocalizations.of(context)!.ktage1, dbName: "KTage1", required: true, dbDesignation: DatabasesEnum.place,))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -747,7 +766,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
const SizedBox(width: 15,),
|
const SizedBox(width: 15,),
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 4,
|
flex: 4,
|
||||||
child: VarTextField(otherDefault: "48", textController: kTage2C, localization: AppLocalizations.of(context)!.ktage2, dbName: "KTage2", required: true))
|
child: VarTextField(otherDefault: "48", textController: kTage2C, localization: AppLocalizations.of(context)!.ktage2, dbName: "KTage2", required: true, dbDesignation: DatabasesEnum.place,))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
@@ -771,17 +790,22 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: auftragC,
|
textController: auftragC,
|
||||||
localization: AppLocalizations.of(context)!.auftrag,
|
localization: AppLocalizations.of(context)!.auftrag,
|
||||||
dbName: "Auftrag",
|
dbName: "Auftrag",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: kontAbspC,
|
textController: kontAbspC,
|
||||||
localization: AppLocalizations.of(context)!.kontabsp,
|
localization: AppLocalizations.of(context)!.kontabsp,
|
||||||
dbName: "KontAbsp",
|
dbName: "KontAbsp",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: sonstBemC,
|
textController: sonstBemC,
|
||||||
localization:
|
localization:
|
||||||
AppLocalizations.of(context)!.sonstbemerkungen,
|
AppLocalizations.of(context)!.sonstbemerkungen,
|
||||||
dbName: "SonstBem",
|
dbName: "SonstBem",
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
required: false),
|
required: false),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
@@ -794,6 +818,7 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: adresse1C,
|
textController: adresse1C,
|
||||||
localization: AppLocalizations.of(context)!.adresse1,
|
localization: AppLocalizations.of(context)!.adresse1,
|
||||||
dbName: "Adresse1",
|
dbName: "Adresse1",
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
required: true,
|
required: true,
|
||||||
defaultValue: "addresse1",
|
defaultValue: "addresse1",
|
||||||
),
|
),
|
||||||
@@ -801,12 +826,16 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: adresse2C,
|
textController: adresse2C,
|
||||||
localization: AppLocalizations.of(context)!.adresse2,
|
localization: AppLocalizations.of(context)!.adresse2,
|
||||||
dbName: "Adresse2",
|
dbName: "Adresse2",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: adresse3C,
|
textController: adresse3C,
|
||||||
localization: AppLocalizations.of(context)!.adresse3,
|
localization: AppLocalizations.of(context)!.adresse3,
|
||||||
dbName: "Adresse2",
|
dbName: "Adresse2",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 15,
|
height: 15,
|
||||||
),
|
),
|
||||||
@@ -814,22 +843,30 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
textController: fKontakt1C,
|
textController: fKontakt1C,
|
||||||
localization: AppLocalizations.of(context)!.fkontakt1,
|
localization: AppLocalizations.of(context)!.fkontakt1,
|
||||||
dbName: "FKontakt1",
|
dbName: "FKontakt1",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: fKontakt2C,
|
textController: fKontakt2C,
|
||||||
localization: AppLocalizations.of(context)!.fkontakt2,
|
localization: AppLocalizations.of(context)!.fkontakt2,
|
||||||
dbName: "FKontakt2",
|
dbName: "FKontakt2",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: fKontakt3C,
|
textController: fKontakt3C,
|
||||||
localization: AppLocalizations.of(context)!.fkontakt3,
|
localization: AppLocalizations.of(context)!.fkontakt3,
|
||||||
dbName: "FKontakt3",
|
dbName: "FKontakt3",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
VarTextField(
|
VarTextField(
|
||||||
textController: intKommC,
|
textController: intKommC,
|
||||||
localization: AppLocalizations.of(context)!.intkomm,
|
localization: AppLocalizations.of(context)!.intkomm,
|
||||||
dbName: "IntKomm",
|
dbName: "IntKomm",
|
||||||
required: false),
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.place,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
))
|
))
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
import 'package:fforte/methods/db_helper.dart';
|
import 'package:fforte/enums/databases.dart';
|
||||||
|
import 'package:fforte/methods/excursion_db_helper.dart';
|
||||||
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
@@ -6,6 +8,7 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
class VarTextField extends StatefulWidget {
|
class VarTextField extends StatefulWidget {
|
||||||
final TextEditingController textController;
|
final TextEditingController textController;
|
||||||
final String localization;
|
final String localization;
|
||||||
|
final DatabasesEnum dbDesignation;
|
||||||
final String dbName;
|
final String dbName;
|
||||||
final String? defaultValue;
|
final String? defaultValue;
|
||||||
final String? otherDefault;
|
final String? otherDefault;
|
||||||
@@ -17,6 +20,7 @@ class VarTextField extends StatefulWidget {
|
|||||||
required this.localization,
|
required this.localization,
|
||||||
required this.dbName,
|
required this.dbName,
|
||||||
required this.required,
|
required this.required,
|
||||||
|
required this.dbDesignation,
|
||||||
this.defaultValue,
|
this.defaultValue,
|
||||||
this.otherDefault});
|
this.otherDefault});
|
||||||
|
|
||||||
@@ -43,9 +47,15 @@ class _VarTextFieldState extends State<VarTextField> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<List<Map<String, dynamic>>> _loadData() async {
|
Future<List<Map<String, dynamic>>> _loadData() async {
|
||||||
var places = await DBHelper().getPlace();
|
if (widget.dbDesignation == DatabasesEnum.excursion) {
|
||||||
var templates = await DBHelper().getTemplates();
|
var entries = await PlaceDBHelper().getPlace();
|
||||||
return [...places, ...templates];
|
var templatesEntries = await PlaceDBHelper().getTemplates();
|
||||||
|
return [...entries, ...templatesEntries];
|
||||||
|
} else {
|
||||||
|
var entries = await ExcursionDBHelper().getExcursionen();
|
||||||
|
var templatesEntries = await ExcursionDBHelper().getTemplates();
|
||||||
|
return [...entries, ...templatesEntries];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void _loadPref() {
|
void _loadPref() {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
||||||
import 'package:fforte/methods/db_helper.dart';
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
@@ -24,8 +24,8 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
place = DBHelper().getPlace();
|
place = PlaceDBHelper().getPlace();
|
||||||
templates = DBHelper().getTemplates();
|
templates = PlaceDBHelper().getTemplates();
|
||||||
}
|
}
|
||||||
|
|
||||||
// functions to delete all entries LOCALLY
|
// functions to delete all entries LOCALLY
|
||||||
@@ -44,10 +44,10 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
var placeDB = DBHelper();
|
var placeDB = PlaceDBHelper();
|
||||||
placeDB.deleteAllPlaces();
|
placeDB.deleteAllPlaces();
|
||||||
setState(() {
|
setState(() {
|
||||||
place = DBHelper().getPlace();
|
place = PlaceDBHelper().getPlace();
|
||||||
});
|
});
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@@ -64,9 +64,9 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void delSinglePlace(int id) async {
|
void delSinglePlace(int id) async {
|
||||||
DBHelper().deletePlace(id.toString());
|
PlaceDBHelper().deletePlace(id.toString());
|
||||||
setState(() {
|
setState(() {
|
||||||
place = DBHelper().getPlace();
|
place = PlaceDBHelper().getPlace();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,10 +85,10 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
var placeDB = DBHelper();
|
var placeDB = PlaceDBHelper();
|
||||||
placeDB.deleteAllTemplates();
|
placeDB.deleteAllTemplates();
|
||||||
setState(() {
|
setState(() {
|
||||||
templates = DBHelper().getTemplates();
|
templates = PlaceDBHelper().getTemplates();
|
||||||
});
|
});
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
// This is a basic Flutter widget test.
|
|
||||||
//
|
|
||||||
// To perform an interaction with a widget in your test, use the WidgetTester
|
|
||||||
// utility in the flutter_test package. For example, you can send tap and scroll
|
|
||||||
// gestures. You can also use WidgetTester to find child widgets in the widget
|
|
||||||
// tree, read text, and verify that the values of widget properties are correct.
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
|
||||||
|
|
||||||
import 'package:fforte/main.dart';
|
|
||||||
|
|
||||||
void main() {
|
|
||||||
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
|
|
||||||
// Build our app and trigger a frame.
|
|
||||||
await tester.pumpWidget(const MyApp());
|
|
||||||
|
|
||||||
// Verify that our counter starts at 0.
|
|
||||||
expect(find.text('0'), findsOneWidget);
|
|
||||||
expect(find.text('1'), findsNothing);
|
|
||||||
|
|
||||||
// Tap the '+' icon and trigger a frame.
|
|
||||||
await tester.tap(find.byIcon(Icons.add));
|
|
||||||
await tester.pump();
|
|
||||||
|
|
||||||
// Verify that our counter has incremented.
|
|
||||||
expect(find.text('0'), findsNothing);
|
|
||||||
expect(find.text('1'), findsOneWidget);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user