import 'package:flutter/material.dart'; import '../constants/color_constants.dart'; class InputWidget extends StatelessWidget { final String? hintText; final String? errorText; final Widget? prefixIcon; final double? height; final String? topLabel; final bool? obscureText; final FormFieldSetter? onSaved; final ValueChanged? onChanged; final FormFieldValidator? validator; final TextInputType? keyboardType; final Key? kKey; final TextEditingController? kController; final String? kInitialValue; InputWidget({ this.hintText, this.prefixIcon, this.height = 48.0, this.topLabel = "", this.obscureText = false, required this.onSaved, this.keyboardType, this.errorText, this.onChanged, this.validator, this.kKey, this.kController, this.kInitialValue, }); @override Widget build(BuildContext context) { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(this.topLabel!), SizedBox(height: 4.0), Container( height: 50, decoration: BoxDecoration( color: secondaryColor, //color: Theme.of(context).buttonColor, borderRadius: BorderRadius.circular(4.0), ), child: TextFormField( initialValue: this.kInitialValue, controller: this.kController, key: this.kKey, keyboardType: this.keyboardType, onSaved: this.onSaved, onChanged: this.onChanged, validator: this.validator, obscureText: this.obscureText!, decoration: InputDecoration( prefixIcon: this.prefixIcon, enabledBorder: OutlineInputBorder( borderSide: BorderSide( color: Color.fromRGBO(74, 77, 84, 0.2), ), ), focusedBorder: OutlineInputBorder( //gapPadding: 16, borderSide: BorderSide( color: Theme.of(context).primaryColor, ), ), errorStyle: TextStyle(height: 0, color: Colors.transparent), errorBorder: OutlineInputBorder( borderSide: BorderSide( color: Theme.of(context).errorColor, ), ), focusedErrorBorder: OutlineInputBorder( //gapPaddings: 16, borderSide: BorderSide( color: Theme.of(context).errorColor, ), ), hintText: this.hintText, hintStyle: Theme.of(context) .textTheme .bodyText1! .copyWith(color: Colors.white54), errorText: this.errorText), ), ) ], ); } }