Erweiterungen

This commit is contained in:
Sven committed 2024-02-14 15:54:46 +01:00
1 parent 98581c9a39
commit f9ee90d861
12 files changed
+59 -23

No files matched your search

@@ -35,7 +35,7 @@ showComissionNumberPopup(BuildContext context, TaskInfo taskInfo, Function(Strin
const Text('Bitte geben Sie die Kommisionsnummer ein'),
const SizedBox(height: 20),
Util.getDefaultTextField('Kommisionsnummer',
type: TextInputType.text,
textInputType: TextInputType.text,
formatter: [FilteringTextInputFormatter.singleLineFormatter],
controller: textEditingController,
autofocus: true),
@@ -35,7 +35,7 @@ showReceiptGiverPopup(BuildContext context, TaskInfo taskInfo, Function(String)
Text(taskInfo.task.topic),
const SizedBox(height: 20),
Util.getDefaultTextField(taskInfo.task.topic,
type: TextInputType.text,
textInputType: TextInputType.text,
formatter: [FilteringTextInputFormatter.singleLineFormatter],
controller: textEditingController,
autofocus: true),
@@ -37,7 +37,7 @@ showStationNoticePopup(BuildContext context, TaskInfo taskInfo, Function(String)
SizedBox(
height: 100,
child: Util.getDefaultTextField(taskInfo.task.topic,
type: TextInputType.text,
textInputType: TextInputType.text,
maxLines: 10,
formatter: [FilteringTextInputFormatter.singleLineFormatter],
controller: textEditingController,
+23 -9
View File
@@ -1,6 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:stadtbote/model/task_info.dart';
import 'package:stadtbote/tools/util.dart';
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),
child: Column(
children: [
Text(text, style: TextStyle(fontWeight: FontWeight.bold)),
Text(text, style: const TextStyle(fontWeight: FontWeight.bold)),
const SizedBox(height: 20),
Util.getDefaultTextField('Postleitzahl',
type: TextInputType.text,
formatter: [FilteringTextInputFormatter.singleLineFormatter],
formatter: [DecimalTextInputFormatter(maxLength: 5, decimalPlaces: 0)],
textInputType: const TextInputType.numberWithOptions(signed: true, decimal: true),
controller: textEditingController,
autofocus: true),
const SizedBox(height: 20),
getDefaultButton(buttonText, () => {
Navigator.of(context).pop(),
onFinished(textEditingController.text)})
getDefaultButton(
buttonText,
() => {
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;
}