BuildInputDecorationStyle typedef
BuildInputDecorationStyle =
InputDecoration Function()
create_user: zhengzaihong email:1096877329@qq.com create_date: 2022/12/30 create_time: 16:28 describe: 通用文本输入框,可内置样式,外部定义等。支持系统全部属性 ,默认自带删除按钮。 使用此组件一定要注意使用规范:输入框的高度应该由输入框自身大小所决定。当使用 于较多文本编辑时高度通过 maxLines 设置填充。而非外部容器设置虚拟高度和背景来包裹输入框(TextField)
当启用enableForm时,完成校验工作需要在你全部需要校验的输入框最外层提供 Form 布局包裹。并提供 FormState,列如: final _formKey = GlobalKey
常规简易用法: 更多内容查看 demo 源码 自定义输入框内容跟随浮窗显示基础示例: 实现 buildPop 完成自定义样式
Implementation
// InputText(
// // width: 200, //不传宽度默认填充父容器宽度
// controller: TextEditingController(),//必传参数,规避后期TextFormField 中的initValue的二义性
// hintText: "请输入手机号",
// clearIcon: const Icon(Icons.delete,size: 20,color: Colors.red),
// inputFormatters: [
// LengthLimitingTextInputFormatter(11),
// FilteringTextInputFormatter.digitsOnly
// ],
// onSubmitted: (text){
// print("---------onSubmitted:$text");
// },
// onChanged: (msg){
// print("---------onChanged:$msg");
// },
// // decoration: InputDecoration( // 自定义样式
// // hintText: "患者姓名/联系方式/证件号码",
// // hintStyle: const TextStyle(
// // fontSize: 14,
// // color: Colors.black
// // ),
// // suffixIcon: const Icon(Icons.add),
// // fillColor: Colors.purple,
// // enabledBorder: _outlineInputBorder,
// // border: _outlineInputBorder,
// // focusedBorder: _outlineInputBorder,
// // errorBorder: _outlineInputBorder,
// // focusedErrorBorder: _outlineInputBorder,
// // contentPadding: const EdgeInsets.fromLTRB(20, 20, 0, 0),
// // ),
// )
/// 自定义输入框内容跟随浮窗显示基础示例:
/// 实现 buildPop 完成自定义样式
// InputText(
// width: 300,
// margin: const EdgeInsets.only(top: 1),
// hintText: "请输入搜索歌曲名",
// inline: InlineStyle.normalStyle,
// fillColor: Colors.grey.withAlpha(40),
// cursorEnd: true,
// suffixIcon: const Icon(Icons.remove_red_eye_outlined, size: 20, color: Colors.grey),
// onChanged: (msg){
// Future.delayed(const Duration(milliseconds: 500),(){
// valueNotifier.value= "输入搜索需求:$msg";
// });
// },
// inputController: InputController(),
// controller: TextEditingController(),
// onFocusShowPop: true,
// marginTop: 5,
// popBox: PopBox(
// // height: 300,
// width: 300,
// ),
// buildPop: (context){
// ///flutter 原生方式刷新,或者你使用的状态管理刷新
// return ValueListenableBuilder<String>(
// valueListenable: valueNotifier,
// builder: (context,value,child){
// return Container(
// padding: const EdgeInsets.symmetric(horizontal: 10,vertical: 10),
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(10),
// ),
// child: Column(
// crossAxisAlignment: CrossAxisAlignment.start,
// children: [
// Text(value,style: const TextStyle(color: Colors.black,fontSize: 14),),
// const SizedBox(height: 10,),
//
// const Text('歌手:',style: TextStyle(color: Colors.black,fontSize: 16),),
// const SizedBox(height: 10,),
// Wrap(
// runSpacing: 10,
// spacing: 10,
// children: [
// ...'张国荣,王力宏,周杰伦,林俊杰,陈奕迅,薛之谦,周笔畅,刘德华'.split(',').map((e) => ActionChip(
// backgroundColor: Colors.grey.withOpacity(0.1),
// label: Text(e),
// onPressed: () {
// },
// )).toList()
// ],
// ),
// const SizedBox(height: 20,),
// const Text('热门歌曲:',style: TextStyle(color: Colors.black,fontSize: 16),),
// const SizedBox(height: 10,),
// Wrap(
// runSpacing: 10,
// spacing: 10,
// children: [
// ...'七里香,青花,白色风车,画沙,一个人,一千个彩虹'.split(',').map((e) => ActionChip(
// backgroundColor: Colors.grey.withOpacity(0.1),
// label: Text(e),
// onPressed: () {
// },
// )).toList()
// ],
// ),
//
// ],
// ),
// );
// });
// },
// ),
typedef BuildInputDecorationStyle = InputDecoration Function();