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/addCam/add_cam_main.dart';
|
||||
import 'package:fforte/screens/intro_screen.dart';
|
||||
@@ -46,7 +47,7 @@ class MyApp extends StatelessWidget {
|
||||
routes: {
|
||||
'/home': (context) => const HomePage(),
|
||||
'/addCamMain': (context) => const AddCamMain(),
|
||||
'/viewCams': (context) => const ViewCams(),
|
||||
'/viewCams': (context) => const ViewCams(dbType: DatabasesEnum.place,),
|
||||
'/introScreen': (context) => const IntroScreen(),
|
||||
'/settings': (context) => const Settings(),
|
||||
'/excursion': (context) => const ExcursionMain(),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
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/addCam/exceptions/location_disabled_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);
|
||||
|
||||
if (empty == true) {
|
||||
DialogHelper.showTemplateDialog(context, getFieldsText(),
|
||||
AddEntriesDialogHelper.showTemplateDialog(context, getFieldsText(),
|
||||
widget.existingData?.isNotEmpty ?? false);
|
||||
return;
|
||||
} else if (empty == false) {
|
||||
await DialogHelper.showSaveOptionsDialog(
|
||||
await AddEntriesDialogHelper.showSaveOptionsDialog(
|
||||
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/spur_gefunden.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/sharedWidgets/datum.dart';
|
||||
import 'package:fforte/screens/sharedWidgets/var_text_field.dart';
|
||||
@@ -24,65 +24,65 @@ class ExcursionMain extends StatefulWidget {
|
||||
class _ExcursionMainState extends State<ExcursionMain> {
|
||||
// all TextEditingController because its easier
|
||||
|
||||
Map<String, Map<String, dynamic>> rmap = {
|
||||
// Step 1
|
||||
"LogDat": { "controller": TextEditingController(), "required": bool, },
|
||||
"Rudel": { "controller": TextEditingController(), "required": bool, },
|
||||
"Teilnehm": { "controller": TextEditingController(), "required": bool, },
|
||||
"Jahr": { "controller": TextEditingController(), "required": bool, },
|
||||
"Dauer": { "controller": TextEditingController(), "required": bool, },
|
||||
"MHund": { "controller": TextEditingController(), "required": bool, },
|
||||
"MLeine": { "controller": TextEditingController(), "required": bool, },
|
||||
"BLand": { "controller": TextEditingController(), "required": bool, },
|
||||
"Lkr": { "controller": TextEditingController(), "required": bool, },
|
||||
"BeiOrt": { "controller": TextEditingController(), "required": bool, },
|
||||
"BimaNr": { "controller": TextEditingController(), "required": bool, },
|
||||
"BimaName": { "controller": TextEditingController(), "required": bool, },
|
||||
"BimaNutzer": { "controller": TextEditingController(), "required": bool, },
|
||||
"BimaAGV": { "controller": TextEditingController(), "required": bool, },
|
||||
Map<String, Map<String, dynamic>> rmap = {
|
||||
// Step 1
|
||||
"LogDat": {"controller": TextEditingController(), "required": bool},
|
||||
"Rudel": {"controller": TextEditingController(), "required": bool},
|
||||
"Teilnehm": {"controller": TextEditingController(), "required": bool},
|
||||
"Jahr": {"controller": TextEditingController(), "required": bool},
|
||||
"Dauer": {"controller": TextEditingController(), "required": bool},
|
||||
"MHund": {"controller": TextEditingController(), "required": bool},
|
||||
"MLeine": {"controller": TextEditingController(), "required": bool},
|
||||
"BLand": {"controller": TextEditingController(), "required": bool},
|
||||
"Lkr": {"controller": TextEditingController(), "required": bool},
|
||||
"BeiOrt": {"controller": TextEditingController(), "required": bool},
|
||||
"BimaNr": {"controller": TextEditingController(), "required": bool},
|
||||
"BimaName": {"controller": TextEditingController(), "required": bool},
|
||||
"BimaNutzer": {"controller": TextEditingController(), "required": bool},
|
||||
"BimaAGV": {"controller": TextEditingController(), "required": bool},
|
||||
|
||||
// Step 2
|
||||
"Wetter": { "controller": TextEditingController(), "required": bool, },
|
||||
"Temperat": { "controller": TextEditingController(), "required": bool, },
|
||||
"RegenVor": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmAuto": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmFuss": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmRad": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmTotal": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmAuProz": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmFuProz": { "controller": TextEditingController(), "required": bool, },
|
||||
"KmRaProz": { "controller": TextEditingController(), "required": bool, },
|
||||
// Step 2
|
||||
"Wetter": {"controller": TextEditingController(), "required": bool},
|
||||
"Temperat": {"controller": TextEditingController(), "required": bool},
|
||||
"RegenVor": {"controller": TextEditingController(), "required": bool},
|
||||
"KmAuto": {"controller": TextEditingController(), "required": bool},
|
||||
"KmFuss": {"controller": TextEditingController(), "required": bool},
|
||||
"KmRad": {"controller": TextEditingController(), "required": bool},
|
||||
"KmTotal": {"controller": TextEditingController(), "required": bool},
|
||||
"KmAuProz": {"controller": TextEditingController(), "required": bool},
|
||||
"KmFuProz": {"controller": TextEditingController(), "required": bool},
|
||||
"KmRaProz": {"controller": TextEditingController(), "required": bool},
|
||||
|
||||
// Spur maybe own step?
|
||||
"SpGut": { "controller": TextEditingController(), "required": bool, },
|
||||
"SpMittel": { "controller": TextEditingController(), "required": bool, },
|
||||
"SpSchlecht": { "controller": TextEditingController(), "required": bool, },
|
||||
"SpurFund": { "controller": TextEditingController(), "required": bool, },
|
||||
"SpurLang": { "controller": TextEditingController(), "required": bool, },
|
||||
"SpurTiere": { "controller": TextEditingController(), "required": bool, },
|
||||
"SpSicher": { "controller": TextEditingController(), "required": bool, },
|
||||
"WelpenSp": { "controller": TextEditingController(), "required": bool, },
|
||||
"WelpenAnz": { "controller": TextEditingController(), "required": bool, },
|
||||
"WpSicher": { "controller": TextEditingController(), "required": bool, },
|
||||
// Spur maybe own step?
|
||||
"SpGut": {"controller": TextEditingController(), "required": bool},
|
||||
"SpMittel": {"controller": TextEditingController(), "required": bool},
|
||||
"SpSchlecht": {"controller": TextEditingController(), "required": bool},
|
||||
"SpurFund": {"controller": TextEditingController(), "required": bool},
|
||||
"SpurLang": {"controller": TextEditingController(), "required": bool},
|
||||
"SpurTiere": {"controller": TextEditingController(), "required": bool},
|
||||
"SpSicher": {"controller": TextEditingController(), "required": bool},
|
||||
"WelpenSp": {"controller": TextEditingController(), "required": bool},
|
||||
"WelpenAnz": {"controller": TextEditingController(), "required": bool},
|
||||
"WpSicher": {"controller": TextEditingController(), "required": bool},
|
||||
|
||||
"LosungGes": { "controller": TextEditingController(), "required": bool, },
|
||||
"LosungAnz": { "controller": TextEditingController(), "required": bool, },
|
||||
"LosungGen": { "controller": TextEditingController(), "required": bool, },
|
||||
"UrinAnz": { "controller": TextEditingController(), "required": bool, },
|
||||
"UrinGen": { "controller": TextEditingController(), "required": bool, },
|
||||
"OestrAnz": { "controller": TextEditingController(), "required": bool, },
|
||||
"OestrGen": { "controller": TextEditingController(), "required": bool, },
|
||||
"HaarAnz": { "controller": TextEditingController(), "required": bool, },
|
||||
"HaarGen": { "controller": TextEditingController(), "required": bool, },
|
||||
"LosungKm": { "controller": TextEditingController(), "required": bool, },
|
||||
"GenetiKm": { "controller": TextEditingController(), "required": bool, },
|
||||
"Hinweise": { "controller": TextEditingController(), "required": bool, },
|
||||
"LosungGes": {"controller": TextEditingController(), "required": bool},
|
||||
"LosungAnz": {"controller": TextEditingController(), "required": bool},
|
||||
"LosungGen": {"controller": TextEditingController(), "required": bool},
|
||||
"UrinAnz": {"controller": TextEditingController(), "required": bool},
|
||||
"UrinGen": {"controller": TextEditingController(), "required": bool},
|
||||
"OestrAnz": {"controller": TextEditingController(), "required": bool},
|
||||
"OestrGen": {"controller": TextEditingController(), "required": bool},
|
||||
"HaarAnz": {"controller": TextEditingController(), "required": bool},
|
||||
"HaarGen": {"controller": TextEditingController(), "required": bool},
|
||||
"LosungKm": {"controller": TextEditingController(), "required": bool},
|
||||
"GenetiKm": {"controller": TextEditingController(), "required": bool},
|
||||
"Hinweise": {"controller": TextEditingController(), "required": bool},
|
||||
|
||||
// Step 3
|
||||
"Bemerk": { "controller": TextEditingController(), "required": bool, },
|
||||
"IntKomm": { "controller": TextEditingController(), "required": bool, },
|
||||
"FallNum": { "controller": TextEditingController(), "required": bool, },
|
||||
};
|
||||
// Step 3
|
||||
"Bemerk": {"controller": TextEditingController(), "required": bool},
|
||||
"IntKomm": {"controller": TextEditingController(), "required": bool},
|
||||
"FallNum": {"controller": TextEditingController(), "required": bool},
|
||||
};
|
||||
|
||||
Map<String, String> getFieldsText() {
|
||||
Map<String, String> puff = {};
|
||||
@@ -99,303 +99,282 @@ class _ExcursionMainState extends State<ExcursionMain> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<Step> getSteps() => [
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
// ---------- Date
|
||||
Datum(
|
||||
initDatum: DateTime.now(),
|
||||
onDateChanged: (date) {
|
||||
rmap["LogDat"]!["controller"]!.text = date.toString();
|
||||
},
|
||||
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"]!,
|
||||
),
|
||||
],
|
||||
Step(
|
||||
title: Text(AppLocalizations.of(context)!.dateandtime),
|
||||
content: Column(
|
||||
children: [
|
||||
// ---------- Date
|
||||
Datum(
|
||||
initDatum: DateTime.now(),
|
||||
onDateChanged: (date) {
|
||||
rmap["LogDat"]!["controller"]!.text = date.toString();
|
||||
},
|
||||
name: AppLocalizations.of(context)!.date,
|
||||
),
|
||||
),
|
||||
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,
|
||||
),
|
||||
],
|
||||
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"]!),
|
||||
],
|
||||
),
|
||||
),
|
||||
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
|
||||
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: () async {
|
||||
final isLastStep = currentStep == getSteps().length - 1;
|
||||
onStepContinue: () async {
|
||||
final isLastStep = currentStep == getSteps().length - 1;
|
||||
|
||||
if (!isLastStep) {
|
||||
setState(() {
|
||||
currentStep += 1;
|
||||
});
|
||||
if (!isLastStep) {
|
||||
setState(() {
|
||||
currentStep += 1;
|
||||
});
|
||||
} else {
|
||||
bool empty = CheckRequired.checkRequired(rmap);
|
||||
if (empty) {
|
||||
await AddEntriesDialogHelper.showTemplateDialog(
|
||||
context,
|
||||
getFieldsText(),
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
bool empty = CheckRequired.checkRequired(rmap);
|
||||
if (empty) {
|
||||
await DialogHelper.showTemplateDialog(context, getFieldsText(), false);
|
||||
} else {
|
||||
await DialogHelper.showSaveOptionsDialog(context, getFieldsText(), false);
|
||||
}
|
||||
await AddEntriesDialogHelper.showSaveOptionsDialog(
|
||||
context,
|
||||
getFieldsText(),
|
||||
false,
|
||||
);
|
||||
}
|
||||
},
|
||||
onStepCancel: () {
|
||||
if (currentStep == 0) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
setState(() {
|
||||
currentStep -= 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
));
|
||||
}
|
||||
},
|
||||
onStepCancel: () {
|
||||
if (currentStep == 0) {
|
||||
Navigator.pop(context);
|
||||
} else {
|
||||
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/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:fforte/l10n/app_localizations.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
|
||||
|
||||
class ViewCams extends StatefulWidget {
|
||||
const ViewCams({super.key});
|
||||
final DatabasesEnum dbType;
|
||||
const ViewCams({super.key, required this.dbType});
|
||||
|
||||
@override
|
||||
State<ViewCams> createState() => _ViewCamsState();
|
||||
@@ -16,91 +22,23 @@ class ViewCams extends StatefulWidget {
|
||||
|
||||
class _ViewCamsState extends State<ViewCams> {
|
||||
// var declaration
|
||||
late Future<List<Map<String, dynamic>>> place;
|
||||
late Future<List<Map<String, dynamic>>> mainEntries;
|
||||
late Future<List<Map<String, dynamic>>> templates;
|
||||
late List<Marker> markers;
|
||||
|
||||
// loads the entries
|
||||
@override
|
||||
void initState() {
|
||||
IDb? db;
|
||||
super.initState();
|
||||
place = PlaceDBHelper().getAllMainEntries();
|
||||
templates = PlaceDBHelper().getAllTemplates();
|
||||
}
|
||||
if (widget.dbType == DatabasesEnum.place) {
|
||||
db = PlaceDBHelper();
|
||||
} else if (widget.dbType == DatabasesEnum.excursion) {
|
||||
db = ExcursionDBHelper();
|
||||
}
|
||||
|
||||
// functions to delete all entries LOCALLY
|
||||
void delAllPlaces() 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.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))
|
||||
],
|
||||
);
|
||||
});
|
||||
mainEntries = db!.getAllMainEntries();
|
||||
templates = db.getAllTemplates();
|
||||
}
|
||||
|
||||
// The widet tree with taps to differentiate between templates and finished entries
|
||||
@@ -109,41 +47,43 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
return DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
bottom: TabBar(tabs: [
|
||||
Tab(text: AppLocalizations.of(context)!.completed),
|
||||
Tab(
|
||||
text: AppLocalizations.of(context)!.uncompleted,
|
||||
),
|
||||
Tab(
|
||||
text: AppLocalizations.of(context)!.map,
|
||||
),
|
||||
]),
|
||||
title: Text(AppLocalizations.of(context)!.viewplacesappbar)),
|
||||
body: TabBarView(
|
||||
children: [
|
||||
FutureBuilder<List<Map<String, dynamic>>>(
|
||||
future: place,
|
||||
appBar: AppBar(
|
||||
bottom: TabBar(
|
||||
tabs: [
|
||||
Tab(text: AppLocalizations.of(context)!.completed),
|
||||
Tab(text: AppLocalizations.of(context)!.uncompleted),
|
||||
Tab(text: AppLocalizations.of(context)!.map),
|
||||
],
|
||||
),
|
||||
title: Text(AppLocalizations.of(context)!.viewplacesappbar),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [
|
||||
Tab(
|
||||
child: FutureBuilder<List<Map<String, dynamic>>>(
|
||||
future: mainEntries,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
} else if (snapshot.hasError) {
|
||||
return Text('Error: ${snapshot.error}');
|
||||
} else {
|
||||
List<Map<String, dynamic>> placeList =
|
||||
List.of(snapshot.data!);
|
||||
List<Map<String, dynamic>> placeList = List.of(
|
||||
snapshot.data!,
|
||||
);
|
||||
return Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.delete),
|
||||
onPressed: () {
|
||||
delAllPlaces();
|
||||
ViewEntriesDialogHelper.deleteAllMainEntries(
|
||||
context,
|
||||
widget.dbType,
|
||||
);
|
||||
},
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
@@ -171,119 +111,145 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const SizedBox(height: 15),
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: placeList.length,
|
||||
itemBuilder: (context, index) {
|
||||
Map<String, dynamic> place =
|
||||
snapshot.data![index];
|
||||
return Slidable(
|
||||
startActionPane: ActionPane(
|
||||
child: ListView.builder(
|
||||
itemCount: placeList.length,
|
||||
itemBuilder: (context, index) {
|
||||
Map<String, dynamic> place =
|
||||
snapshot.data![index];
|
||||
return Slidable(
|
||||
startActionPane: ActionPane(
|
||||
motion: const ScrollMotion(),
|
||||
children: [
|
||||
SlidableAction(
|
||||
onPressed: (context) {
|
||||
delSinglePlace(
|
||||
place['ID'.toString()]);
|
||||
DeleteMainEntries.deleteSingle(
|
||||
widget.dbType,
|
||||
place['ID'.toString()],
|
||||
);
|
||||
},
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
icon: Icons.delete,
|
||||
label: 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,
|
||||
label:
|
||||
AppLocalizations.of(
|
||||
context,
|
||||
)!.justdelete,
|
||||
),
|
||||
],
|
||||
),
|
||||
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(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => AddCamMain(
|
||||
isSent: place['Sent'] == 1 ? true : false,
|
||||
isFinished: true,
|
||||
existingData: place,
|
||||
)));
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
))
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => AddCamMain(
|
||||
isSent:
|
||||
place['Sent'] == 1
|
||||
? true
|
||||
: false,
|
||||
isFinished: true,
|
||||
existingData: place,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
FutureBuilder<List<Map<String, dynamic>>>(
|
||||
future: templates,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
} else if (snapshot.hasError) {
|
||||
return Text('Error: ${snapshot.error}');
|
||||
} else {
|
||||
return Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.delete),
|
||||
onPressed: () {
|
||||
delAllTemplates();
|
||||
},
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: snapshot.data!.length,
|
||||
itemBuilder: (context, index) {
|
||||
Map<String, dynamic> templates =
|
||||
snapshot.data![index];
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) =>
|
||||
AddCamMain(
|
||||
isTemplate: true,
|
||||
isFinished: false,
|
||||
existingData: templates,
|
||||
)));
|
||||
},
|
||||
title: Text('Place ${index + 1}'),
|
||||
subtitle: Text(
|
||||
'ID: ${templates['CID']} DATUM: ${templates['Datum']} RUDEL: ${templates['Rudel']} STATUS: ${templates['Status']}'),
|
||||
),
|
||||
Tab(
|
||||
child: FutureBuilder<List<Map<String, dynamic>>>(
|
||||
future: templates,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
return const CircularProgressIndicator();
|
||||
} else if (snapshot.hasError) {
|
||||
return Text('Error: ${snapshot.error}');
|
||||
} else {
|
||||
return Scaffold(
|
||||
floatingActionButton: FloatingActionButton(
|
||||
child: const Icon(Icons.delete),
|
||||
onPressed: () {
|
||||
ViewEntriesDialogHelper.deleteAllTemplates(
|
||||
context,
|
||||
widget.dbType,
|
||||
);
|
||||
},
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView.builder(
|
||||
itemCount: snapshot.data!.length,
|
||||
itemBuilder: (context, index) {
|
||||
Map<String, dynamic> templates =
|
||||
snapshot.data![index];
|
||||
return ListTile(
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) => AddCamMain(
|
||||
isTemplate: true,
|
||||
isFinished: false,
|
||||
existingData: templates,
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}),
|
||||
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(
|
||||
},
|
||||
title: Text('Place ${index + 1}'),
|
||||
subtitle: Text(
|
||||
'ID: ${templates['CID']} DATUM: ${templates['Datum']} RUDEL: ${templates['Rudel']} STATUS: ${templates['Status']}',
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
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,
|
||||
height: 80.0,
|
||||
point: LatLng(double.parse(e['DECLAT'].toString()),
|
||||
double.parse(e['DECLNG'].toString())),
|
||||
point: LatLng(
|
||||
double.parse(e['DECLAT'].toString()),
|
||||
double.parse(e['DECLNG'].toString()),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Icon(
|
||||
@@ -293,31 +259,40 @@ class _ViewCamsState extends State<ViewCams> {
|
||||
Text(
|
||||
"ID: ${e['ID'].toString()}",
|
||||
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