Erweiterungen
This commit is contained in:
1 parent
5c3cee2d92
commit
07b9d71eb3
17 files changed
+323
-18
No files matched your search
@@ -1,14 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_broadcast_receiver/flutter_broadcast_receiver.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:stadtbote/content_views/tour_list_page.dart';
|
||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/job.dart';
|
||||
import '../tools/constants.dart';
|
||||
import '../tools/util.dart';
|
||||
|
||||
class AssignedJobsPage extends ContentViewWidget {
|
||||
|
||||
@@ -6,7 +6,10 @@ import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||
import 'package:stadtbote/model/job_tour.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/commision_number_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/receipt_giver_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/scan_barcodes_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/station_notice_popup.dart';
|
||||
import 'package:stadtbote/popups/tasks_popups/take_photos_popup.dart';
|
||||
|
||||
import '../main.dart';
|
||||
import '../model/task_info.dart';
|
||||
@@ -178,20 +181,32 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
void _processTask(TaskInfo taskInfo) {
|
||||
switch(taskInfo.task.type) {
|
||||
case 3:
|
||||
_processTaskArrived(taskInfo);
|
||||
_processTaskArrivedOrFinished(taskInfo);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
_processTakePhotos(taskInfo);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
_processScanBarcodes(taskInfo);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
_processReceiptGiver(taskInfo);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
_processStationNotice(taskInfo);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
_processCommissionNumber(taskInfo);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _processTaskArrived(TaskInfo taskInfo) {
|
||||
void _processTaskArrivedOrFinished(TaskInfo taskInfo) {
|
||||
_popup = showTaskArrivedPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context),
|
||||
});
|
||||
@@ -208,4 +223,22 @@ class _TaskListPageState extends State<TaskListPage> {
|
||||
_popup.dismiss(context)
|
||||
});
|
||||
}
|
||||
|
||||
void _processTakePhotos(TaskInfo taskInfo) {
|
||||
_popup = showTakePhotosPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context)
|
||||
});
|
||||
}
|
||||
|
||||
void _processStationNotice(TaskInfo taskInfo) {
|
||||
_popup = showStationNoticePopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context)
|
||||
});
|
||||
}
|
||||
|
||||
void _processReceiptGiver(TaskInfo taskInfo) {
|
||||
_popup = showReceiptGiverPopup(context, taskInfo, () => {
|
||||
_popup.dismiss(context)
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stadtbote/model/device_object.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stadtbote/model/bootstrap_response_topics.dart';
|
||||
import 'package:stadtbote/model/device_object.dart';
|
||||
|
||||
part 'bootstrap_response_config.g.dart';
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stadtbote/model/bootstrap_response_config.dart';
|
||||
import 'package:stadtbote/model/device_object.dart';
|
||||
|
||||
part 'bootstrap_response_payload.g.dart';
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
import 'package:stadtbote/model/device_object.dart';
|
||||
|
||||
part 'bootstrap_response_topics.g.dart';
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:isar/isar.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
part 'device_object.g.dart';
|
||||
|
||||
@@ -47,9 +47,9 @@ KumiPopupWindow showTaskArrivedPopup(BuildContext context, TaskInfo taskInfo, Fu
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text('Bitte bestätigen Sie Ihre Ankunft'),
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Ankunft bestätigen', () => {
|
||||
getDefaultButton(taskInfo.task.topic, () => {
|
||||
onFinished()
|
||||
}),
|
||||
],
|
||||
|
||||
@@ -55,7 +55,7 @@ KumiPopupWindow showCommisionNumberPopup(BuildContext context, TaskInfo taskInfo
|
||||
Util.getDefaultTextField('Kommisionsnummer',
|
||||
type: TextInputType.text, formatter: [FilteringTextInputFormatter.singleLineFormatter], controller: textEditingController, autofocus: true),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Ankunft bestätigen', () => {
|
||||
getDefaultButton('Übernehmen', () => {
|
||||
onFinished()
|
||||
}) ],
|
||||
),
|
||||
|
||||
@@ -0,0 +1,68 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
KumiPopupWindow showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) {
|
||||
return showPopupWindow(
|
||||
context,
|
||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
||||
gravity: KumiPopupGravity.center,
|
||||
//curve: Curves.elasticOut,
|
||||
bgColor: Colors.grey.withOpacity(0.5),
|
||||
clickOutDismiss: true,
|
||||
clickBackDismiss: true,
|
||||
customAnimation: false,
|
||||
customPop: false,
|
||||
customPage: false,
|
||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
||||
//needSafeDisplay: true,
|
||||
underStatusBar: false,
|
||||
underAppBar: false,
|
||||
//offsetX: -180,
|
||||
//offsetY: 50,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
onShowStart: (pop) {},
|
||||
onShowFinish: (pop) {},
|
||||
onDismissStart: (pop) {},
|
||||
onDismissFinish: (pop) {},
|
||||
onClickOut: (pop) {},
|
||||
onClickBack: (pop) {},
|
||||
childFun: (pop) {
|
||||
TextEditingController textEditingController = TextEditingController();
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 260,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
Util.getDefaultTextField(taskInfo.task.topic,
|
||||
type: TextInputType.text, formatter: [FilteringTextInputFormatter.singleLineFormatter], controller: textEditingController, autofocus: true),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', () => {
|
||||
onFinished()
|
||||
})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ KumiPopupWindow showScanBarcodesPopup(BuildContext context, TaskInfo taskInfo, F
|
||||
List<Widget> barcodeWidgets = [];
|
||||
|
||||
for(var barcode in scannedBarcodes) {
|
||||
barcodeWidgets.add(Container(
|
||||
barcodeWidgets.add(SizedBox(
|
||||
height: 20,
|
||||
child: Center(child: Text(barcode)),
|
||||
));
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
KumiPopupWindow showStationNoticePopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) {
|
||||
return showPopupWindow(
|
||||
context,
|
||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
||||
gravity: KumiPopupGravity.center,
|
||||
//curve: Curves.elasticOut,
|
||||
bgColor: Colors.grey.withOpacity(0.5),
|
||||
clickOutDismiss: true,
|
||||
clickBackDismiss: true,
|
||||
customAnimation: false,
|
||||
customPop: false,
|
||||
customPage: false,
|
||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
||||
//needSafeDisplay: true,
|
||||
underStatusBar: false,
|
||||
underAppBar: false,
|
||||
//offsetX: -180,
|
||||
//offsetY: 50,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
onShowStart: (pop) {},
|
||||
onShowFinish: (pop) {},
|
||||
onDismissStart: (pop) {},
|
||||
onDismissFinish: (pop) {},
|
||||
onClickOut: (pop) {},
|
||||
onClickBack: (pop) {},
|
||||
childFun: (pop) {
|
||||
TextEditingController textEditingController = TextEditingController();
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 280,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(taskInfo.task.topic),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
height: 100,
|
||||
child: Util.getDefaultTextField(taskInfo.task.topic,
|
||||
type: TextInputType.text,
|
||||
maxLines: 10,
|
||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||
controller: textEditingController,
|
||||
autofocus: true),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {onFinished()})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
*/
|
||||
@@ -0,0 +1,115 @@
|
||||
import 'package:carousel_slider/carousel_slider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_barcode_scanner/flutter_barcode_scanner.dart';
|
||||
import 'package:kumi_popup_window/kumi_popup_window.dart';
|
||||
import 'package:stadtbote/model/task_info.dart';
|
||||
import 'package:stadtbote/tools/util.dart';
|
||||
|
||||
KumiPopupWindow showTakePhotosPopup(BuildContext context, TaskInfo taskInfo, Function() onFinished) {
|
||||
return showPopupWindow(
|
||||
context,
|
||||
//childSize:Size(240, MediaQuery.of(context).size.width * 0.8),
|
||||
gravity: KumiPopupGravity.center,
|
||||
//curve: Curves.elasticOut,
|
||||
bgColor: Colors.grey.withOpacity(0.5),
|
||||
clickOutDismiss: true,
|
||||
clickBackDismiss: true,
|
||||
customAnimation: false,
|
||||
customPop: false,
|
||||
customPage: false,
|
||||
// targetRenderBox: (btnKey.currentContext.findRenderObject() as RenderBox),
|
||||
//needSafeDisplay: true,
|
||||
underStatusBar: false,
|
||||
underAppBar: false,
|
||||
//offsetX: -180,
|
||||
//offsetY: 50,
|
||||
duration: const Duration(milliseconds: 200),
|
||||
onShowStart: (pop) {},
|
||||
onShowFinish: (pop) {},
|
||||
onDismissStart: (pop) {},
|
||||
onDismissFinish: (pop) {},
|
||||
onClickOut: (pop) {},
|
||||
onClickBack: (pop) {},
|
||||
childFun: (pop) {
|
||||
List<Uint8List> imageList = [];
|
||||
List<Widget> imageWidgetsList = [];
|
||||
|
||||
ValueNotifier<List<Widget>> imageWidgetsListNotifier = ValueNotifier<List<Widget>>([]);
|
||||
|
||||
void capturePhoto() async {
|
||||
var photo = await Util.capturePhoto();
|
||||
|
||||
if (photo != null) {
|
||||
var imageData = await photo.readAsBytes();
|
||||
photo.delete();
|
||||
|
||||
imageList.add(imageData);
|
||||
|
||||
imageWidgetsList.clear();
|
||||
for(var image in imageList) {
|
||||
imageWidgetsList.add(GestureDetector(
|
||||
onTap: () {
|
||||
},
|
||||
child: Image.memory(image),
|
||||
));
|
||||
}
|
||||
|
||||
imageWidgetsListNotifier.value = imageWidgetsList;
|
||||
imageWidgetsListNotifier.notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
return SizedBox(
|
||||
key: GlobalKey(),
|
||||
height: 530,
|
||||
width: MediaQuery.of(context).size.width * 0.8,
|
||||
child: Container(
|
||||
height: 100,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(35.0),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text('Aufgenommene Fotos'),
|
||||
const SizedBox(height: 20),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
height: 300,
|
||||
child: ValueListenableBuilder<List<Widget>>(
|
||||
valueListenable: imageWidgetsListNotifier,
|
||||
builder: (context, value, child) {
|
||||
return CarouselSlider(
|
||||
options: CarouselOptions(
|
||||
disableCenter: false,
|
||||
enableInfiniteScroll: false,
|
||||
),
|
||||
items: imageWidgetsList.toList()
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
getDefaultButton('Hinzufügen', buttonHeight: 50, () => {capturePhoto()}),
|
||||
getDefaultButton('Übernehmen', buttonHeight: 50, () => {onFinished()})
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
},
|
||||
);
|
||||
}
|
||||
@@ -193,7 +193,7 @@ class MqttCore {
|
||||
var jsonMap = handshakeMessage.toJson();
|
||||
var json = jsonEncode(jsonMap);
|
||||
var uri = "https://init-x.assecutor.de/bootstrap?get_mqtt_broker=$json";
|
||||
print("Bootstrap request: $uri");
|
||||
Util.logInfo("Bootstrap request: $uri");
|
||||
|
||||
var response = await http.get(Uri.parse(uri));
|
||||
var responseText = response.body;
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
@@ -160,6 +163,17 @@ class Util {
|
||||
borderRadius: BorderRadius.all(Radius.circular(20.0)),
|
||||
);
|
||||
}
|
||||
|
||||
static Future<File?> capturePhoto() async {
|
||||
final imagePicker = ImagePicker();
|
||||
final pickedFile = await imagePicker.pickImage(source: ImageSource.camera);
|
||||
|
||||
if (pickedFile != null) {
|
||||
return File(pickedFile.path);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Widget getDefaultButton(String text, Function() onPressed, {Image? image, double? buttonHeight}) {
|
||||
|
||||
Reference in new issue
Block a user