summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrik@amftech.nl>2023-04-13 20:15:32 +0200
committerAldrik Ramaekers <aldrik@amftech.nl>2023-04-13 20:15:32 +0200
commitfe968ef8eed020670abdc8b8554a766eee15e5ed (patch)
tree6afef5a1c3605abaa78a8b852b7d836cf5ca8e73
parentd35e4014e16bfdf2e2fc2bde397c385fc53e498c (diff)
improvements
-rw-r--r--lib/RoutingExample.dart7
-rw-r--r--lib/config/defaults.dart4
-rw-r--r--lib/navigation/HERENavigation.dart1
-rw-r--r--lib/navigation/baseNavigation.dart61
-rw-r--r--lib/pages/developer_page.dart21
-rw-r--r--lib/pages/navigation_page.dart114
6 files changed, 114 insertions, 94 deletions
diff --git a/lib/RoutingExample.dart b/lib/RoutingExample.dart
index ade893d..23b0be3 100644
--- a/lib/RoutingExample.dart
+++ b/lib/RoutingExample.dart
@@ -276,13 +276,8 @@ class RoutingExample {
_parcelNumberPins.add(
DestinationPin(
+ numberOfParcels: 0,
sequenceNumber: int.parse(item.deliverySequenceNumber!),
- text: item.deliverySequenceNumber.toString() +
- ' = ' +
- item.houseNumber! +
- (item.houseNumberAddition != null
- ? item.houseNumberAddition!
- : ''),
coords: DHLCoordinates(destinationGeoCoordinates.latitude,
destinationGeoCoordinates.longitude),
isDoublePlannedAddress: false,
diff --git a/lib/config/defaults.dart b/lib/config/defaults.dart
index 71e457e..a02c74f 100644
--- a/lib/config/defaults.dart
+++ b/lib/config/defaults.dart
@@ -1,4 +1,4 @@
-String program_version = '0.13 [10/04/2023]';
+String program_version = '0.14 [13/04/2023]';
bool debug_mode = false;
class ShiftType {
@@ -19,7 +19,7 @@ class DefaultConfig {
name: 'Dagrit',
startTime: Duration(hours: 10),
startTimeSaturday: Duration(hours: 10),
- expectedDuration: Duration(hours: 6, minutes: 30)),
+ expectedDuration: Duration(hours: 7, minutes: 30)),
ShiftType(
name: 'Avondrit',
startTime: Duration(hours: 17),
diff --git a/lib/navigation/HERENavigation.dart b/lib/navigation/HERENavigation.dart
index 0504061..1ccae29 100644
--- a/lib/navigation/HERENavigation.dart
+++ b/lib/navigation/HERENavigation.dart
@@ -210,7 +210,6 @@ class _HERENavigationState extends BaseNavigationState {
if (newVal > 20) newVal = 20;
if (newVal < 13) newVal = 13;
widget.currentZoom = newVal;
- print('hallo' + newVal.toString());
hereMapController.camera.zoomTo(widget.currentZoom);
}
diff --git a/lib/navigation/baseNavigation.dart b/lib/navigation/baseNavigation.dart
index e8f5379..78e5f1c 100644
--- a/lib/navigation/baseNavigation.dart
+++ b/lib/navigation/baseNavigation.dart
@@ -8,7 +8,7 @@ import '../route.dart' as DHLRoute;
import 'package:training_planner/services/iblacklist_provider_service.dart';
class DestinationPin {
- final String text;
+ final int numberOfParcels;
final int sequenceNumber;
final DHLCoordinates coords;
final String? postalcodeNumeric;
@@ -18,7 +18,7 @@ class DestinationPin {
bool isDoublePlannedAddress;
DestinationPin(
- {this.text = '',
+ {required this.numberOfParcels,
required this.coords,
required this.sequenceNumber,
required this.isDoublePlannedAddress,
@@ -46,6 +46,10 @@ class ActiveTask {
final bool needsSignature;
final bool notAtNeighbors;
+ int getNumberOfPercels() {
+ return lastParcelNumber - firstParcelNumber + 1;
+ }
+
ActiveTask(
this.firstParcelNumber,
this.deliveryTimeBlock,
@@ -120,10 +124,22 @@ abstract class BaseNavigationState extends State<BaseNavigation> {
borderRadius: BorderRadius.circular(10),
shape: BoxShape.rectangle,
),
- child: Text(
- pin.sequenceNumber.toString(),
- style: TextStyle(
- fontSize: 20.0, color: Color.fromARGB(255, 255, 255, 255)),
+ child: RichText(
+ text: TextSpan(children: [
+ TextSpan(
+ text: pin.sequenceNumber.toString(),
+ style: TextStyle(
+ fontSize: 20.0,
+ color: Color.fromARGB(255, 255, 255, 255)),
+ ),
+ if (pin.numberOfParcels > 1)
+ TextSpan(
+ text: ' ' + pin.numberOfParcels.toString(),
+ style: TextStyle(
+ fontSize: 12.0,
+ color: Color.fromARGB(255, 255, 255, 255)),
+ )
+ ]),
),
),
Container(
@@ -242,25 +258,6 @@ abstract class BaseNavigationState extends State<BaseNavigation> {
}
}
- widget.parcelNumberPins.add(
- DestinationPin(
- sequenceNumber: int.parse(item.deliverySequenceNumber!),
- text: item.deliverySequenceNumber.toString() +
- ' = ' +
- item.houseNumber! +
- (item.houseNumberAddition != null
- ? item.houseNumberAddition!
- : ''),
- coords: DHLCoordinates(destinationGeoCoordinates.lattitude,
- destinationGeoCoordinates.longitude),
- isDoublePlannedAddress: false,
- postalcodeNumeric: item.postalCodeNumeric,
- postalcodeAlpha: item.postalCodeAlpha,
- houseNumberWithExtra:
- item.houseNumber! + (item.houseNumberAddition ?? '')),
- );
- widget.destinationCoords.add(destinationGeoCoordinates);
-
int sequenceNumber = int.parse(item.deliverySequenceNumber!);
int groupLastSequenceNumber = int.parse(item.deliverySequenceNumber!);
if (item.groupSize != null) {
@@ -280,6 +277,20 @@ abstract class BaseNavigationState extends State<BaseNavigation> {
item.indicationSignatureRequired == true,
item.indicationNotAtNeighbours == true);
+ widget.parcelNumberPins.add(
+ DestinationPin(
+ numberOfParcels: groupedTask.getNumberOfPercels(),
+ sequenceNumber: int.parse(item.deliverySequenceNumber!),
+ coords: DHLCoordinates(destinationGeoCoordinates.lattitude,
+ destinationGeoCoordinates.longitude),
+ isDoublePlannedAddress: false,
+ postalcodeNumeric: item.postalCodeNumeric,
+ postalcodeAlpha: item.postalCodeAlpha,
+ houseNumberWithExtra:
+ item.houseNumber! + (item.houseNumberAddition ?? '')),
+ );
+ widget.destinationCoords.add(destinationGeoCoordinates);
+
if (isFirst) {
eventBus.fire(NextStopLoadedEvent(groupedTask));
isFirst = false;
diff --git a/lib/pages/developer_page.dart b/lib/pages/developer_page.dart
index 9a7f9d5..daf0838 100644
--- a/lib/pages/developer_page.dart
+++ b/lib/pages/developer_page.dart
@@ -22,6 +22,12 @@ class _DeveloperPageState extends State<DeveloperPage> {
initState() {
super.initState();
+ countLocalFiles().then((value) => {
+ setState(() {
+ file_count = value;
+ })
+ });
+
localAuthService.canCheckBiometrics.then((bio) => {
localAuthService
.isDeviceSupported()
@@ -43,6 +49,20 @@ class _DeveloperPageState extends State<DeveloperPage> {
}
}
+ int file_count = 0;
+
+ Future<int> countLocalFiles() async {
+ if (shiftProvider is LocalShiftProviderService) {
+ LocalShiftProviderService lsp =
+ shiftProvider as LocalShiftProviderService;
+ var fileList = await lsp.getStoredFileList();
+
+ return fileList.length;
+ } else {
+ return 0;
+ }
+ }
+
_toggleDebugMode() {
setState(() {
debug_mode = !debug_mode;
@@ -63,6 +83,7 @@ class _DeveloperPageState extends State<DeveloperPage> {
child: Column(
children: [
Text('Versie ' + program_version),
+ Text('Bestanden: ' + file_count.toString()),
ElevatedButton(
onPressed: _toggleDebugMode,
child: Text('Test Modus: ' + debug_mode.toString()))
diff --git a/lib/pages/navigation_page.dart b/lib/pages/navigation_page.dart
index 96a5ef2..178c9f3 100644
--- a/lib/pages/navigation_page.dart
+++ b/lib/pages/navigation_page.dart
@@ -112,59 +112,59 @@ class _NavigationPageState extends State<NavigationPage> {
}
return Scaffold(
- floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
- floatingActionButton: Padding(
- padding: const EdgeInsets.all(8.0),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- InkWell(
- splashColor: Colors.blue,
- onLongPress: () => _mockStopInComplete(),
- child: FloatingActionButton(
- onPressed: () => _mockStopComplete(),
- child: Icon(Icons.check_circle),
- ),
- ),
- Visibility(
- visible:
- navigation == null ? false : navigation!.isLookingAround,
- child: FloatingActionButton(
- backgroundColor: Colors.green,
- child: const Icon(Icons.center_focus_strong),
- onPressed: () => {
- changeIsLookingAround(false),
- eventBus.fire(FlyToEvent(navigation!.lastPosition))
- },
- ),
+ floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
+ floatingActionButton: Padding(
+ padding: const EdgeInsets.all(8.0),
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: <Widget>[
+ InkWell(
+ splashColor: Colors.blue,
+ onLongPress: () => _mockStopInComplete(),
+ child: FloatingActionButton(
+ onPressed: () => _mockStopComplete(),
+ child: Icon(Icons.check_circle),
),
- Padding(padding: EdgeInsets.all(5)),
- FloatingActionButton(
- onPressed: () => _zoomOut(),
- child: Icon(Icons.zoom_out),
- ),
- Padding(padding: EdgeInsets.all(2)),
- FloatingActionButton(
- onPressed: () => _zoomIn(),
- child: Icon(Icons.zoom_in),
- )
- ],
- ),
- ),
- body: Column(
- children: [
- _createNextDropInfoWidget(),
- Container(
- decoration: BoxDecoration(color: Colors.black),
- height: 2,
),
- Expanded(
- child: Stack(
- children: [navigation!],
+ Visibility(
+ visible: navigation == null ? false : navigation!.isLookingAround,
+ child: FloatingActionButton(
+ backgroundColor: Colors.green,
+ child: const Icon(Icons.center_focus_strong),
+ onPressed: () => {
+ changeIsLookingAround(false),
+ eventBus.fire(FlyToEvent(navigation!.lastPosition))
+ },
),
),
+ Padding(padding: EdgeInsets.all(5)),
+ FloatingActionButton(
+ onPressed: () => _zoomOut(),
+ child: Icon(Icons.zoom_out),
+ ),
+ Padding(padding: EdgeInsets.all(2)),
+ FloatingActionButton(
+ onPressed: () => _zoomIn(),
+ child: Icon(Icons.zoom_in),
+ )
],
- ));
+ ),
+ ),
+ body: Column(
+ children: [
+ _createNextDropInfoWidget(),
+ Container(
+ decoration: BoxDecoration(color: Colors.black),
+ height: 2,
+ ),
+ Expanded(
+ child: Stack(
+ children: [navigation!],
+ ),
+ ),
+ ],
+ ),
+ );
}
Widget getLoadingScreen() {
@@ -180,11 +180,11 @@ class _NavigationPageState extends State<NavigationPage> {
return Container(
decoration: BoxDecoration(color: Colors.white),
- height: 80,
+ height: 60,
child: Column(
children: [
SizedBox(
- height: 10,
+ height: 5,
),
Container(
height: 50,
@@ -207,11 +207,8 @@ class _NavigationPageState extends State<NavigationPage> {
),
),
TextSpan(
- text: ' ' +
- (activeTask!.lastParcelNumber -
- activeTask!.firstParcelNumber +
- 1)
- .toString(),
+ text:
+ ' ' + (activeTask!.getNumberOfPercels()).toString(),
style: TextStyle(
color: Color.fromARGB(150, 0, 0, 0),
fontSize: 12,
@@ -231,6 +228,8 @@ class _NavigationPageState extends State<NavigationPage> {
Expanded(
child: Text(
activeTask!.fullAddress,
+ overflow: TextOverflow.ellipsis,
+ maxLines: 2,
style: TextStyle(
color: Color.fromARGB(255, 0, 0, 0),
fontSize: 15,
@@ -240,11 +239,6 @@ class _NavigationPageState extends State<NavigationPage> {
],
),
),
- Container(
- height: 20,
- padding: EdgeInsets.only(left: 10, right: 10),
- child: Row(children: [Text(activeTask!.deliveryTimeBlock)]),
- ),
],
),
);