80 lines
2.6 KiB
Dart
80 lines
2.6 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
// Funktion zum Erstellen eines Eingabe-Widgets
|
|
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: [
|
|
// Zeile für das Label und den Tooltip
|
|
Row(
|
|
children: [
|
|
Row(
|
|
children: [
|
|
Text(
|
|
label,
|
|
style: const TextStyle(
|
|
fontWeight: FontWeight.bold,
|
|
fontSize: 16,
|
|
),
|
|
),
|
|
const SizedBox(width: 5),
|
|
Tooltip(
|
|
message: tooltipText,
|
|
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),
|
|
child: const Icon(CupertinoIcons.question_circle_fill, size: 15),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
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),
|
|
// Textfeld für die Eingabe
|
|
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),
|
|
],
|
|
);
|
|
}
|