Files
game-tracker/lib/presentation/widgets/text_input/text_input_field.dart
Mathis Kirchner 7024699a61
All checks were successful
Pull Request Pipeline / test (pull_request) Successful in 2m53s
Pull Request Pipeline / lint (pull_request) Successful in 3m3s
implement create game view
2026-01-18 14:38:27 +01:00

67 lines
2.3 KiB
Dart

import 'package:flutter/material.dart';
import 'package:game_tracker/core/custom_theme.dart';
class TextInputField extends StatelessWidget {
/// A custom text input field widget that encapsulates a [TextField] with specific styling.
/// - [controller]: The controller for the text input field.
/// - [onChanged]: Optional callback invoked when the text in the field changes.
/// - [hintText]: The hint text displayed in the text input field when it is empty
/// - [maxLength]: Optional parameter for maximum length of the input text.
/// - [maxLines]: The maximum number of lines for the text input field. Defaults to 1.
/// - [minLines]: The minimum number of lines for the text input field. Defaults to 1.
const TextInputField({
super.key,
required this.controller,
required this.hintText,
this.onChanged,
this.maxLength,
this.maxLines = 1,
this.minLines = 1
});
/// The controller for the text input field.
final TextEditingController controller;
/// Optional callback invoked when the text in the field changes.
final ValueChanged<String>? onChanged;
/// The hint text displayed in the text input field when it is empty.
final String hintText;
/// Optional parameter for maximum length of the input text.
final int? maxLength;
/// The maximum number of lines for the text input field.
final int? maxLines;
/// The minimum number of lines for the text input field.
final int? minLines;
@override
Widget build(BuildContext context) {
return TextField(
controller: controller,
onChanged: onChanged,
maxLength: maxLength,
maxLines: maxLines,
minLines: minLines,
decoration: InputDecoration(
filled: true,
fillColor: CustomTheme.boxColor,
hintText: hintText,
hintStyle: const TextStyle(fontSize: 18),
enabledBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(12)),
borderSide: BorderSide(color: CustomTheme.boxBorder),
),
focusedBorder: OutlineInputBorder(
borderRadius: const BorderRadius.all(Radius.circular(12)),
borderSide: BorderSide(color: CustomTheme.boxBorder),
),
floatingLabelBehavior: FloatingLabelBehavior.never,
),
);
}
}