Cleanup
This commit is contained in:
1 parent
7a681ddcc6
commit
0ac8ab8cf5
17 files changed
+34
-41
No files matched your search
@@ -5,7 +5,7 @@ void main() {
|
|||||||
testWidgets('tap on the floating action button, verify counter',
|
testWidgets('tap on the floating action button, verify counter',
|
||||||
(tester) async {
|
(tester) async {
|
||||||
// Load app widget.
|
// Load app widget.
|
||||||
await tester.pumpWidget(MyApp());
|
await tester.pumpWidget(const MyApp());
|
||||||
|
|
||||||
// Verify the counter starts at 0.
|
// Verify the counter starts at 0.
|
||||||
expect(find.text('HH1091'), findsOneWidget);
|
expect(find.text('HH1091'), findsOneWidget);
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class MainPage extends ContentViewWidget {
|
|||||||
rightButtonVisible: true,
|
rightButtonVisible: true,
|
||||||
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
rightButtonImage: Util.fetchFutureIcon(const Icon(Icons.info_outline, size: 20.0, color: Colors.white)),
|
||||||
rightButtonOnPressed: () async {
|
rightButtonOnPressed: () async {
|
||||||
showInfosPopup(context, await MyApp.isarInstance.sessionStatus.where().findFirst());
|
showInfosPopup(await MyApp.isarInstance.sessionStatus.where().findFirst());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ class _MessagesPageState extends State<MessagesPage> {
|
|||||||
|
|
||||||
setState(() {}),
|
setState(() {}),
|
||||||
|
|
||||||
Navigator.of(context).pop()
|
Navigator.of(MyApp.appNavigatorKey.currentContext!).pop()
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
])
|
])
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class _TourDetailsPageState extends State<TourDetailsPage> {
|
|||||||
if (widget.tour.pos != null) {
|
if (widget.tour.pos != null) {
|
||||||
showMapPopup(context, widget.tour, widget.job.tours)
|
showMapPopup(context, widget.tour, widget.job.tours)
|
||||||
} else {
|
} else {
|
||||||
showAlertDialog(context, 'Information', 'Es liegt keine Position für diese Station vor')
|
showAlertDialog('Information', 'Es liegt keine Position für diese Station vor')
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
|
|||||||
+4
-5
@@ -20,7 +20,6 @@ import 'package:stadtbote/tools/connection_status.dart';
|
|||||||
import 'package:stadtbote/tools/message_service.dart';
|
import 'package:stadtbote/tools/message_service.dart';
|
||||||
import 'package:stadtbote/tools/messages/job_deleted_message.dart';
|
import 'package:stadtbote/tools/messages/job_deleted_message.dart';
|
||||||
import 'package:stadtbote/tools/messages/job_received_message.dart';
|
import 'package:stadtbote/tools/messages/job_received_message.dart';
|
||||||
import 'package:stadtbote/tools/messages/refresh_badges_message.dart';
|
|
||||||
import 'package:stadtbote/tools/mqtt_core.dart';
|
import 'package:stadtbote/tools/mqtt_core.dart';
|
||||||
|
|
||||||
import 'content_views/main_page.dart';
|
import 'content_views/main_page.dart';
|
||||||
@@ -49,7 +48,7 @@ Future<void> main() async {
|
|||||||
|
|
||||||
await _clearLog();
|
await _clearLog();
|
||||||
|
|
||||||
runApp(MyApp());
|
runApp(const MyApp());
|
||||||
}, (error, stackTrace) {
|
}, (error, stackTrace) {
|
||||||
_traceUncaughtExceptions(error, stackTrace);
|
_traceUncaughtExceptions(error, stackTrace);
|
||||||
});
|
});
|
||||||
@@ -69,7 +68,7 @@ void _traceUncaughtExceptions(Object error, StackTrace stackTrace) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class MyApp extends StatefulWidget {
|
class MyApp extends StatefulWidget {
|
||||||
MyApp({super.key});
|
const MyApp({super.key});
|
||||||
|
|
||||||
static final appNavigatorKey = GlobalKey<NavigatorState>();
|
static final appNavigatorKey = GlobalKey<NavigatorState>();
|
||||||
|
|
||||||
@@ -206,7 +205,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
|||||||
|
|
||||||
_currentContent = MainPage();
|
_currentContent = MainPage();
|
||||||
|
|
||||||
var headerInfo = await _currentContent.getHeaderInfo(context);
|
var headerInfo = await _currentContent.getHeaderInfo(MyApp.appNavigatorKey.currentContext!);
|
||||||
_currentTitleWidget = headerInfo.titleWidget;
|
_currentTitleWidget = headerInfo.titleWidget;
|
||||||
|
|
||||||
_leftButtonVisible = false;
|
_leftButtonVisible = false;
|
||||||
@@ -482,7 +481,7 @@ class _MainState extends State<Main> with SingleTickerProviderStateMixin {
|
|||||||
_checkForNewState0JobsJobsTimer ??= Timer.periodic(const Duration(seconds: 5), (Timer t) async {
|
_checkForNewState0JobsJobsTimer ??= Timer.periodic(const Duration(seconds: 5), (Timer t) async {
|
||||||
if (await _jobMap!.length() > 0 && !_dialogOpened) {
|
if (await _jobMap!.length() > 0 && !_dialogOpened) {
|
||||||
_dialogOpened = true;
|
_dialogOpened = true;
|
||||||
await showAcceptJobsPopup(context, _jobMap!.sharedReference(), () async {
|
await showAcceptJobsPopup(_jobMap!.sharedReference(), () async {
|
||||||
_dialogOpened = false;
|
_dialogOpened = false;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ late Timer _checkForNewJobsTimer;
|
|||||||
late Map<int, DateTime> _firstDelayTimeMap;
|
late Map<int, DateTime> _firstDelayTimeMap;
|
||||||
late Map<int, bool> _infoExpandedMap;
|
late Map<int, bool> _infoExpandedMap;
|
||||||
|
|
||||||
Future<void> showAcceptJobsPopup(BuildContext context, SharedMapReference mapReference, Function() onFinished) async {
|
Future<void> showAcceptJobsPopup(SharedMapReference mapReference, Function() onFinished) async {
|
||||||
_initTimer = true;
|
_initTimer = true;
|
||||||
_firstDelayTimeMap = {};
|
_firstDelayTimeMap = {};
|
||||||
_infoExpandedMap = {};
|
_infoExpandedMap = {};
|
||||||
|
|
||||||
await showDialog<void>(
|
await showDialog<void>(
|
||||||
context: context,
|
context: MyApp.appNavigatorKey.currentContext!,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
onWillPop: () async {
|
onWillPop: () async {
|
||||||
@@ -85,7 +85,7 @@ void _startTimer(BuildContext context, SharedMapReference mapReference, StateSet
|
|||||||
} else {
|
} else {
|
||||||
_stopTimer();
|
_stopTimer();
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(MyApp.appNavigatorKey.currentContext!).pop();
|
||||||
|
|
||||||
onFinished();
|
onFinished();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import 'package:stadtbote/tools/messages/current_connection_status_message.dart'
|
|||||||
import 'package:stadtbote/tools/messages/request_connection_status_message.dart';
|
import 'package:stadtbote/tools/messages/request_connection_status_message.dart';
|
||||||
import 'package:stadtbote/tools/util.dart';
|
import 'package:stadtbote/tools/util.dart';
|
||||||
|
|
||||||
void showInfosPopup(BuildContext context, SessionStatus? status) async {
|
void showInfosPopup(SessionStatus? status) async {
|
||||||
final int version = await Util.getAppVersion();
|
final int version = await Util.getAppVersion();
|
||||||
|
|
||||||
late String connectedString = "Bitte warten...";
|
late String connectedString = "Bitte warten...";
|
||||||
@@ -24,7 +24,7 @@ void showInfosPopup(BuildContext context, SessionStatus? status) async {
|
|||||||
|
|
||||||
await showDialog(
|
await showDialog(
|
||||||
// ignore: use_build_context_synchronously
|
// ignore: use_build_context_synchronously
|
||||||
context: context,
|
context: MyApp.appNavigatorKey.currentContext!,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
// ignore: deprecated_member_use
|
// ignore: deprecated_member_use
|
||||||
return WillPopScope(
|
return WillPopScope(
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ showMapPopup(BuildContext context, JobTour currentTour, List<JobTour> tourList)
|
|||||||
currentTour = tour;
|
currentTour = tour;
|
||||||
streamController[tour.sort]!.sink.add(true);
|
streamController[tour.sort]!.sink.add(true);
|
||||||
} else {
|
} else {
|
||||||
showAlertDialog(context, 'Information', 'Es liegt keine Position für diese Station vor');
|
showAlertDialog('Information', 'Es liegt keine Position für diese Station vor');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ showPickupDeliveryStatusPopup(BuildContext context, TaskInfo taskInfo, Function(
|
|||||||
|
|
||||||
onFinished(selectedTourEntry, remController.text)
|
onFinished(selectedTourEntry, remController.text)
|
||||||
} else {
|
} else {
|
||||||
showAlertDialog(context, "Fehler", "Bitte geben Sie eine Bemerkung ein")
|
showAlertDialog("Fehler", "Bitte geben Sie eine Bemerkung ein")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Navigator.of(context).pop(),
|
Navigator.of(context).pop(),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
|||||||
|
|
||||||
onFinished(textEditingController.text);
|
onFinished(textEditingController.text);
|
||||||
} else {
|
} else {
|
||||||
showAlertDialog(context, "Fehler", "Sie müssen einen Text eingeben");
|
showAlertDialog("Fehler", "Sie müssen einen Text eingeben");
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ showSignaturePopup(BuildContext context, TaskInfo taskInfo, Function(String?) on
|
|||||||
if (controller.points.length > 50)
|
if (controller.points.length > 50)
|
||||||
{Navigator.of(context).pop(), onFinished(convertPoints(controller.points))}
|
{Navigator.of(context).pop(), onFinished(convertPoints(controller.points))}
|
||||||
else
|
else
|
||||||
{showAlertDialog(context, "Fehler", "Die Unterschrift ist zu kurz.")}
|
{showAlertDialog("Fehler", "Die Unterschrift ist zu kurz.")}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ Future<void> showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Functi
|
|||||||
if (imageDataList.length >= taskInfo.task.min! && imageDataList.length <= taskInfo.task.max!)
|
if (imageDataList.length >= taskInfo.task.min! && imageDataList.length <= taskInfo.task.max!)
|
||||||
{Navigator.of(context).pop(), onFinished(imageDataList)}
|
{Navigator.of(context).pop(), onFinished(imageDataList)}
|
||||||
else
|
else
|
||||||
{showAlertDialog(context, 'Fehler', 'Es müssen mindestens ${taskInfo.task.min} Foto(s) aufgenommen werden')}
|
{showAlertDialog('Fehler', 'Es müssen mindestens ${taskInfo.task.min} Foto(s) aufgenommen werden')}
|
||||||
})
|
})
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ bool _checkInput(BuildContext context, String input) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (message.isNotEmpty) {
|
if (message.isNotEmpty) {
|
||||||
showAlertDialog(context, 'Fehler', message);
|
showAlertDialog('Fehler', message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return message.isEmpty;
|
return message.isEmpty;
|
||||||
|
|||||||
@@ -450,7 +450,7 @@ class MqttCore {
|
|||||||
var message = bootstrapResponsePayload.message;
|
var message = bootstrapResponsePayload.message;
|
||||||
|
|
||||||
if (status > 0) {
|
if (status > 0) {
|
||||||
showAlertDialog(MyApp.appNavigatorKey.currentContext!, status == 1 ? "Information" : "Fehler", message);
|
showAlertDialog(status == 1 ? "Information" : "Fehler", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status < 2) {
|
if (status < 2) {
|
||||||
|
|||||||
+6
-6
@@ -395,9 +395,9 @@ Future<void> showQuestionDialog(BuildContext context, String title, String messa
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> showAlertDialog(BuildContext context, String title, String message) async {
|
Future<void> showAlertDialog(String title, String message) async {
|
||||||
await showDialog(
|
await showDialog(
|
||||||
context: context,
|
context: MyApp.appNavigatorKey.currentContext!,
|
||||||
builder: (context) {
|
builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: Text(title),
|
title: Text(title),
|
||||||
@@ -441,7 +441,7 @@ class DecimalTextInputFormatter extends TextInputFormatter {
|
|||||||
if (text != "") {
|
if (text != "") {
|
||||||
RegExp regExp;
|
RegExp regExp;
|
||||||
if (decimalPlaces > 0) {
|
if (decimalPlaces > 0) {
|
||||||
regExp = RegExp(r'[0-9]+[,]{0,1}[0-9]{0,' + decimalPlaces.toString() + '}');
|
regExp = RegExp(r'[0-9]+[,]{0,1}[0-9]{0,${' + decimalPlaces.toString() + '}');
|
||||||
} else {
|
} else {
|
||||||
regExp = RegExp(r'[0-9]{0,' + maxLength.toString() +'}');
|
regExp = RegExp(r'[0-9]{0,' + maxLength.toString() +'}');
|
||||||
}
|
}
|
||||||
@@ -460,12 +460,12 @@ Future<bool> taskDialogSecurityException(BuildContext context) async {
|
|||||||
bool close = false;
|
bool close = false;
|
||||||
|
|
||||||
await showQuestionDialog(context, "Achtung", "Wenn Sie den Dialog jetzt schließen gehen erfasste Daten verloren und die Aufgabe oder Station bleibt unerledigt.", [
|
await showQuestionDialog(context, "Achtung", "Wenn Sie den Dialog jetzt schließen gehen erfasste Daten verloren und die Aufgabe oder Station bleibt unerledigt.", [
|
||||||
TextButton(onPressed: () => {Navigator.of(context).pop(), close = true}, child: const Text('Schließen')),
|
TextButton(onPressed: () => {Navigator.of(MyApp.appNavigatorKey.currentContext!).pop(), close = true}, child: const Text('Schließen')),
|
||||||
TextButton(onPressed: () => {Navigator.of(context).pop(), close = false}, child: const Text('Zurück')),
|
TextButton(onPressed: () => {Navigator.of(MyApp.appNavigatorKey.currentContext!).pop(), close = false}, child: const Text('Zurück')),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (close) {
|
if (close) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(MyApp.appNavigatorKey.currentContext!).pop();
|
||||||
}
|
}
|
||||||
|
|
||||||
return close;
|
return close;
|
||||||
|
|||||||
+6
-14
@@ -34,13 +34,13 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.2"
|
version: "1.2.2"
|
||||||
archive:
|
archive:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: archive
|
name: archive
|
||||||
sha256: "22600aa1e926be775fa5fe7e6894e7fb3df9efda8891c73f70fb3262399a432d"
|
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.4.10"
|
version: "3.6.1"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -721,13 +721,13 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.2"
|
version: "4.0.2"
|
||||||
image:
|
image:
|
||||||
dependency: transitive
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: image
|
name: image
|
||||||
sha256: "4c68bfd5ae83e700b5204c1e74451e7bf3cf750e6843c6e158289cf56bda018e"
|
sha256: "2237616a36c0d69aef7549ab439b833fb7f9fb9fc861af2cc9ac3eedddd69ca8"
|
||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.7"
|
version: "4.2.0"
|
||||||
image_picker:
|
image_picker:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
@@ -1152,14 +1152,6 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.8"
|
version: "2.1.8"
|
||||||
pointycastle:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: pointycastle
|
|
||||||
sha256: "70fe966348fe08c34bf929582f1d8247d9d9408130723206472b4687227e4333"
|
|
||||||
url: "https://pub.dev"
|
|
||||||
source: hosted
|
|
||||||
version: "3.8.0"
|
|
||||||
polylabel:
|
polylabel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -73,6 +73,8 @@ dependencies:
|
|||||||
is_lock_screen: ^2.0.0
|
is_lock_screen: ^2.0.0
|
||||||
flutter_local_notifications: ^17.1.2
|
flutter_local_notifications: ^17.1.2
|
||||||
shared_map: ^1.1.9
|
shared_map: ^1.1.9
|
||||||
|
image: ^4.2.0
|
||||||
|
archive: ^3.6.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|||||||
Reference in new issue
Block a user