begin cleanup of view_cams and begin of making it usable with exursion and place
time refactoring refactoring again
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
import 'package:fforte/screens/excursion/excursion_main.dart';
|
import 'package:fforte/screens/excursion/excursion_main.dart';
|
||||||
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
||||||
import 'package:fforte/screens/intro_screen.dart';
|
import 'package:fforte/screens/intro_screen.dart';
|
||||||
@@ -46,7 +47,7 @@ class MyApp extends StatelessWidget {
|
|||||||
routes: {
|
routes: {
|
||||||
'/home': (context) => const HomePage(),
|
'/home': (context) => const HomePage(),
|
||||||
'/addCamMain': (context) => const AddCamMain(),
|
'/addCamMain': (context) => const AddCamMain(),
|
||||||
'/viewCams': (context) => const ViewCams(),
|
'/viewCams': (context) => const ViewCams(dbType: DatabasesEnum.place,),
|
||||||
'/introScreen': (context) => const IntroScreen(),
|
'/introScreen': (context) => const IntroScreen(),
|
||||||
'/settings': (context) => const Settings(),
|
'/settings': (context) => const Settings(),
|
||||||
'/excursion': (context) => const ExcursionMain(),
|
'/excursion': (context) => const ExcursionMain(),
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'package:fforte/enums/databases.dart';
|
import 'package:fforte/enums/databases.dart';
|
||||||
import 'package:fforte/screens/helper/dialog_helper.dart';
|
import 'package:fforte/screens/helper/add_entries_dialog_helper.dart';
|
||||||
import 'package:fforte/screens/helper/snack_bar_helper.dart';
|
import 'package:fforte/screens/helper/snack_bar_helper.dart';
|
||||||
import 'package:fforte/screens/addCam/exceptions/location_disabled_exception.dart';
|
import 'package:fforte/screens/addCam/exceptions/location_disabled_exception.dart';
|
||||||
import 'package:fforte/screens/addCam/exceptions/location_forbidden_exception.dart';
|
import 'package:fforte/screens/addCam/exceptions/location_forbidden_exception.dart';
|
||||||
@@ -735,11 +735,11 @@ class _AddCamMainState extends State<AddCamMain> {
|
|||||||
bool empty = CheckRequired.checkRequired(rmap);
|
bool empty = CheckRequired.checkRequired(rmap);
|
||||||
|
|
||||||
if (empty == true) {
|
if (empty == true) {
|
||||||
DialogHelper.showTemplateDialog(context, getFieldsText(),
|
AddEntriesDialogHelper.showTemplateDialog(context, getFieldsText(),
|
||||||
widget.existingData?.isNotEmpty ?? false);
|
widget.existingData?.isNotEmpty ?? false);
|
||||||
return;
|
return;
|
||||||
} else if (empty == false) {
|
} else if (empty == false) {
|
||||||
await DialogHelper.showSaveOptionsDialog(
|
await AddEntriesDialogHelper.showSaveOptionsDialog(
|
||||||
context, getFieldsText(), widget.isTemplate);
|
context, getFieldsText(), widget.isTemplate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import 'package:fforte/screens/excursion/widgets/hund_u_leine.dart';
|
|||||||
import 'package:fforte/screens/excursion/widgets/letzter_niederschlag.dart';
|
import 'package:fforte/screens/excursion/widgets/letzter_niederschlag.dart';
|
||||||
import 'package:fforte/screens/excursion/widgets/spur_gefunden.dart';
|
import 'package:fforte/screens/excursion/widgets/spur_gefunden.dart';
|
||||||
import 'package:fforte/screens/excursion/widgets/strecke_u_spurbedingungen.dart';
|
import 'package:fforte/screens/excursion/widgets/strecke_u_spurbedingungen.dart';
|
||||||
import 'package:fforte/screens/helper/dialog_helper.dart';
|
import 'package:fforte/screens/helper/add_entries_dialog_helper.dart';
|
||||||
import 'package:fforte/screens/sharedMethods/check_required.dart';
|
import 'package:fforte/screens/sharedMethods/check_required.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';
|
||||||
@@ -24,65 +24,65 @@ class ExcursionMain extends StatefulWidget {
|
|||||||
class _ExcursionMainState extends State<ExcursionMain> {
|
class _ExcursionMainState extends State<ExcursionMain> {
|
||||||
// all TextEditingController because its easier
|
// all TextEditingController because its easier
|
||||||
|
|
||||||
Map<String, Map<String, dynamic>> rmap = {
|
Map<String, Map<String, dynamic>> rmap = {
|
||||||
// Step 1
|
// Step 1
|
||||||
"LogDat": { "controller": TextEditingController(), "required": bool, },
|
"LogDat": {"controller": TextEditingController(), "required": bool},
|
||||||
"Rudel": { "controller": TextEditingController(), "required": bool, },
|
"Rudel": {"controller": TextEditingController(), "required": bool},
|
||||||
"Teilnehm": { "controller": TextEditingController(), "required": bool, },
|
"Teilnehm": {"controller": TextEditingController(), "required": bool},
|
||||||
"Jahr": { "controller": TextEditingController(), "required": bool, },
|
"Jahr": {"controller": TextEditingController(), "required": bool},
|
||||||
"Dauer": { "controller": TextEditingController(), "required": bool, },
|
"Dauer": {"controller": TextEditingController(), "required": bool},
|
||||||
"MHund": { "controller": TextEditingController(), "required": bool, },
|
"MHund": {"controller": TextEditingController(), "required": bool},
|
||||||
"MLeine": { "controller": TextEditingController(), "required": bool, },
|
"MLeine": {"controller": TextEditingController(), "required": bool},
|
||||||
"BLand": { "controller": TextEditingController(), "required": bool, },
|
"BLand": {"controller": TextEditingController(), "required": bool},
|
||||||
"Lkr": { "controller": TextEditingController(), "required": bool, },
|
"Lkr": {"controller": TextEditingController(), "required": bool},
|
||||||
"BeiOrt": { "controller": TextEditingController(), "required": bool, },
|
"BeiOrt": {"controller": TextEditingController(), "required": bool},
|
||||||
"BimaNr": { "controller": TextEditingController(), "required": bool, },
|
"BimaNr": {"controller": TextEditingController(), "required": bool},
|
||||||
"BimaName": { "controller": TextEditingController(), "required": bool, },
|
"BimaName": {"controller": TextEditingController(), "required": bool},
|
||||||
"BimaNutzer": { "controller": TextEditingController(), "required": bool, },
|
"BimaNutzer": {"controller": TextEditingController(), "required": bool},
|
||||||
"BimaAGV": { "controller": TextEditingController(), "required": bool, },
|
"BimaAGV": {"controller": TextEditingController(), "required": bool},
|
||||||
|
|
||||||
// Step 2
|
// Step 2
|
||||||
"Wetter": { "controller": TextEditingController(), "required": bool, },
|
"Wetter": {"controller": TextEditingController(), "required": bool},
|
||||||
"Temperat": { "controller": TextEditingController(), "required": bool, },
|
"Temperat": {"controller": TextEditingController(), "required": bool},
|
||||||
"RegenVor": { "controller": TextEditingController(), "required": bool, },
|
"RegenVor": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmAuto": { "controller": TextEditingController(), "required": bool, },
|
"KmAuto": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmFuss": { "controller": TextEditingController(), "required": bool, },
|
"KmFuss": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmRad": { "controller": TextEditingController(), "required": bool, },
|
"KmRad": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmTotal": { "controller": TextEditingController(), "required": bool, },
|
"KmTotal": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmAuProz": { "controller": TextEditingController(), "required": bool, },
|
"KmAuProz": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmFuProz": { "controller": TextEditingController(), "required": bool, },
|
"KmFuProz": {"controller": TextEditingController(), "required": bool},
|
||||||
"KmRaProz": { "controller": TextEditingController(), "required": bool, },
|
"KmRaProz": {"controller": TextEditingController(), "required": bool},
|
||||||
|
|
||||||
// Spur maybe own step?
|
// Spur maybe own step?
|
||||||
"SpGut": { "controller": TextEditingController(), "required": bool, },
|
"SpGut": {"controller": TextEditingController(), "required": bool},
|
||||||
"SpMittel": { "controller": TextEditingController(), "required": bool, },
|
"SpMittel": {"controller": TextEditingController(), "required": bool},
|
||||||
"SpSchlecht": { "controller": TextEditingController(), "required": bool, },
|
"SpSchlecht": {"controller": TextEditingController(), "required": bool},
|
||||||
"SpurFund": { "controller": TextEditingController(), "required": bool, },
|
"SpurFund": {"controller": TextEditingController(), "required": bool},
|
||||||
"SpurLang": { "controller": TextEditingController(), "required": bool, },
|
"SpurLang": {"controller": TextEditingController(), "required": bool},
|
||||||
"SpurTiere": { "controller": TextEditingController(), "required": bool, },
|
"SpurTiere": {"controller": TextEditingController(), "required": bool},
|
||||||
"SpSicher": { "controller": TextEditingController(), "required": bool, },
|
"SpSicher": {"controller": TextEditingController(), "required": bool},
|
||||||
"WelpenSp": { "controller": TextEditingController(), "required": bool, },
|
"WelpenSp": {"controller": TextEditingController(), "required": bool},
|
||||||
"WelpenAnz": { "controller": TextEditingController(), "required": bool, },
|
"WelpenAnz": {"controller": TextEditingController(), "required": bool},
|
||||||
"WpSicher": { "controller": TextEditingController(), "required": bool, },
|
"WpSicher": {"controller": TextEditingController(), "required": bool},
|
||||||
|
|
||||||
"LosungGes": { "controller": TextEditingController(), "required": bool, },
|
"LosungGes": {"controller": TextEditingController(), "required": bool},
|
||||||
"LosungAnz": { "controller": TextEditingController(), "required": bool, },
|
"LosungAnz": {"controller": TextEditingController(), "required": bool},
|
||||||
"LosungGen": { "controller": TextEditingController(), "required": bool, },
|
"LosungGen": {"controller": TextEditingController(), "required": bool},
|
||||||
"UrinAnz": { "controller": TextEditingController(), "required": bool, },
|
"UrinAnz": {"controller": TextEditingController(), "required": bool},
|
||||||
"UrinGen": { "controller": TextEditingController(), "required": bool, },
|
"UrinGen": {"controller": TextEditingController(), "required": bool},
|
||||||
"OestrAnz": { "controller": TextEditingController(), "required": bool, },
|
"OestrAnz": {"controller": TextEditingController(), "required": bool},
|
||||||
"OestrGen": { "controller": TextEditingController(), "required": bool, },
|
"OestrGen": {"controller": TextEditingController(), "required": bool},
|
||||||
"HaarAnz": { "controller": TextEditingController(), "required": bool, },
|
"HaarAnz": {"controller": TextEditingController(), "required": bool},
|
||||||
"HaarGen": { "controller": TextEditingController(), "required": bool, },
|
"HaarGen": {"controller": TextEditingController(), "required": bool},
|
||||||
"LosungKm": { "controller": TextEditingController(), "required": bool, },
|
"LosungKm": {"controller": TextEditingController(), "required": bool},
|
||||||
"GenetiKm": { "controller": TextEditingController(), "required": bool, },
|
"GenetiKm": {"controller": TextEditingController(), "required": bool},
|
||||||
"Hinweise": { "controller": TextEditingController(), "required": bool, },
|
"Hinweise": {"controller": TextEditingController(), "required": bool},
|
||||||
|
|
||||||
// Step 3
|
// Step 3
|
||||||
"Bemerk": { "controller": TextEditingController(), "required": bool, },
|
"Bemerk": {"controller": TextEditingController(), "required": bool},
|
||||||
"IntKomm": { "controller": TextEditingController(), "required": bool, },
|
"IntKomm": {"controller": TextEditingController(), "required": bool},
|
||||||
"FallNum": { "controller": TextEditingController(), "required": bool, },
|
"FallNum": {"controller": TextEditingController(), "required": bool},
|
||||||
};
|
};
|
||||||
|
|
||||||
Map<String, String> getFieldsText() {
|
Map<String, String> getFieldsText() {
|
||||||
Map<String, String> puff = {};
|
Map<String, String> puff = {};
|
||||||
@@ -99,303 +99,282 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
List<Step> getSteps() => [
|
List<Step> getSteps() => [
|
||||||
Step(
|
Step(
|
||||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||||
content: Column(
|
content: Column(
|
||||||
children: [
|
children: [
|
||||||
// ---------- Date
|
// ---------- Date
|
||||||
Datum(
|
Datum(
|
||||||
initDatum: DateTime.now(),
|
initDatum: DateTime.now(),
|
||||||
onDateChanged: (date) {
|
onDateChanged: (date) {
|
||||||
rmap["LogDat"]!["controller"]!.text = date.toString();
|
rmap["LogDat"]!["controller"]!.text = date.toString();
|
||||||
},
|
},
|
||||||
name: AppLocalizations.of(context)!.date,
|
name: AppLocalizations.of(context)!.date,
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Pack
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["Rudel"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.rudel,
|
|
||||||
dbName: "Rudel",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Participants
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["Teilnehm"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.teilnehmer,
|
|
||||||
dbName: "Teilnehm",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Duration
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["Dauer"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.dauer,
|
|
||||||
dbName: "Dauer",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Dog(leash)
|
|
||||||
HundULeine(onMHundChanged: (mHund, mLeine) {
|
|
||||||
rmap["MHund"]!["controller"]!.text = mHund;
|
|
||||||
rmap["MLeine"]!["controller"]!.text = mLeine;
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- State
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["BLand"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.bland,
|
|
||||||
dbName: "BLand",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Country
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["Lkr"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.lkr,
|
|
||||||
dbName: "Lkr",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- By State
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["BeiOrt"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.beiort,
|
|
||||||
dbName: "BeiOrt",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Bima number
|
|
||||||
const Divider(),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["BimaNr"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.bimaNr,
|
|
||||||
dbName: "BimaNr",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Bima name
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["BimaName"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.bimaName,
|
|
||||||
dbName: "BimaName",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Bima user
|
|
||||||
BimaNutzer(onBimaNutzerChanged: (value) {
|
|
||||||
setState(() {
|
|
||||||
rmap["BimaNutzer"]!["controller"]!.text = value;
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
const SizedBox(
|
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
// ---------- Bima AGV
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["BimaAGV"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.bimaAGV,
|
|
||||||
dbName: "BimaAGV",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)),
|
|
||||||
Step(
|
|
||||||
title: const Text("step2"),
|
|
||||||
content: Column(
|
|
||||||
children: [
|
|
||||||
// ---------- Weather
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["Wetter"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.wetter,
|
|
||||||
dbName: "Wetter",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
// ---------- Temperature
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["Temperat"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.temperatur,
|
|
||||||
dbName: "Temperat",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(height: 10),
|
|
||||||
// ---------- Last precipitation
|
|
||||||
LetzterNiederschlag(controller: rmap["RegenVor"]!["controller"]!),
|
|
||||||
const SizedBox(height: 20),
|
|
||||||
// ---------- Track conditions
|
|
||||||
StreckeUSpurbedingungen(
|
|
||||||
kmAutoController: rmap["KmAuto"]!["controller"]!,
|
|
||||||
kmFussController: rmap["KmFuss"]!["controller"]!,
|
|
||||||
kmRadController: rmap["KmRad"]!["controller"]!,
|
|
||||||
spGutController: rmap["SpGut"]!["controller"]!,
|
|
||||||
spMittelController: rmap["SpMittel"]!["controller"]!,
|
|
||||||
spSchlechtController: rmap["SpSchlecht"]!["controller"]!,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
const Divider(),
|
|
||||||
// ---------- Track found
|
|
||||||
SpurGefunden(
|
|
||||||
spurFund: rmap["SpurFund"]!["controller"]!,
|
|
||||||
spurLang: rmap["SpurLang"]!["controller"]!,
|
|
||||||
spurTiere: rmap["SpurTiere"]!["controller"]!,
|
|
||||||
spSicher: rmap["SpSicher"]!["controller"]!,
|
|
||||||
welpenSp: rmap["WelpenSp"]!["controller"]!,
|
|
||||||
welpenAnz: rmap["WelpenAnz"]!["controller"]!,
|
|
||||||
wpSicher: rmap["WpSicher"]!["controller"]!),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
// ---------- Counts
|
|
||||||
Anzahlen(
|
|
||||||
losungAnz: rmap["LosungAnz"]!["controller"]!,
|
|
||||||
losungGes: rmap["LosungGes"]!["controller"]!,
|
|
||||||
losungGen: rmap["LosungGen"]!["controller"]!,
|
|
||||||
urinAnz: rmap["UrinAnz"]!["controller"]!,
|
|
||||||
urinGen: rmap["UrinGen"]!["controller"]!,
|
|
||||||
oestrAnz: rmap["OestrAnz"]!["controller"]!,
|
|
||||||
oestrGen: rmap["OestrGen"]!["controller"]!,
|
|
||||||
haarAnz: rmap["HaarAnz"]!["controller"]!,
|
|
||||||
haarGen: rmap["HaarGen"]!["controller"]!,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
const Divider(),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
// ---------- Clues
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.bottomLeft,
|
|
||||||
child: Text(
|
|
||||||
AppLocalizations.of(context)!.hinweise,
|
|
||||||
style:
|
|
||||||
Theme.of(context).textTheme.titleMedium,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Hinweise(
|
|
||||||
hinweise: rmap["Hinweise"]!["controller"]!,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10),
|
||||||
Step(
|
// ---------- Pack
|
||||||
title: const Text("step3"),
|
VarTextField(
|
||||||
content: Column(
|
textController: rmap["Rudel"]!["controller"]!,
|
||||||
children: [
|
localization: AppLocalizations.of(context)!.rudel,
|
||||||
// ---------- Remarks
|
dbName: "Rudel",
|
||||||
VarTextField(
|
required: false,
|
||||||
textController: rmap["Bemerk"]!["controller"]!,
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
localization: AppLocalizations.of(context)!.sonstbemerkungen,
|
|
||||||
dbName: "Bemerk",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 20,
|
|
||||||
),
|
|
||||||
// ---------- Internal communication
|
|
||||||
VarTextField(
|
|
||||||
textController: rmap["IntKomm"]!["controller"]!,
|
|
||||||
localization: AppLocalizations.of(context)!.intkomm,
|
|
||||||
dbName: "IntKomm",
|
|
||||||
required: false,
|
|
||||||
dbDesignation: DatabasesEnum.excursion,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(height: 10),
|
||||||
];
|
// ---------- Participants
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["Teilnehm"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.teilnehmer,
|
||||||
|
dbName: "Teilnehm",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Duration
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["Dauer"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.dauer,
|
||||||
|
dbName: "Dauer",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Dog(leash)
|
||||||
|
HundULeine(
|
||||||
|
onMHundChanged: (mHund, mLeine) {
|
||||||
|
rmap["MHund"]!["controller"]!.text = mHund;
|
||||||
|
rmap["MLeine"]!["controller"]!.text = mLeine;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- State
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["BLand"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.bland,
|
||||||
|
dbName: "BLand",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Country
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["Lkr"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.lkr,
|
||||||
|
dbName: "Lkr",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- By State
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["BeiOrt"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.beiort,
|
||||||
|
dbName: "BeiOrt",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Bima number
|
||||||
|
const Divider(),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["BimaNr"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.bimaNr,
|
||||||
|
dbName: "BimaNr",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Bima name
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["BimaName"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.bimaName,
|
||||||
|
dbName: "BimaName",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Bima user
|
||||||
|
BimaNutzer(
|
||||||
|
onBimaNutzerChanged: (value) {
|
||||||
|
setState(() {
|
||||||
|
rmap["BimaNutzer"]!["controller"]!.text = value;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Bima AGV
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["BimaAGV"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.bimaAGV,
|
||||||
|
dbName: "BimaAGV",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Step(
|
||||||
|
title: const Text("step2"),
|
||||||
|
content: Column(
|
||||||
|
children: [
|
||||||
|
// ---------- Weather
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["Wetter"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.wetter,
|
||||||
|
dbName: "Wetter",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Temperature
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["Temperat"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.temperatur,
|
||||||
|
dbName: "Temperat",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 10),
|
||||||
|
// ---------- Last precipitation
|
||||||
|
LetzterNiederschlag(controller: rmap["RegenVor"]!["controller"]!),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
// ---------- Track conditions
|
||||||
|
StreckeUSpurbedingungen(
|
||||||
|
kmAutoController: rmap["KmAuto"]!["controller"]!,
|
||||||
|
kmFussController: rmap["KmFuss"]!["controller"]!,
|
||||||
|
kmRadController: rmap["KmRad"]!["controller"]!,
|
||||||
|
spGutController: rmap["SpGut"]!["controller"]!,
|
||||||
|
spMittelController: rmap["SpMittel"]!["controller"]!,
|
||||||
|
spSchlechtController: rmap["SpSchlecht"]!["controller"]!,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const Divider(),
|
||||||
|
// ---------- Track found
|
||||||
|
SpurGefunden(
|
||||||
|
spurFund: rmap["SpurFund"]!["controller"]!,
|
||||||
|
spurLang: rmap["SpurLang"]!["controller"]!,
|
||||||
|
spurTiere: rmap["SpurTiere"]!["controller"]!,
|
||||||
|
spSicher: rmap["SpSicher"]!["controller"]!,
|
||||||
|
welpenSp: rmap["WelpenSp"]!["controller"]!,
|
||||||
|
welpenAnz: rmap["WelpenAnz"]!["controller"]!,
|
||||||
|
wpSicher: rmap["WpSicher"]!["controller"]!,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
// ---------- Counts
|
||||||
|
Anzahlen(
|
||||||
|
losungAnz: rmap["LosungAnz"]!["controller"]!,
|
||||||
|
losungGes: rmap["LosungGes"]!["controller"]!,
|
||||||
|
losungGen: rmap["LosungGen"]!["controller"]!,
|
||||||
|
urinAnz: rmap["UrinAnz"]!["controller"]!,
|
||||||
|
urinGen: rmap["UrinGen"]!["controller"]!,
|
||||||
|
oestrAnz: rmap["OestrAnz"]!["controller"]!,
|
||||||
|
oestrGen: rmap["OestrGen"]!["controller"]!,
|
||||||
|
haarAnz: rmap["HaarAnz"]!["controller"]!,
|
||||||
|
haarGen: rmap["HaarGen"]!["controller"]!,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
const Divider(),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
// ---------- Clues
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.bottomLeft,
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context)!.hinweise,
|
||||||
|
style: Theme.of(context).textTheme.titleMedium,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Hinweise(hinweise: rmap["Hinweise"]!["controller"]!),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Step(
|
||||||
|
title: const Text("step3"),
|
||||||
|
content: Column(
|
||||||
|
children: [
|
||||||
|
// ---------- Remarks
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["Bemerk"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.sonstbemerkungen,
|
||||||
|
dbName: "Bemerk",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
// ---------- Internal communication
|
||||||
|
VarTextField(
|
||||||
|
textController: rmap["IntKomm"]!["controller"]!,
|
||||||
|
localization: AppLocalizations.of(context)!.intkomm,
|
||||||
|
dbName: "IntKomm",
|
||||||
|
required: false,
|
||||||
|
dbDesignation: DatabasesEnum.excursion,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
|
||||||
// Begin of widget tree
|
// Begin of widget tree
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(title: Text(AppLocalizations.of(context)!.excursion)),
|
||||||
title: Text(AppLocalizations.of(context)!.excursion),
|
body: PageTransitionSwitcher(
|
||||||
),
|
duration: const Duration(microseconds: 800),
|
||||||
body: PageTransitionSwitcher(
|
transitionBuilder: (
|
||||||
duration: const Duration(microseconds: 800),
|
Widget child,
|
||||||
transitionBuilder: (Widget child, Animation<double> animation,
|
Animation<double> animation,
|
||||||
Animation<double> secondaryAnimation) {
|
Animation<double> secondaryAnimation,
|
||||||
return SharedAxisTransition(
|
) {
|
||||||
animation: animation,
|
return SharedAxisTransition(
|
||||||
secondaryAnimation: secondaryAnimation,
|
animation: animation,
|
||||||
transitionType: SharedAxisTransitionType.vertical,
|
secondaryAnimation: secondaryAnimation,
|
||||||
child: child,
|
transitionType: SharedAxisTransitionType.vertical,
|
||||||
);
|
child: child,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Stepper(
|
||||||
|
key: ValueKey<int>(currentStep),
|
||||||
|
steps: getSteps(),
|
||||||
|
currentStep: currentStep,
|
||||||
|
onStepTapped: (value) {
|
||||||
|
setState(() {
|
||||||
|
currentStep = value;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
child: Stepper(
|
onStepContinue: () async {
|
||||||
key: ValueKey<int>(currentStep),
|
final isLastStep = currentStep == getSteps().length - 1;
|
||||||
steps: getSteps(),
|
|
||||||
currentStep: currentStep,
|
|
||||||
onStepTapped: (value) {
|
|
||||||
setState(() {
|
|
||||||
currentStep = value;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
onStepContinue: () async {
|
|
||||||
final isLastStep = currentStep == getSteps().length - 1;
|
|
||||||
|
|
||||||
if (!isLastStep) {
|
if (!isLastStep) {
|
||||||
setState(() {
|
setState(() {
|
||||||
currentStep += 1;
|
currentStep += 1;
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
bool empty = CheckRequired.checkRequired(rmap);
|
||||||
|
if (empty) {
|
||||||
|
await AddEntriesDialogHelper.showTemplateDialog(
|
||||||
|
context,
|
||||||
|
getFieldsText(),
|
||||||
|
false,
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
bool empty = CheckRequired.checkRequired(rmap);
|
await AddEntriesDialogHelper.showSaveOptionsDialog(
|
||||||
if (empty) {
|
context,
|
||||||
await DialogHelper.showTemplateDialog(context, getFieldsText(), false);
|
getFieldsText(),
|
||||||
} else {
|
false,
|
||||||
await DialogHelper.showSaveOptionsDialog(context, getFieldsText(), false);
|
);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
onStepCancel: () {
|
},
|
||||||
if (currentStep == 0) {
|
onStepCancel: () {
|
||||||
Navigator.pop(context);
|
if (currentStep == 0) {
|
||||||
} else {
|
Navigator.pop(context);
|
||||||
setState(() {
|
} else {
|
||||||
currentStep -= 1;
|
setState(() {
|
||||||
});
|
currentStep -= 1;
|
||||||
}
|
});
|
||||||
},
|
}
|
||||||
),
|
},
|
||||||
));
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
74
lib/screens/helper/view_entries_dialog_helper.dart
Normal file
74
lib/screens/helper/view_entries_dialog_helper.dart
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
|
import 'package:fforte/l10n/app_localizations.dart';
|
||||||
|
import 'package:fforte/screens/sharedMethods/delete_main_entries.dart';
|
||||||
|
import 'package:fforte/screens/sharedMethods/delete_templates.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ViewEntriesDialogHelper {
|
||||||
|
static void deleteAllMainEntries(
|
||||||
|
BuildContext context,
|
||||||
|
DatabasesEnum dbType,
|
||||||
|
) async {
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: <Widget>[
|
||||||
|
Text(AppLocalizations.of(context)!.deleteEverythingContent),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
DeleteMainEntries.deleteAll(dbType);
|
||||||
|
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.cancel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deleteAllTemplates(BuildContext context, DatabasesEnum dbType) async{
|
||||||
|
return showDialog(
|
||||||
|
context: context,
|
||||||
|
barrierDismissible: false,
|
||||||
|
builder: (BuildContext context) {
|
||||||
|
return AlertDialog(
|
||||||
|
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(children: <Widget>[
|
||||||
|
Text(AppLocalizations.of(context)!.deleteEverythingContent)
|
||||||
|
]),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
DeleteTemplates.deleteAll(dbType);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.deleteEverything)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.cancel))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
29
lib/screens/sharedMethods/delete_main_entries.dart
Normal file
29
lib/screens/sharedMethods/delete_main_entries.dart
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
|
import 'package:fforte/interfaces/i_db.dart';
|
||||||
|
import 'package:fforte/methods/excursion_db_helper.dart';
|
||||||
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
|
|
||||||
|
class DeleteMainEntries {
|
||||||
|
static void deleteAll(DatabasesEnum dbType) {
|
||||||
|
IDb? db;
|
||||||
|
|
||||||
|
if (dbType == DatabasesEnum.place) {
|
||||||
|
db = PlaceDBHelper();
|
||||||
|
} else if (dbType == DatabasesEnum.excursion) {
|
||||||
|
db = ExcursionDBHelper();
|
||||||
|
}
|
||||||
|
db!.deleteAllMainEntries();
|
||||||
|
}
|
||||||
|
|
||||||
|
static void deleteSingle(DatabasesEnum dbType, int id) {
|
||||||
|
IDb? db;
|
||||||
|
|
||||||
|
if (dbType == DatabasesEnum.place) {
|
||||||
|
db = PlaceDBHelper();
|
||||||
|
} else if (dbType == DatabasesEnum.excursion) {
|
||||||
|
db = ExcursionDBHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
db!.deleteMainEntryById(id.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
18
lib/screens/sharedMethods/delete_templates.dart
Normal file
18
lib/screens/sharedMethods/delete_templates.dart
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
|
import 'package:fforte/interfaces/i_db.dart';
|
||||||
|
import 'package:fforte/methods/excursion_db_helper.dart';
|
||||||
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
|
|
||||||
|
class DeleteTemplates {
|
||||||
|
static void deleteAll(DatabasesEnum dbType) {
|
||||||
|
IDb? db;
|
||||||
|
|
||||||
|
if (dbType == DatabasesEnum.place) {
|
||||||
|
db = PlaceDBHelper();
|
||||||
|
} else if (dbType == DatabasesEnum.excursion) {
|
||||||
|
db = ExcursionDBHelper();
|
||||||
|
}
|
||||||
|
|
||||||
|
db!.deleteAllMainEntries();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
|
import 'package:fforte/enums/databases.dart';
|
||||||
|
import 'package:fforte/interfaces/i_db.dart';
|
||||||
|
import 'package:fforte/methods/excursion_db_helper.dart';
|
||||||
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
import 'package:fforte/screens/addCam/add_cam_main.dart';
|
||||||
import 'package:fforte/methods/place_db_helper.dart';
|
import 'package:fforte/methods/place_db_helper.dart';
|
||||||
|
import 'package:fforte/screens/helper/view_entries_dialog_helper.dart';
|
||||||
|
import 'package:fforte/screens/sharedMethods/delete_main_entries.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:fforte/l10n/app_localizations.dart';
|
import 'package:fforte/l10n/app_localizations.dart';
|
||||||
import 'package:flutter_map/flutter_map.dart';
|
import 'package:flutter_map/flutter_map.dart';
|
||||||
@@ -8,7 +13,8 @@ import 'package:latlong2/latlong.dart';
|
|||||||
// * Site that shows all entries in the databases
|
// * Site that shows all entries in the databases
|
||||||
|
|
||||||
class ViewCams extends StatefulWidget {
|
class ViewCams extends StatefulWidget {
|
||||||
const ViewCams({super.key});
|
final DatabasesEnum dbType;
|
||||||
|
const ViewCams({super.key, required this.dbType});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ViewCams> createState() => _ViewCamsState();
|
State<ViewCams> createState() => _ViewCamsState();
|
||||||
@@ -16,91 +22,23 @@ class ViewCams extends StatefulWidget {
|
|||||||
|
|
||||||
class _ViewCamsState extends State<ViewCams> {
|
class _ViewCamsState extends State<ViewCams> {
|
||||||
// var declaration
|
// var declaration
|
||||||
late Future<List<Map<String, dynamic>>> place;
|
late Future<List<Map<String, dynamic>>> mainEntries;
|
||||||
late Future<List<Map<String, dynamic>>> templates;
|
late Future<List<Map<String, dynamic>>> templates;
|
||||||
late List<Marker> markers;
|
late List<Marker> markers;
|
||||||
|
|
||||||
// loads the entries
|
// loads the entries
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
|
IDb? db;
|
||||||
super.initState();
|
super.initState();
|
||||||
place = PlaceDBHelper().getAllMainEntries();
|
if (widget.dbType == DatabasesEnum.place) {
|
||||||
templates = PlaceDBHelper().getAllTemplates();
|
db = PlaceDBHelper();
|
||||||
}
|
} else if (widget.dbType == DatabasesEnum.excursion) {
|
||||||
|
db = ExcursionDBHelper();
|
||||||
|
}
|
||||||
|
|
||||||
// functions to delete all entries LOCALLY
|
mainEntries = db!.getAllMainEntries();
|
||||||
void delAllPlaces() async {
|
templates = db.getAllTemplates();
|
||||||
return showDialog(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: ListBody(children: <Widget>[
|
|
||||||
Text(AppLocalizations.of(context)!.deleteEverythingContent)
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
var placeDB = PlaceDBHelper();
|
|
||||||
placeDB.deleteAllMainEntries();
|
|
||||||
setState(() {
|
|
||||||
place = PlaceDBHelper().getAllMainEntries();
|
|
||||||
});
|
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text(AppLocalizations.of(context)!.deleteEverything)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text(AppLocalizations.of(context)!.cancel))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void delSinglePlace(int id) async {
|
|
||||||
PlaceDBHelper().deleteMainEntryById(id.toString());
|
|
||||||
setState(() {
|
|
||||||
place = PlaceDBHelper().getAllMainEntries();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void delAllTemplates() async {
|
|
||||||
return showDialog(
|
|
||||||
context: context,
|
|
||||||
barrierDismissible: false,
|
|
||||||
builder: (BuildContext context) {
|
|
||||||
return AlertDialog(
|
|
||||||
title: Text(AppLocalizations.of(context)!.deleteEverything),
|
|
||||||
content: SingleChildScrollView(
|
|
||||||
child: ListBody(children: <Widget>[
|
|
||||||
Text(AppLocalizations.of(context)!.deleteEverythingContent)
|
|
||||||
]),
|
|
||||||
),
|
|
||||||
actions: <Widget>[
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
var placeDB = PlaceDBHelper();
|
|
||||||
placeDB.deleteAllTemplates();
|
|
||||||
setState(() {
|
|
||||||
templates = PlaceDBHelper().getAllTemplates();
|
|
||||||
});
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text(AppLocalizations.of(context)!.deleteEverything)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text(AppLocalizations.of(context)!.cancel))
|
|
||||||
],
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The widet tree with taps to differentiate between templates and finished entries
|
// The widet tree with taps to differentiate between templates and finished entries
|
||||||
@@ -109,41 +47,43 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
return DefaultTabController(
|
return DefaultTabController(
|
||||||
length: 3,
|
length: 3,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
bottom: TabBar(tabs: [
|
bottom: TabBar(
|
||||||
Tab(text: AppLocalizations.of(context)!.completed),
|
tabs: [
|
||||||
Tab(
|
Tab(text: AppLocalizations.of(context)!.completed),
|
||||||
text: AppLocalizations.of(context)!.uncompleted,
|
Tab(text: AppLocalizations.of(context)!.uncompleted),
|
||||||
),
|
Tab(text: AppLocalizations.of(context)!.map),
|
||||||
Tab(
|
],
|
||||||
text: AppLocalizations.of(context)!.map,
|
),
|
||||||
),
|
title: Text(AppLocalizations.of(context)!.viewplacesappbar),
|
||||||
]),
|
),
|
||||||
title: Text(AppLocalizations.of(context)!.viewplacesappbar)),
|
body: TabBarView(
|
||||||
body: TabBarView(
|
children: [
|
||||||
children: [
|
Tab(
|
||||||
FutureBuilder<List<Map<String, dynamic>>>(
|
child: FutureBuilder<List<Map<String, dynamic>>>(
|
||||||
future: place,
|
future: mainEntries,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return const CircularProgressIndicator();
|
return const CircularProgressIndicator();
|
||||||
} else if (snapshot.hasError) {
|
} else if (snapshot.hasError) {
|
||||||
return Text('Error: ${snapshot.error}');
|
return Text('Error: ${snapshot.error}');
|
||||||
} else {
|
} else {
|
||||||
List<Map<String, dynamic>> placeList =
|
List<Map<String, dynamic>> placeList = List.of(
|
||||||
List.of(snapshot.data!);
|
snapshot.data!,
|
||||||
|
);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.delete),
|
child: const Icon(Icons.delete),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
delAllPlaces();
|
ViewEntriesDialogHelper.deleteAllMainEntries(
|
||||||
|
context,
|
||||||
|
widget.dbType,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
body: Column(
|
body: Column(
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(
|
const SizedBox(height: 10),
|
||||||
height: 10,
|
|
||||||
),
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
@@ -171,119 +111,145 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(height: 15),
|
||||||
height: 15,
|
|
||||||
),
|
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: placeList.length,
|
itemCount: placeList.length,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
Map<String, dynamic> place =
|
Map<String, dynamic> place =
|
||||||
snapshot.data![index];
|
snapshot.data![index];
|
||||||
return Slidable(
|
return Slidable(
|
||||||
startActionPane: ActionPane(
|
startActionPane: ActionPane(
|
||||||
motion: const ScrollMotion(),
|
motion: const ScrollMotion(),
|
||||||
children: [
|
children: [
|
||||||
SlidableAction(
|
SlidableAction(
|
||||||
onPressed: (context) {
|
onPressed: (context) {
|
||||||
delSinglePlace(
|
DeleteMainEntries.deleteSingle(
|
||||||
place['ID'.toString()]);
|
widget.dbType,
|
||||||
|
place['ID'.toString()],
|
||||||
|
);
|
||||||
},
|
},
|
||||||
backgroundColor: Colors.red,
|
backgroundColor: Colors.red,
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
icon: Icons.delete,
|
icon: Icons.delete,
|
||||||
label: AppLocalizations.of(context)!
|
label:
|
||||||
.justdelete,
|
AppLocalizations.of(
|
||||||
)
|
context,
|
||||||
]),
|
)!.justdelete,
|
||||||
child: ListTile(
|
),
|
||||||
title: Text('Standort ${index + 1}'),
|
],
|
||||||
subtitle: Text(
|
|
||||||
'ID: ${place['ID']} DATUM: ${place['Datum']}'),
|
|
||||||
trailing: Checkbox(
|
|
||||||
value: place['Sent'] == 0 ? false : true,
|
|
||||||
onChanged: null,
|
|
||||||
),
|
),
|
||||||
onTap: () async {
|
child: ListTile(
|
||||||
|
title: Text('Standort ${index + 1}'),
|
||||||
|
subtitle: Text(
|
||||||
|
'ID: ${place['ID']} DATUM: ${place['Datum']}',
|
||||||
|
),
|
||||||
|
trailing: Checkbox(
|
||||||
|
value: place['Sent'] == 0 ? false : true,
|
||||||
|
onChanged: null,
|
||||||
|
),
|
||||||
|
onTap: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => AddCamMain(
|
builder:
|
||||||
isSent: place['Sent'] == 1 ? true : false,
|
(context) => AddCamMain(
|
||||||
isFinished: true,
|
isSent:
|
||||||
existingData: place,
|
place['Sent'] == 1
|
||||||
)));
|
? true
|
||||||
},
|
: false,
|
||||||
),
|
isFinished: true,
|
||||||
);
|
existingData: place,
|
||||||
},
|
),
|
||||||
))
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
FutureBuilder<List<Map<String, dynamic>>>(
|
),
|
||||||
future: templates,
|
Tab(
|
||||||
builder: (context, snapshot) {
|
child: FutureBuilder<List<Map<String, dynamic>>>(
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
future: templates,
|
||||||
return const CircularProgressIndicator();
|
builder: (context, snapshot) {
|
||||||
} else if (snapshot.hasError) {
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
return Text('Error: ${snapshot.error}');
|
return const CircularProgressIndicator();
|
||||||
} else {
|
} else if (snapshot.hasError) {
|
||||||
return Scaffold(
|
return Text('Error: ${snapshot.error}');
|
||||||
floatingActionButton: FloatingActionButton(
|
} else {
|
||||||
child: const Icon(Icons.delete),
|
return Scaffold(
|
||||||
onPressed: () {
|
floatingActionButton: FloatingActionButton(
|
||||||
delAllTemplates();
|
child: const Icon(Icons.delete),
|
||||||
},
|
onPressed: () {
|
||||||
),
|
ViewEntriesDialogHelper.deleteAllTemplates(
|
||||||
body: Column(
|
context,
|
||||||
children: [
|
widget.dbType,
|
||||||
Expanded(
|
);
|
||||||
child: ListView.builder(
|
},
|
||||||
itemCount: snapshot.data!.length,
|
),
|
||||||
itemBuilder: (context, index) {
|
body: Column(
|
||||||
Map<String, dynamic> templates =
|
children: [
|
||||||
snapshot.data![index];
|
Expanded(
|
||||||
return ListTile(
|
child: ListView.builder(
|
||||||
onTap: () {
|
itemCount: snapshot.data!.length,
|
||||||
Navigator.push(
|
itemBuilder: (context, index) {
|
||||||
context,
|
Map<String, dynamic> templates =
|
||||||
MaterialPageRoute(
|
snapshot.data![index];
|
||||||
builder: (context) =>
|
return ListTile(
|
||||||
AddCamMain(
|
onTap: () {
|
||||||
isTemplate: true,
|
Navigator.push(
|
||||||
isFinished: false,
|
context,
|
||||||
existingData: templates,
|
MaterialPageRoute(
|
||||||
)));
|
builder:
|
||||||
},
|
(context) => AddCamMain(
|
||||||
title: Text('Place ${index + 1}'),
|
isTemplate: true,
|
||||||
subtitle: Text(
|
isFinished: false,
|
||||||
'ID: ${templates['CID']} DATUM: ${templates['Datum']} RUDEL: ${templates['Rudel']} STATUS: ${templates['Status']}'),
|
existingData: templates,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}),
|
},
|
||||||
)
|
title: Text('Place ${index + 1}'),
|
||||||
],
|
subtitle: Text(
|
||||||
),
|
'ID: ${templates['CID']} DATUM: ${templates['Datum']} RUDEL: ${templates['Rudel']} STATUS: ${templates['Status']}',
|
||||||
);
|
),
|
||||||
}
|
);
|
||||||
}),
|
},
|
||||||
FutureBuilder(
|
),
|
||||||
future: place,
|
),
|
||||||
builder: (context, snapshot) {
|
],
|
||||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
),
|
||||||
return const CircularProgressIndicator();
|
);
|
||||||
} else if (snapshot.hasError) {
|
}
|
||||||
return Text("Error ${snapshot.error}");
|
},
|
||||||
} else {
|
),
|
||||||
markers = snapshot.data!.map((e) {
|
),
|
||||||
return Marker(
|
Tab(
|
||||||
|
child: FutureBuilder(
|
||||||
|
future: mainEntries,
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||||
|
return const CircularProgressIndicator();
|
||||||
|
} else if (snapshot.hasError) {
|
||||||
|
return Text("Error ${snapshot.error}");
|
||||||
|
} else {
|
||||||
|
markers =
|
||||||
|
snapshot.data!.map((e) {
|
||||||
|
return Marker(
|
||||||
width: 80.0,
|
width: 80.0,
|
||||||
height: 80.0,
|
height: 80.0,
|
||||||
point: LatLng(double.parse(e['DECLAT'].toString()),
|
point: LatLng(
|
||||||
double.parse(e['DECLNG'].toString())),
|
double.parse(e['DECLAT'].toString()),
|
||||||
|
double.parse(e['DECLNG'].toString()),
|
||||||
|
),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
const Icon(
|
const Icon(
|
||||||
@@ -293,31 +259,40 @@ class _ViewCamsState extends State<ViewCams> {
|
|||||||
Text(
|
Text(
|
||||||
"ID: ${e['ID'].toString()}",
|
"ID: ${e['ID'].toString()}",
|
||||||
style: const TextStyle(color: Colors.black),
|
style: const TextStyle(color: Colors.black),
|
||||||
)
|
),
|
||||||
],
|
],
|
||||||
));
|
|
||||||
}).toList();
|
|
||||||
return FlutterMap(
|
|
||||||
options: MapOptions(
|
|
||||||
initialCenter: markers.isEmpty
|
|
||||||
? const LatLng(50, 10)
|
|
||||||
: markers.first.point,
|
|
||||||
interactionOptions: const InteractionOptions(
|
|
||||||
flags: InteractiveFlag.pinchZoom |
|
|
||||||
InteractiveFlag.drag |
|
|
||||||
InteractiveFlag.pinchMove)),
|
|
||||||
children: [
|
|
||||||
TileLayer(
|
|
||||||
urlTemplate:
|
|
||||||
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
|
||||||
userAgentPackageName: 'com.example.app',
|
|
||||||
),
|
),
|
||||||
MarkerLayer(markers: markers)
|
);
|
||||||
]);
|
}).toList();
|
||||||
}
|
return FlutterMap(
|
||||||
})
|
options: MapOptions(
|
||||||
],
|
initialCenter:
|
||||||
)),
|
markers.isEmpty
|
||||||
|
? const LatLng(50, 10)
|
||||||
|
: markers.first.point,
|
||||||
|
interactionOptions: const InteractionOptions(
|
||||||
|
flags:
|
||||||
|
InteractiveFlag.pinchZoom |
|
||||||
|
InteractiveFlag.drag |
|
||||||
|
InteractiveFlag.pinchMove,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
children: [
|
||||||
|
TileLayer(
|
||||||
|
urlTemplate:
|
||||||
|
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
|
||||||
|
userAgentPackageName: 'com.example.app',
|
||||||
|
),
|
||||||
|
MarkerLayer(markers: markers),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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