Erweiterungen
This commit is contained in:
1 parent
98581c9a39
commit
f9ee90d861
12 files changed
+59
-23
No files matched your search
@@ -1,13 +1,12 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
import 'package:stadtbote/content_views/utils/content_view_widget.dart';
|
||||||
import 'package:stadtbote/content_views/utils/header_info.dart';
|
import 'package:stadtbote/content_views/utils/header_info.dart';
|
||||||
import 'package:stadtbote/messages/PopContentViewMessage.dart';
|
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||||
import 'package:stadtbote/model/job.dart';
|
import 'package:stadtbote/model/job.dart';
|
||||||
import 'package:stadtbote/model/job_tour.dart';
|
import 'package:stadtbote/model/job_tour.dart';
|
||||||
import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
|
import 'package:stadtbote/popups/tasks_popups/arrived_popup.dart';
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:geolocator/geolocator.dart';
|
import 'package:geolocator/geolocator.dart';
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
import 'package:path_provider/path_provider.dart';
|
import 'package:path_provider/path_provider.dart';
|
||||||
import 'package:stadtbote/messages/PopContentViewMessage.dart';
|
import 'package:stadtbote/messages/pop_content_view_message.dart';
|
||||||
import 'package:stadtbote/model/message.dart';
|
import 'package:stadtbote/model/message.dart';
|
||||||
import 'package:stadtbote/model/ranking.dart';
|
import 'package:stadtbote/model/ranking.dart';
|
||||||
import 'package:stadtbote/model/status.dart';
|
import 'package:stadtbote/model/status.dart';
|
||||||
|
|||||||
File renamed without changes.
@@ -1,6 +1,5 @@
|
|||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
import 'package:stadtbote/model/tour_task.dart';
|
import 'package:stadtbote/model/tour_task.dart';
|
||||||
import 'package:stadtbote/protocoll_messages/fin_tour_message.dart';
|
|
||||||
|
|
||||||
import '../tools/util.dart';
|
import '../tools/util.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ showComissionNumberPopup(BuildContext context, TaskInfo taskInfo, Function(Strin
|
|||||||
const Text('Bitte geben Sie die Kommisionsnummer ein'),
|
const Text('Bitte geben Sie die Kommisionsnummer ein'),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Util.getDefaultTextField('Kommisionsnummer',
|
Util.getDefaultTextField('Kommisionsnummer',
|
||||||
type: TextInputType.text,
|
textInputType: TextInputType.text,
|
||||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
autofocus: true),
|
autofocus: true),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
|||||||
Text(taskInfo.task.topic),
|
Text(taskInfo.task.topic),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Util.getDefaultTextField(taskInfo.task.topic,
|
Util.getDefaultTextField(taskInfo.task.topic,
|
||||||
type: TextInputType.text,
|
textInputType: TextInputType.text,
|
||||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
autofocus: true),
|
autofocus: true),
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ showStationNoticePopup(BuildContext context, TaskInfo taskInfo, Function(String)
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: 100,
|
height: 100,
|
||||||
child: Util.getDefaultTextField(taskInfo.task.topic,
|
child: Util.getDefaultTextField(taskInfo.task.topic,
|
||||||
type: TextInputType.text,
|
textInputType: TextInputType.text,
|
||||||
maxLines: 10,
|
maxLines: 10,
|
||||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
|
|||||||
@@ -1,6 +1,4 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
|
||||||
import 'package:stadtbote/model/task_info.dart';
|
|
||||||
import 'package:stadtbote/tools/util.dart';
|
import 'package:stadtbote/tools/util.dart';
|
||||||
|
|
||||||
showZipPopup(BuildContext context, String text, String buttonText, Function(String) onFinished) async {
|
showZipPopup(BuildContext context, String text, String buttonText, Function(String) onFinished) async {
|
||||||
@@ -32,18 +30,20 @@ showZipPopup(BuildContext context, String text, String buttonText, Function(Stri
|
|||||||
padding: const EdgeInsets.all(35.0),
|
padding: const EdgeInsets.all(35.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Text(text, style: TextStyle(fontWeight: FontWeight.bold)),
|
Text(text, style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Util.getDefaultTextField('Postleitzahl',
|
Util.getDefaultTextField('Postleitzahl',
|
||||||
type: TextInputType.text,
|
formatter: [DecimalTextInputFormatter(maxLength: 5, decimalPlaces: 0)],
|
||||||
formatter: [FilteringTextInputFormatter.singleLineFormatter],
|
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
|
||||||
controller: textEditingController,
|
controller: textEditingController,
|
||||||
autofocus: true),
|
autofocus: true),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
getDefaultButton(buttonText, () => {
|
getDefaultButton(
|
||||||
Navigator.of(context).pop(),
|
buttonText,
|
||||||
|
() => {
|
||||||
onFinished(textEditingController.text)})
|
if (_checkInput(context, textEditingController.text))
|
||||||
|
{Navigator.of(context).pop(), onFinished(textEditingController.text)},
|
||||||
|
}),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -51,3 +51,17 @@ showZipPopup(BuildContext context, String text, String buttonText, Function(Stri
|
|||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool _checkInput(BuildContext context, String input) {
|
||||||
|
String message = '';
|
||||||
|
|
||||||
|
if (input.length != 5) {
|
||||||
|
message += 'Bitte geben Sie eine fünfstellige Postleitzahl ein';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (message.isNotEmpty) {
|
||||||
|
showAlertDialog(context, 'Fehler', message);
|
||||||
|
}
|
||||||
|
|
||||||
|
return message.isEmpty;
|
||||||
|
}
|
||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:isar/isar.dart';
|
|
||||||
import 'package:json_annotation/json_annotation.dart';
|
import 'package:json_annotation/json_annotation.dart';
|
||||||
import 'package:stadtbote/protocoll_messages/accept_job_message.dart';
|
import 'package:stadtbote/protocoll_messages/accept_job_message.dart';
|
||||||
import 'package:stadtbote/protocoll_messages/fin_task_message.dart';
|
import 'package:stadtbote/protocoll_messages/fin_task_message.dart';
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:stadtbote/model/status.dart';
|
|
||||||
|
|
||||||
class RankingUpdated {
|
class RankingUpdated {
|
||||||
RankingUpdated();
|
RankingUpdated();
|
||||||
|
|||||||
@@ -56,9 +56,9 @@ class MqttCore {
|
|||||||
|
|
||||||
late int _reconnectDelay = 0;
|
late int _reconnectDelay = 0;
|
||||||
|
|
||||||
late Timer? _reconnectTimer = null;
|
Timer? _reconnectTimer;
|
||||||
|
|
||||||
late Timer? _trackTimer = null;
|
Timer? _trackTimer;
|
||||||
|
|
||||||
MqttCore() {
|
MqttCore() {
|
||||||
_disconnectInProgress = false;
|
_disconnectInProgress = false;
|
||||||
|
|||||||
+29
-3
@@ -117,7 +117,7 @@ class Util {
|
|||||||
FocusNode? focusNode,
|
FocusNode? focusNode,
|
||||||
IconButton? iconButton,
|
IconButton? iconButton,
|
||||||
int? maxLines = 1,
|
int? maxLines = 1,
|
||||||
TextInputType? type,
|
TextInputType? textInputType,
|
||||||
List<TextInputFormatter>? formatter,
|
List<TextInputFormatter>? formatter,
|
||||||
Function()? onTap,
|
Function()? onTap,
|
||||||
bool? autofocus}) {
|
bool? autofocus}) {
|
||||||
@@ -135,7 +135,7 @@ class Util {
|
|||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
maxLines: maxLines,
|
maxLines: maxLines,
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
keyboardType: type,
|
keyboardType: textInputType,
|
||||||
inputFormatters: formatter,
|
inputFormatters: formatter,
|
||||||
autofocus: (autofocus != null) ? autofocus : false,
|
autofocus: (autofocus != null) ? autofocus : false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
@@ -337,4 +337,30 @@ Future<void> showAlertDialog(BuildContext context, String title, String message)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class DecimalTextInputFormatter extends TextInputFormatter {
|
||||||
|
int maxLength;
|
||||||
|
|
||||||
|
int decimalPlaces;
|
||||||
|
|
||||||
|
DecimalTextInputFormatter({required this.maxLength, required this.decimalPlaces});
|
||||||
|
|
||||||
|
@override
|
||||||
|
TextEditingValue formatEditUpdate(TextEditingValue oldValue, TextEditingValue newValue) {
|
||||||
|
var text = newValue.text;
|
||||||
|
String? filteredText = "";
|
||||||
|
|
||||||
|
if (text != "") {
|
||||||
|
RegExp regExp;
|
||||||
|
if (decimalPlaces > 0) {
|
||||||
|
regExp = RegExp(r'[0-9]+[,]{0,1}[0-9]{0,' + decimalPlaces.toString() + '}');
|
||||||
|
} else {
|
||||||
|
regExp = RegExp(r'[0-9]{0,' + maxLength.toString() +'}');
|
||||||
|
}
|
||||||
|
filteredText = regExp.stringMatch(text);
|
||||||
|
}
|
||||||
|
|
||||||
|
return TextEditingValue(text: filteredText ?? oldValue.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in new issue
Block a user