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
|
||||
// ! functions may not be named complete correctly
|
||||
|
||||
class DBHelper {
|
||||
class PlaceDBHelper {
|
||||
static Database? _placeDB;
|
||||
|
||||
// checks if the databses are existing and creates them with the initPlaceDatabase function if not
|
||||
@@ -32,7 +32,7 @@ class DBHelper {
|
||||
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)');
|
||||
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(
|
||||
'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;
|
||||
|
||||
final existingCID = await placeDBClient.query(
|
||||
'templates',
|
||||
'placeTemplates',
|
||||
where: 'ID = ?',
|
||||
whereArgs: [templates['ID']],
|
||||
);
|
||||
@@ -89,7 +89,7 @@ class DBHelper {
|
||||
}
|
||||
|
||||
await placeDBClient.insert(
|
||||
'templates',
|
||||
'placeTemplates',
|
||||
templates,
|
||||
// conflictAlgorithm: ConflictAlgorithm.replace,
|
||||
);
|
||||
@@ -100,7 +100,7 @@ class DBHelper {
|
||||
var placeDBClient = await placeDB;
|
||||
|
||||
await placeDBClient.update(
|
||||
'templates',
|
||||
'placeTemplates',
|
||||
template,
|
||||
where: "ID = ?",
|
||||
whereArgs: [template['ID']],
|
||||
@@ -116,7 +116,7 @@ class DBHelper {
|
||||
// get the finished templates from db
|
||||
Future<List<Map<String, dynamic>>> getTemplates() async {
|
||||
var placeDBClient = await placeDB;
|
||||
return await placeDBClient.query('templates');
|
||||
return await placeDBClient.query('placeTemplates');
|
||||
}
|
||||
|
||||
// deletes all finished entries from the db LOCALLY
|
||||
@@ -128,14 +128,14 @@ class DBHelper {
|
||||
// deletes all templates from the db LOCALLY
|
||||
Future<void> deleteAllTemplates() async {
|
||||
var placeDBClient = await placeDB;
|
||||
await placeDBClient.delete('templates');
|
||||
await placeDBClient.delete('placeTemplates');
|
||||
}
|
||||
|
||||
// delete specific template
|
||||
Future<void> deleteTemplate(String id) async {
|
||||
var placeDBClient = await placeDB;
|
||||
await placeDBClient.delete(
|
||||
'templates',
|
||||
'placeTemplates',
|
||||
where: 'ID = ?',
|
||||
whereArgs: [id],
|
||||
);
|
||||
@@ -1,4 +1,5 @@
|
||||
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/bima_nutzer.dart';
|
||||
import 'package:fforte/screens/Excursion/widgets/hinweise.dart';
|
||||
@@ -23,64 +24,64 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
|
||||
Map<String, TextEditingController> getTextFields() {
|
||||
Map<String, TextEditingController> rmap = {
|
||||
// Step 1
|
||||
"LogDat": TextEditingController(),
|
||||
"Rudel": TextEditingController(),
|
||||
"Teilnehm": TextEditingController(),
|
||||
"Jahr": TextEditingController(),
|
||||
"Dauer": TextEditingController(),
|
||||
"MHund": TextEditingController(),
|
||||
"MLeine": TextEditingController(),
|
||||
"BLand": TextEditingController(),
|
||||
"Lkr": TextEditingController(),
|
||||
"BeiOrt": TextEditingController(),
|
||||
"BimaNr": TextEditingController(),
|
||||
"BimaName": TextEditingController(),
|
||||
"BimaNutzer": TextEditingController(),
|
||||
"BimaAGV": TextEditingController(),
|
||||
// Step 1
|
||||
"LogDat": TextEditingController(),
|
||||
"Rudel": TextEditingController(),
|
||||
"Teilnehm": TextEditingController(),
|
||||
"Jahr": TextEditingController(),
|
||||
"Dauer": TextEditingController(),
|
||||
"MHund": TextEditingController(),
|
||||
"MLeine": TextEditingController(),
|
||||
"BLand": TextEditingController(),
|
||||
"Lkr": TextEditingController(),
|
||||
"BeiOrt": TextEditingController(),
|
||||
"BimaNr": TextEditingController(),
|
||||
"BimaName": TextEditingController(),
|
||||
"BimaNutzer": TextEditingController(),
|
||||
"BimaAGV": TextEditingController(),
|
||||
|
||||
// Step 2
|
||||
"Wetter": TextEditingController(),
|
||||
"Temperat": TextEditingController(),
|
||||
"RegenVor": TextEditingController(),
|
||||
"KmAuto": TextEditingController(),
|
||||
"KmFuss": TextEditingController(),
|
||||
"KmRad": TextEditingController(),
|
||||
"KmTotal": TextEditingController(),
|
||||
"KmAuProz": TextEditingController(),
|
||||
"KmFuProz": TextEditingController(),
|
||||
"KmRaProz": TextEditingController(),
|
||||
// Step 2
|
||||
"Wetter": TextEditingController(),
|
||||
"Temperat": TextEditingController(),
|
||||
"RegenVor": TextEditingController(),
|
||||
"KmAuto": TextEditingController(),
|
||||
"KmFuss": TextEditingController(),
|
||||
"KmRad": TextEditingController(),
|
||||
"KmTotal": TextEditingController(),
|
||||
"KmAuProz": TextEditingController(),
|
||||
"KmFuProz": TextEditingController(),
|
||||
"KmRaProz": TextEditingController(),
|
||||
|
||||
// Spur maybe own step?
|
||||
"SpGut": TextEditingController(),
|
||||
"SpMittel": TextEditingController(),
|
||||
"SpSchlecht": TextEditingController(),
|
||||
"SpurFund": TextEditingController(),
|
||||
"SpurLang": TextEditingController(),
|
||||
"SpurTiere": TextEditingController(),
|
||||
"SpSicher": TextEditingController(),
|
||||
"WelpenSp": TextEditingController(),
|
||||
"WelpenAnz": TextEditingController(),
|
||||
"WpSicher": TextEditingController(),
|
||||
// Spur maybe own step?
|
||||
"SpGut": TextEditingController(),
|
||||
"SpMittel": TextEditingController(),
|
||||
"SpSchlecht": TextEditingController(),
|
||||
"SpurFund": TextEditingController(),
|
||||
"SpurLang": TextEditingController(),
|
||||
"SpurTiere": TextEditingController(),
|
||||
"SpSicher": TextEditingController(),
|
||||
"WelpenSp": TextEditingController(),
|
||||
"WelpenAnz": TextEditingController(),
|
||||
"WpSicher": TextEditingController(),
|
||||
|
||||
"LosungGes": TextEditingController(),
|
||||
"LosungAnz": TextEditingController(),
|
||||
"LosungGen": TextEditingController(),
|
||||
"UrinAnz": TextEditingController(),
|
||||
"UrinGen": TextEditingController(),
|
||||
"OestrAnz": TextEditingController(),
|
||||
"OestrGen": TextEditingController(),
|
||||
"HaarAnz": TextEditingController(),
|
||||
"HaarGen": TextEditingController(),
|
||||
"LosungKm": TextEditingController(),
|
||||
"GenetiKm": TextEditingController(),
|
||||
"Hinweise": TextEditingController(),
|
||||
"LosungGes": TextEditingController(),
|
||||
"LosungAnz": TextEditingController(),
|
||||
"LosungGen": TextEditingController(),
|
||||
"UrinAnz": TextEditingController(),
|
||||
"UrinGen": TextEditingController(),
|
||||
"OestrAnz": TextEditingController(),
|
||||
"OestrGen": TextEditingController(),
|
||||
"HaarAnz": TextEditingController(),
|
||||
"HaarGen": TextEditingController(),
|
||||
"LosungKm": TextEditingController(),
|
||||
"GenetiKm": TextEditingController(),
|
||||
"Hinweise": TextEditingController(),
|
||||
|
||||
// Step 3
|
||||
"Bemerk": TextEditingController(),
|
||||
"IntKomm": TextEditingController(),
|
||||
"FallNum": TextEditingController(),
|
||||
};
|
||||
// Step 3
|
||||
"Bemerk": TextEditingController(),
|
||||
"IntKomm": TextEditingController(),
|
||||
"FallNum": TextEditingController(),
|
||||
};
|
||||
|
||||
return rmap;
|
||||
}
|
||||
@@ -90,235 +91,265 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Step> getSteps() => [
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
Datum(
|
||||
initDatum: DateTime.now(),
|
||||
onDateChanged: (date) {
|
||||
getTextFields()["LogDat"]!.text = date.toString();
|
||||
},
|
||||
name: AppLocalizations.of(context)!.date,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Rudel"]!,
|
||||
localization: AppLocalizations.of(context)!.rudel,
|
||||
dbName: "Rudel",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Teilnehm"]!,
|
||||
localization: AppLocalizations.of(context)!.teilnehmer,
|
||||
dbName: "Teilnehm",
|
||||
required: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Dauer"]!,
|
||||
localization: AppLocalizations.of(context)!.dauer,
|
||||
dbName: "Dauer",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
HundULeine(onMHundChanged: (mHund, mLeine) {
|
||||
getTextFields()["MHund"]!.text = mHund;
|
||||
getTextFields()["MLeine"]!.text = mLeine;
|
||||
|
||||
// print(mHund);
|
||||
// print(mLeine);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BLand"]!,
|
||||
localization: AppLocalizations.of(context)!.bland,
|
||||
dbName: "BLand",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Lkr"]!,
|
||||
localization: AppLocalizations.of(context)!.lkr,
|
||||
dbName: "Lkr",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BeiOrt"]!,
|
||||
localization: AppLocalizations.of(context)!.beiort,
|
||||
dbName: "BeiOrt",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaNr"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaNr,
|
||||
dbName: "BimaNr",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaName"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaName,
|
||||
dbName: "BimaName",
|
||||
required: false),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
BimaNutzer(onBimaNutzerChanged: (value) {
|
||||
setState(() {
|
||||
getTextFields()["BimaNutzer"]!.text = value;
|
||||
});
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaAGV"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||
dbName: "BimaAGV",
|
||||
required: false)
|
||||
],
|
||||
)),
|
||||
Step(
|
||||
title: const Text("step2"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(
|
||||
textController: getTextFields()["Wetter"]!,
|
||||
localization: "Wetter",
|
||||
dbName: "Wetter",
|
||||
required: false),
|
||||
const SizedBox(height: 10),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Temperat"]!,
|
||||
localization: "Temperatur",
|
||||
dbName: "Temperat",
|
||||
required: false),
|
||||
const SizedBox(height: 10),
|
||||
LetzterNiederschlag(controller: getTextFields()["RegenVor"]!),
|
||||
const SizedBox(height: 20),
|
||||
StreckeUSpurbedingungen(
|
||||
kmAutoController: getTextFields()["KmAuto"]!,
|
||||
kmFussController: getTextFields()["KmFuss"]!,
|
||||
kmRadController: getTextFields()["KmRad"]!,
|
||||
spGutController: getTextFields()["SpGut"]!,
|
||||
spMittelController: getTextFields()["SpMittel"]!,
|
||||
spSchlechtController: getTextFields()["SpSchlecht"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(),
|
||||
SpurGefunden(
|
||||
spurFund: getTextFields()["SpurFund"]!,
|
||||
spurLang: getTextFields()["SpurLang"]!,
|
||||
spurTiere: getTextFields()["SpurTiere"]!,
|
||||
spSicher: getTextFields()["SpSicher"]!,
|
||||
welpenSp: getTextFields()["WelpenSp"]!,
|
||||
welpenAnz: getTextFields()["WelpenAnz"]!,
|
||||
wpSicher: getTextFields()["WpSicher"]!),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Anzahlen(
|
||||
losungAnz: getTextFields()["LosungAnz"]!,
|
||||
losungGes: getTextFields()["LosungGes"]!,
|
||||
losungGen: getTextFields()["LosungGen"]!,
|
||||
urinAnz: getTextFields()["UrinAnz"]!,
|
||||
urinGen: getTextFields()["UrinGen"]!,
|
||||
oestrAnz: getTextFields()["OestrAnz"]!,
|
||||
oestrGen: getTextFields()["OestrGen"]!,
|
||||
haarAnz: getTextFields()["HaarAnz"]!,
|
||||
haarGen: getTextFields()["HaarGen"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Hinweise(),
|
||||
],
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
Datum(
|
||||
initDatum: DateTime.now(),
|
||||
onDateChanged: (date) {
|
||||
getTextFields()["LogDat"]!.text = date.toString();
|
||||
},
|
||||
name: AppLocalizations.of(context)!.date,
|
||||
),
|
||||
),
|
||||
|
||||
Step(
|
||||
title: const Text("step3"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(textController: getTextFields()["Bemerk"]!,
|
||||
localization: "Bemerkungen",
|
||||
dbName: "Bemerk",
|
||||
required: false),
|
||||
|
||||
const SizedBox(height: 20,),
|
||||
VarTextField(textController: getTextFields()["IntKomm"]!,
|
||||
localization: "Interne Kommunikation",
|
||||
dbName: "IntKomm", required: false),
|
||||
],
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
),
|
||||
];
|
||||
VarTextField(
|
||||
textController: getTextFields()["Rudel"]!,
|
||||
localization: AppLocalizations.of(context)!.rudel,
|
||||
dbName: "Rudel",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Teilnehm"]!,
|
||||
localization: AppLocalizations.of(context)!.teilnehmer,
|
||||
dbName: "Teilnehm",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Dauer"]!,
|
||||
localization: AppLocalizations.of(context)!.dauer,
|
||||
dbName: "Dauer",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
HundULeine(onMHundChanged: (mHund, mLeine) {
|
||||
getTextFields()["MHund"]!.text = mHund;
|
||||
getTextFields()["MLeine"]!.text = mLeine;
|
||||
|
||||
// print(mHund);
|
||||
// print(mLeine);
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BLand"]!,
|
||||
localization: AppLocalizations.of(context)!.bland,
|
||||
dbName: "BLand",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Lkr"]!,
|
||||
localization: AppLocalizations.of(context)!.lkr,
|
||||
dbName: "Lkr",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BeiOrt"]!,
|
||||
localization: AppLocalizations.of(context)!.beiort,
|
||||
dbName: "BeiOrt",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const Divider(),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaNr"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaNr,
|
||||
dbName: "BimaNr",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaName"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaName,
|
||||
dbName: "BimaName",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
BimaNutzer(onBimaNutzerChanged: (value) {
|
||||
setState(() {
|
||||
getTextFields()["BimaNutzer"]!.text = value;
|
||||
});
|
||||
}),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
VarTextField(
|
||||
textController: getTextFields()["BimaAGV"]!,
|
||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||
dbName: "BimaAGV",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
)
|
||||
],
|
||||
)),
|
||||
Step(
|
||||
title: const Text("step2"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(
|
||||
textController: getTextFields()["Wetter"]!,
|
||||
localization: "Wetter",
|
||||
dbName: "Wetter",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
VarTextField(
|
||||
textController: getTextFields()["Temperat"]!,
|
||||
localization: "Temperatur",
|
||||
dbName: "Temperat",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
LetzterNiederschlag(controller: getTextFields()["RegenVor"]!),
|
||||
const SizedBox(height: 20),
|
||||
StreckeUSpurbedingungen(
|
||||
kmAutoController: getTextFields()["KmAuto"]!,
|
||||
kmFussController: getTextFields()["KmFuss"]!,
|
||||
kmRadController: getTextFields()["KmRad"]!,
|
||||
spGutController: getTextFields()["SpGut"]!,
|
||||
spMittelController: getTextFields()["SpMittel"]!,
|
||||
spSchlechtController: getTextFields()["SpSchlecht"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(),
|
||||
SpurGefunden(
|
||||
spurFund: getTextFields()["SpurFund"]!,
|
||||
spurLang: getTextFields()["SpurLang"]!,
|
||||
spurTiere: getTextFields()["SpurTiere"]!,
|
||||
spSicher: getTextFields()["SpSicher"]!,
|
||||
welpenSp: getTextFields()["WelpenSp"]!,
|
||||
welpenAnz: getTextFields()["WelpenAnz"]!,
|
||||
wpSicher: getTextFields()["WpSicher"]!),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Anzahlen(
|
||||
losungAnz: getTextFields()["LosungAnz"]!,
|
||||
losungGes: getTextFields()["LosungGes"]!,
|
||||
losungGen: getTextFields()["LosungGen"]!,
|
||||
urinAnz: getTextFields()["UrinAnz"]!,
|
||||
urinGen: getTextFields()["UrinGen"]!,
|
||||
oestrAnz: getTextFields()["OestrAnz"]!,
|
||||
oestrGen: getTextFields()["OestrGen"]!,
|
||||
haarAnz: getTextFields()["HaarAnz"]!,
|
||||
haarGen: getTextFields()["HaarGen"]!,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
const Divider(),
|
||||
Hinweise(
|
||||
hinweise: getTextFields()["Hinweise"]!,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Step(
|
||||
title: const Text("step3"),
|
||||
content: Column(
|
||||
children: [
|
||||
VarTextField(textController: getTextFields()["Bemerk"]!,
|
||||
localization: "Bemerkungen",
|
||||
dbName: "Bemerk",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
|
||||
const SizedBox(height: 20,),
|
||||
VarTextField(
|
||||
textController: getTextFields()["IntKomm"]!,
|
||||
localization: "Interne Kommunikation",
|
||||
dbName: "IntKomm",
|
||||
required: false,
|
||||
dbDesignation: DatabasesEnum.excursion,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.excursion),
|
||||
),
|
||||
body: PageTransitionSwitcher(
|
||||
duration: const Duration(microseconds: 800),
|
||||
transitionBuilder: (Widget child, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return SharedAxisTransition(
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
transitionType: SharedAxisTransitionType.vertical,
|
||||
child: child,
|
||||
);
|
||||
appBar: AppBar(
|
||||
title: Text(AppLocalizations.of(context)!.excursion),
|
||||
),
|
||||
body: PageTransitionSwitcher(
|
||||
duration: const Duration(microseconds: 800),
|
||||
transitionBuilder: (Widget child, Animation<double> animation,
|
||||
Animation<double> secondaryAnimation) {
|
||||
return SharedAxisTransition(
|
||||
animation: animation,
|
||||
secondaryAnimation: secondaryAnimation,
|
||||
transitionType: SharedAxisTransitionType.vertical,
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
child: Stepper(
|
||||
key: ValueKey<int>(currentStep),
|
||||
steps: getSteps(),
|
||||
currentStep: currentStep,
|
||||
onStepTapped: (value) {
|
||||
setState(() {
|
||||
currentStep = value;
|
||||
});
|
||||
},
|
||||
child: Stepper(
|
||||
key: ValueKey<int>(currentStep),
|
||||
steps: getSteps(),
|
||||
currentStep: currentStep,
|
||||
onStepTapped: (value) {
|
||||
setState(() {
|
||||
currentStep = value;
|
||||
});
|
||||
},
|
||||
onStepContinue: () {
|
||||
final isLastStep = currentStep == getSteps().length - 1;
|
||||
onStepContinue: () {
|
||||
final isLastStep = currentStep == getSteps().length - 1;
|
||||
|
||||
if (!isLastStep) {
|
||||
if (!isLastStep) {
|
||||
setState(() {
|
||||
currentStep += 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
onStepCancel: () {
|
||||
if (currentStep == 0) {
|
||||
},
|
||||
onStepCancel: () {
|
||||
if (currentStep == 0) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
setState(() {
|
||||
currentStep -= 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
));
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,76 @@
|
||||
import 'package:fforte/enums/databases.dart';
|
||||
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class Hinweise extends StatefulWidget {
|
||||
const Hinweise({super.key});
|
||||
final TextEditingController hinweise;
|
||||
|
||||
const Hinweise({super.key, required this.hinweise});
|
||||
|
||||
@override
|
||||
State<Hinweise> createState() => _HinweiseState();
|
||||
}
|
||||
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 30,
|
||||
child: const Placeholder());
|
||||
return
|
||||
Column(
|
||||
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,)
|
||||
],
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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:shared_preferences/shared_preferences.dart';
|
||||
|
||||
@@ -6,19 +8,21 @@ import 'package:shared_preferences/shared_preferences.dart';
|
||||
class VarTextField extends StatefulWidget {
|
||||
final TextEditingController textController;
|
||||
final String localization;
|
||||
final DatabasesEnum dbDesignation;
|
||||
final String dbName;
|
||||
final String? defaultValue;
|
||||
final String? otherDefault;
|
||||
final bool required;
|
||||
|
||||
const VarTextField(
|
||||
{super.key,
|
||||
required this.textController,
|
||||
required this.localization,
|
||||
required this.dbName,
|
||||
required this.required,
|
||||
this.defaultValue,
|
||||
this.otherDefault});
|
||||
{super.key,
|
||||
required this.textController,
|
||||
required this.localization,
|
||||
required this.dbName,
|
||||
required this.required,
|
||||
required this.dbDesignation,
|
||||
this.defaultValue,
|
||||
this.otherDefault});
|
||||
|
||||
@override
|
||||
State<VarTextField> createState() => _VarTextFieldState();
|
||||
@@ -43,9 +47,15 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
}
|
||||
|
||||
Future<List<Map<String, dynamic>>> _loadData() async {
|
||||
var places = await DBHelper().getPlace();
|
||||
var templates = await DBHelper().getTemplates();
|
||||
return [...places, ...templates];
|
||||
if (widget.dbDesignation == DatabasesEnum.excursion) {
|
||||
var entries = await PlaceDBHelper().getPlace();
|
||||
var templatesEntries = await PlaceDBHelper().getTemplates();
|
||||
return [...entries, ...templatesEntries];
|
||||
} else {
|
||||
var entries = await ExcursionDBHelper().getExcursionen();
|
||||
var templatesEntries = await ExcursionDBHelper().getTemplates();
|
||||
return [...entries, ...templatesEntries];
|
||||
}
|
||||
}
|
||||
|
||||
void _loadPref() {
|
||||
@@ -63,35 +73,35 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
return Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: TextField(
|
||||
controller: widget.textController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
widget.textController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.localization,
|
||||
enabledBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey)),
|
||||
focusedBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey))),
|
||||
)),
|
||||
flex: 5,
|
||||
child: TextField(
|
||||
controller: widget.textController,
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: null,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
widget.textController.text = value;
|
||||
});
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
hintText: widget.localization,
|
||||
enabledBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey)),
|
||||
focusedBorder: widget.required
|
||||
? (widget.textController.text.isEmpty
|
||||
? const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.red))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.green)))
|
||||
: const UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.grey))),
|
||||
)),
|
||||
const Expanded(
|
||||
child: SizedBox(
|
||||
width: 15,
|
||||
@@ -102,10 +112,10 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
child: Align(
|
||||
alignment: Alignment.bottomLeft,
|
||||
child: FutureBuilder<List<Map<String, dynamic>>>(
|
||||
future: dbVar,
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
future: dbVar,
|
||||
builder: (BuildContext context,
|
||||
AsyncSnapshot<List<Map<String, dynamic>>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
// Filtern der Daten, um sicherzustellen, dass keine 'null' Werte für den Schlüssel dbName vorhanden sind
|
||||
var filteredData = snapshot.data!
|
||||
.where((item) =>
|
||||
@@ -136,8 +146,8 @@ class _VarTextFieldState extends State<VarTextField> {
|
||||
} else {
|
||||
return const CircularProgressIndicator();
|
||||
}
|
||||
},
|
||||
),
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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_gen/gen_l10n/app_localizations.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
@@ -24,8 +24,8 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
place = DBHelper().getPlace();
|
||||
templates = DBHelper().getTemplates();
|
||||
place = PlaceDBHelper().getPlace();
|
||||
templates = PlaceDBHelper().getTemplates();
|
||||
}
|
||||
|
||||
// functions to delete all entries LOCALLY
|
||||
@@ -44,10 +44,10 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
var placeDB = DBHelper();
|
||||
var placeDB = PlaceDBHelper();
|
||||
placeDB.deleteAllPlaces();
|
||||
setState(() {
|
||||
place = DBHelper().getPlace();
|
||||
place = PlaceDBHelper().getPlace();
|
||||
});
|
||||
|
||||
Navigator.of(context).pop();
|
||||
@@ -64,9 +64,9 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
}
|
||||
|
||||
void delSinglePlace(int id) async {
|
||||
DBHelper().deletePlace(id.toString());
|
||||
PlaceDBHelper().deletePlace(id.toString());
|
||||
setState(() {
|
||||
place = DBHelper().getPlace();
|
||||
place = PlaceDBHelper().getPlace();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -85,10 +85,10 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
var placeDB = DBHelper();
|
||||
var placeDB = PlaceDBHelper();
|
||||
placeDB.deleteAllTemplates();
|
||||
setState(() {
|
||||
templates = DBHelper().getTemplates();
|
||||
templates = PlaceDBHelper().getTemplates();
|
||||
});
|
||||
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