begin cleanup of view_cams and begin of making it usable with exursion and place

time

refactoring

refactoring again
This commit is contained in:
Nico
2025-05-11 23:25:33 +02:00
parent f3877a583b
commit a5769a7dc0
10 changed files with 641 additions and 594 deletions

View File

@@ -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(),

View File

@@ -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);
}
}

View File

@@ -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';
@@ -26,62 +26,62 @@ class _ExcursionMainState extends State<ExcursionMain> {
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, },
"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, },
"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, },
"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, },
"Bemerk": {"controller": TextEditingController(), "required": bool},
"IntKomm": {"controller": TextEditingController(), "required": bool},
"FallNum": {"controller": TextEditingController(), "required": bool},
};
Map<String, String> getFieldsText() {
@@ -111,9 +111,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
},
name: AppLocalizations.of(context)!.date,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Pack
VarTextField(
textController: rmap["Rudel"]!["controller"]!,
@@ -122,9 +120,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Participants
VarTextField(
textController: rmap["Teilnehm"]!["controller"]!,
@@ -133,9 +129,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Duration
VarTextField(
textController: rmap["Dauer"]!["controller"]!,
@@ -144,17 +138,15 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Dog(leash)
HundULeine(onMHundChanged: (mHund, mLeine) {
HundULeine(
onMHundChanged: (mHund, mLeine) {
rmap["MHund"]!["controller"]!.text = mHund;
rmap["MLeine"]!["controller"]!.text = mLeine;
}),
const SizedBox(
height: 10,
},
),
const SizedBox(height: 10),
// ---------- State
VarTextField(
textController: rmap["BLand"]!["controller"]!,
@@ -163,9 +155,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Country
VarTextField(
textController: rmap["Lkr"]!["controller"]!,
@@ -174,9 +164,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- By State
VarTextField(
textController: rmap["BeiOrt"]!["controller"]!,
@@ -185,14 +173,10 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Bima number
const Divider(),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
VarTextField(
textController: rmap["BimaNr"]!["controller"]!,
localization: AppLocalizations.of(context)!.bimaNr,
@@ -200,9 +184,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Bima name
VarTextField(
textController: rmap["BimaName"]!["controller"]!,
@@ -211,18 +193,16 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 10,
),
const SizedBox(height: 10),
// ---------- Bima user
BimaNutzer(onBimaNutzerChanged: (value) {
BimaNutzer(
onBimaNutzerChanged: (value) {
setState(() {
rmap["BimaNutzer"]!["controller"]!.text = value;
});
}),
const SizedBox(
height: 10,
},
),
const SizedBox(height: 10),
// ---------- Bima AGV
VarTextField(
textController: rmap["BimaAGV"]!["controller"]!,
@@ -230,9 +210,10 @@ class _ExcursionMainState extends State<ExcursionMain> {
dbName: "BimaAGV",
required: false,
dbDesignation: DatabasesEnum.excursion,
)
),
],
)),
),
),
Step(
title: const Text("step2"),
content: Column(
@@ -267,9 +248,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
spMittelController: rmap["SpMittel"]!["controller"]!,
spSchlechtController: rmap["SpSchlecht"]!["controller"]!,
),
const SizedBox(
height: 20,
),
const SizedBox(height: 20),
const Divider(),
// ---------- Track found
SpurGefunden(
@@ -279,10 +258,9 @@ class _ExcursionMainState extends State<ExcursionMain> {
spSicher: rmap["SpSicher"]!["controller"]!,
welpenSp: rmap["WelpenSp"]!["controller"]!,
welpenAnz: rmap["WelpenAnz"]!["controller"]!,
wpSicher: rmap["WpSicher"]!["controller"]!),
const SizedBox(
height: 20,
wpSicher: rmap["WpSicher"]!["controller"]!,
),
const SizedBox(height: 20),
// ---------- Counts
Anzahlen(
losungAnz: rmap["LosungAnz"]!["controller"]!,
@@ -295,25 +273,18 @@ class _ExcursionMainState extends State<ExcursionMain> {
haarAnz: rmap["HaarAnz"]!["controller"]!,
haarGen: rmap["HaarGen"]!["controller"]!,
),
const SizedBox(
height: 20,
),
const SizedBox(height: 20),
const Divider(),
const SizedBox(
height: 20,
),
const SizedBox(height: 20),
// ---------- Clues
Align(
alignment: Alignment.bottomLeft,
child: Text(
AppLocalizations.of(context)!.hinweise,
style:
Theme.of(context).textTheme.titleMedium,
style: Theme.of(context).textTheme.titleMedium,
),
),
Hinweise(
hinweise: rmap["Hinweise"]!["controller"]!,
),
Hinweise(hinweise: rmap["Hinweise"]!["controller"]!),
],
),
),
@@ -329,9 +300,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
required: false,
dbDesignation: DatabasesEnum.excursion,
),
const SizedBox(
height: 20,
),
const SizedBox(height: 20),
// ---------- Internal communication
VarTextField(
textController: rmap["IntKomm"]!["controller"]!,
@@ -347,13 +316,14 @@ class _ExcursionMainState extends State<ExcursionMain> {
// Begin of widget tree
return Scaffold(
appBar: AppBar(
title: Text(AppLocalizations.of(context)!.excursion),
),
appBar: AppBar(title: Text(AppLocalizations.of(context)!.excursion)),
body: PageTransitionSwitcher(
duration: const Duration(microseconds: 800),
transitionBuilder: (Widget child, Animation<double> animation,
Animation<double> secondaryAnimation) {
transitionBuilder: (
Widget child,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
return SharedAxisTransition(
animation: animation,
secondaryAnimation: secondaryAnimation,
@@ -380,9 +350,17 @@ class _ExcursionMainState extends State<ExcursionMain> {
} else {
bool empty = CheckRequired.checkRequired(rmap);
if (empty) {
await DialogHelper.showTemplateDialog(context, getFieldsText(), false);
await AddEntriesDialogHelper.showTemplateDialog(
context,
getFieldsText(),
false,
);
} else {
await DialogHelper.showSaveOptionsDialog(context, getFieldsText(), false);
await AddEntriesDialogHelper.showSaveOptionsDialog(
context,
getFieldsText(),
false,
);
}
}
},
@@ -396,6 +374,7 @@ class _ExcursionMainState extends State<ExcursionMain> {
}
},
),
));
),
);
}
}

View 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))
],
);
});
}
}

