import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class InteractionTextField extends StatelessWidget { String labelText; TextEditingController controller; String? hintText; IconButton? suffixIcon; bool? enabled = true; bool? obscure = false; Function onChanged; TextInputType? inputType; int? maxchars = 0; int? maxlines = 1; int? minlines = 0; InteractionTextField( {super.key, required this.controller, this.hintText, required this.labelText, this.suffixIcon, this.enabled, this.maxchars, this.maxlines, this.inputType, this.minlines, required this.onChanged, this.obscure}); @override Widget build(BuildContext context) { return TextField( controller: controller, style: const TextStyle(fontSize: 16), enabled: enabled, obscureText: obscure ?? false, onTap: () {}, maxLines: maxlines ?? 1, minLines: minlines, keyboardType: inputType ?? TextInputType.name, onChanged: (value) { onChanged(value); }, inputFormatters: [ inputType == TextInputType.number ? FilteringTextInputFormatter.digitsOnly : maxchars == 0 ? LengthLimitingTextInputFormatter(100) : LengthLimitingTextInputFormatter(maxchars), ], decoration: InputDecoration( border: OutlineInputBorder( borderRadius: BorderRadius.circular(10.0), ), // labelStyle: const TextStyle(fontSize: 16), // labelText: labelText, // hintStyle: const TextStyle(fontSize: 16), suffixIcon: suffixIcon, hintText: hintText), ); } }