fix textfield width

This commit is contained in:
2025-06-05 16:04:14 +02:00
parent 3d1976d776
commit 7d663f3b96

View File

@@ -84,7 +84,10 @@ class _MihTextFormFieldState extends State<MihTextFormField> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Theme( return SizedBox(
width: widget.width,
height: widget.height,
child: Theme(
data: Theme.of(context).copyWith( data: Theme.of(context).copyWith(
textSelectionTheme: TextSelectionThemeData( textSelectionTheme: TextSelectionThemeData(
selectionColor: widget.inputColor.withValues(alpha: 0.3), selectionColor: widget.inputColor.withValues(alpha: 0.3),
@@ -136,8 +139,8 @@ class _MihTextFormFieldState extends State<MihTextFormField> {
borderRadius: borderRadius:
BorderRadius.circular(widget.borderRadius ?? 8.0), BorderRadius.circular(widget.borderRadius ?? 8.0),
child: SizedBox( child: SizedBox(
width: widget.width, height:
height: widget.height, widget.height != null ? widget.height! - 25 : null,
child: TextFormField( child: TextFormField(
controller: widget.controller, controller: widget.controller,
cursorColor: widget.inputColor, cursorColor: widget.inputColor,
@@ -146,8 +149,9 @@ class _MihTextFormFieldState extends State<MihTextFormField> {
textAlignVertical: widget.multiLineInput == true textAlignVertical: widget.multiLineInput == true
? TextAlignVertical.top ? TextAlignVertical.top
: TextAlignVertical.center, : TextAlignVertical.center,
obscureText: obscureText: widget.passwordMode == true
widget.passwordMode == true ? _obscureText : false, ? _obscureText
: false,
expands: widget.passwordMode == true expands: widget.passwordMode == true
? false ? false
: (widget.multiLineInput ?? false), : (widget.multiLineInput ?? false),
@@ -265,6 +269,7 @@ class _MihTextFormFieldState extends State<MihTextFormField> {
), ),
], ],
), ),
),
); );
} }
} }