View 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());
}
}

View 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();
}
}

View File

@@ -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
@@ -110,40 +48,42 @@ class _ViewCamsState extends State<ViewCams> {
length: 3,
child: Scaffold(
appBar: AppBar(
bottom: TabBar(tabs: [
bottom: TabBar(
tabs: [
Tab(text: AppLocalizations.of(context)!.completed),
Tab(
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(
children: [
FutureBuilder<List<Map<String, dynamic>>>(
future: place,
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,9 +111,7 @@ class _ViewCamsState extends State<ViewCams> {
),
],
),
const SizedBox(
height: 15,
),
const SizedBox(height: 15),
Expanded(
child: ListView.builder(
itemCount: placeList.length,
@@ -186,20 +124,26 @@ class _ViewCamsState extends State<ViewCams> {
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,
)
]),
label:
AppLocalizations.of(
context,
)!.justdelete,
),
],
),
child: ListTile(
title: Text('Standort ${index + 1}'),
subtitle: Text(
'ID: ${place['ID']} DATUM: ${place['Datum']}'),
'ID: ${place['ID']} DATUM: ${place['Datum']}',
),
trailing: Checkbox(
value: place['Sent'] == 0 ? false : true,
onChanged: null,
@@ -208,23 +152,32 @@ class _ViewCamsState extends State<ViewCams> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddCamMain(
isSent: place['Sent'] == 1 ? true : false,
builder:
(context) => AddCamMain(
isSent:
place['Sent'] == 1
? true
: false,
isFinished: true,
existingData: place,
)));
),
),
);
},
),
);
},
))
),
),
],
),
);
}
},
),
FutureBuilder<List<Map<String, dynamic>>>(
),
Tab(
child: FutureBuilder<List<Map<String, dynamic>>>(
future: templates,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
@@ -236,7 +189,10 @@ class _ViewCamsState extends State<ViewCams> {
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.delete),
onPressed: () {
delAllTemplates();
ViewEntriesDialogHelper.deleteAllTemplates(
context,
widget.dbType,
);
},
),
body: Column(
@@ -252,38 +208,48 @@ class _ViewCamsState extends State<ViewCams> {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
AddCamMain(
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']}'),
'ID: ${templates['CID']} DATUM: ${templates['Datum']} RUDEL: ${templates['Rudel']} STATUS: ${templates['Status']}',
),
);
}),
)
},
),
),
],
),
);
}
}),
FutureBuilder(
future: place,
},
),
),
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) {
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
initialCenter:
markers.isEmpty
? const LatLng(50, 10)
: markers.first.point,
interactionOptions: const InteractionOptions(
flags: InteractiveFlag.pinchZoom |
flags:
InteractiveFlag.pinchZoom |
InteractiveFlag.drag |
InteractiveFlag.pinchMove)),
InteractiveFlag.pinchMove,
),
),
children: [
TileLayer(
urlTemplate:
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.example.app',
),
MarkerLayer(markers: markers)
]);
}
})
MarkerLayer(markers: markers),
],
)),
);
}
},
),
),
],
),
),
);
}
}

View File

@@ -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);
});
}

View File

@@ -79,3 +79,4 @@
7. mai 2h 45min
9. mai 3h 40min
10.mai 4h 15min
11.mai 1h 15min