2024-05-06 17:28:10 +02:00
|
|
|
import 'package:flutter/cupertino.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2024-05-24 14:04:26 +02:00
|
|
|
// Erstellt ein Widget für die Eingabe mit einem Label, einem Texteingabefeld, einer Validierungsanzeige und einem Tooltip
|
2024-05-06 17:28:10 +02:00
|
|
|
Widget buildInputWidget(String label, TextEditingController controller, FocusNode focusNode, bool isValid, String suffixText, String tooltipText) {
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
children: [
|
2024-05-24 14:04:26 +02:00
|
|
|
// Label für das Eingabefeld
|
2024-05-06 17:28:10 +02:00
|
|
|
Text(
|
|
|
|
label,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontSize: 16,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(width: 5),
|
2024-05-24 14:04:26 +02:00
|
|
|
// Tooltip-Icon mit Erklärungstext
|
2024-05-06 17:28:10 +02:00
|
|
|
Tooltip(
|
|
|
|
message: tooltipText,
|
2024-05-20 16:34:31 +02:00
|
|
|
triggerMode: TooltipTriggerMode.tap,
|
|
|
|
decoration: const BoxDecoration(
|
|
|
|
color: CupertinoColors.black,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(5))
|
|
|
|
),
|
|
|
|
textStyle: const TextStyle(
|
|
|
|
color: CupertinoColors.white,
|
|
|
|
),
|
|
|
|
margin: const EdgeInsets.all(20),
|
2024-05-06 17:28:10 +02:00
|
|
|
child: const Icon(CupertinoIcons.question_circle_fill, size: 15),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2024-05-24 14:04:26 +02:00
|
|
|
// Icon zur Anzeige der Validierung (grün für gültig, rot für ungültig)
|
2024-05-06 17:28:10 +02:00
|
|
|
isValid
|
|
|
|
? const Icon(
|
|
|
|
CupertinoIcons.check_mark_circled_solid,
|
|
|
|
color: CupertinoColors.systemGreen,
|
|
|
|
size: 15,
|
|
|
|
)
|
|
|
|
: const Icon(
|
|
|
|
CupertinoIcons.clear_circled_solid,
|
|
|
|
color: CupertinoColors.systemRed,
|
|
|
|
size: 15,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
const SizedBox(height: 5),
|
2024-05-24 14:04:26 +02:00
|
|
|
// Texteingabefeld mit Suffix-Text
|
2024-05-06 17:28:10 +02:00
|
|
|
CupertinoTextField(
|
|
|
|
controller: controller,
|
|
|
|
focusNode: focusNode,
|
|
|
|
keyboardType: TextInputType.number,
|
|
|
|
suffix: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(horizontal: 5.0),
|
|
|
|
child: Text(
|
|
|
|
suffixText,
|
|
|
|
style: const TextStyle(
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: CupertinoColors.extraLightBackgroundGray,
|
|
|
|
borderRadius: BorderRadius.circular(5),
|
|
|
|
),
|
|
|
|
cursorColor: CupertinoColors.black,
|
|
|
|
),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|