flutter_application_1/lib/widgets/input_widget.dart

68 lines
2.0 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
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: [
Text(
label,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 16,
),
),
const SizedBox(width: 5),
Tooltip(
message: tooltipText,
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),
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),
],
);
}