Erweiterungen

This commit is contained in:
Sven committed 2023-11-17 10:50:04 +01:00
1 parent 3dab4025e7
commit 3d7ae9de2a
16 files changed
+438 -327

No files matched your search

+44 -15
View File
@@ -13,6 +13,7 @@ import 'package:stadtbote/popups/tasks_popups/scan_barcodes_popup.dart';
import 'package:stadtbote/popups/tasks_popups/signature_popup.dart';
import 'package:stadtbote/popups/tasks_popups/station_notice_popup.dart';
import 'package:stadtbote/popups/tasks_popups/take_photos_popup.dart';
import 'package:stadtbote/tools/constants.dart';
import '../main.dart';
import '../model/task_info.dart';
@@ -105,11 +106,11 @@ class _TaskListPageState extends State<TaskListPage> {
children: [
Positioned(
left: 16.5,
top: i == 0 ? 5 : 0,
top: i == 0 ? 40 : 40,
child: Container(
height: i == widget.tour.tasks.length - 1 ? 1: 60,
height: i == widget.tour.tasks.length - 1 ? 0 : 20,
width: 6,
color: Colors.green
color: isTaskActive(i) ? Constants.colorPrimary : Constants.colorPrimaryOpaque,
),
),
Column(
@@ -117,9 +118,9 @@ class _TaskListPageState extends State<TaskListPage> {
Container(
width: 40,
height: 40,
decoration: const BoxDecoration(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.grey,
color: isTaskActive(i) ? Constants.colorPrimary : Constants.colorPrimaryOpaque,
),
child: const Icon(Icons.check, size: 30.0, color: Colors.white),
),
@@ -130,7 +131,7 @@ class _TaskListPageState extends State<TaskListPage> {
const SizedBox(width: 20),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
children: [
Text(
taskInfo.task.topic,
@@ -142,7 +143,7 @@ class _TaskListPageState extends State<TaskListPage> {
),
const SizedBox(height: 5),
Text(
taskInfo.additionalText ?? 'Additonal text',
taskInfo.additionalText ?? '',
textAlign: TextAlign.left,
style: const TextStyle(
color: Colors.blue,
@@ -169,12 +170,14 @@ class _TaskListPageState extends State<TaskListPage> {
for(var task in widget.tour.tasks) {
var taskInfo = await MyApp.isarInstance.taskInfos.filter().sIdEqualTo(task.sId).findFirst();
taskInfo ??= TaskInfo();
if (taskInfo == null) {
taskInfo = TaskInfo();
taskInfo.answer = null;
taskInfo.additionalText = null;
taskInfo.completed = task.opt as bool;
}
taskInfo.task = task;
taskInfo.answer = null;
taskInfo.additionalText = null;
taskList.add(taskInfo);
}
@@ -225,6 +228,7 @@ class _TaskListPageState extends State<TaskListPage> {
DateFormat dateFormat = DateFormat("dd.MM.yyyy HH:mm");
taskInfo.additionalText = dateFormat.format(DateTime.now());
taskInfo.completed = true;
setState(() {});
}
@@ -239,6 +243,7 @@ class _TaskListPageState extends State<TaskListPage> {
_popup.dismiss(context);
taskInfo.additionalText = comissionNumber;
taskInfo.completed = true;
setState(() {});
}
@@ -253,16 +258,26 @@ class _TaskListPageState extends State<TaskListPage> {
_popup.dismiss(context);
taskInfo.additionalText = "Barcodes gescannt";
taskInfo.completed = true;
setState(() {});
}
void _processTakePhotos(TaskInfo taskInfo) {
_processTakePhotos(TaskInfo taskInfo) {
_popup = showTakePhotosPopup(context, taskInfo, () => {
_popup.dismiss(context)
_finishProcessTakePhotos(taskInfo)
});
}
_finishProcessTakePhotos(TaskInfo taskInfo) {
_popup.dismiss(context);
taskInfo.additionalText = "Fotos aufgenommen";
taskInfo.completed = true;
setState(() {});
}
void _processStationNotice(TaskInfo taskInfo) {
_popup = showStationNoticePopup(context, taskInfo, (notice) => {
_finishProcessStationNotice(taskInfo, notice)
@@ -273,6 +288,7 @@ class _TaskListPageState extends State<TaskListPage> {
_popup.dismiss(context);
taskInfo.additionalText = notice;
taskInfo.completed = true;
setState(() {});
}
@@ -287,6 +303,7 @@ class _TaskListPageState extends State<TaskListPage> {
_popup.dismiss(context);
taskInfo.additionalText = receiptGiver;
taskInfo.completed = true;
setState(() {});
}
@@ -298,8 +315,20 @@ class _TaskListPageState extends State<TaskListPage> {
_popup = showSignaturePopup(context, taskInfo, () => {
_popup.dismiss(context),
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
taskInfo.completed = true,
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
});
});
}
bool isTaskActive(int index) {
for (int i = 0; i < index; i++) {
var taskInfo = _taskList[i];
if (!taskInfo.completed) return false;
}
return true;
}
}