赞
踩
一个问题:怎么让输入框贴着键盘:
可用如下方法解决
Padding(
padding: EdgeInsets.only(
bottom: MediaQuery.of(context).viewInsets.bottom
),
child: TextField(
)
)
但是想在row里面嵌套输入框
那就在textFidle外面套个Expanded
一个问题:弹窗没有状态,怎么setState:StatefulBuilder
我自己的代码
return Container( ///弹框大小 child: Column( mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( padding: EdgeInsets.only( bottom: MediaQuery.of(context).viewInsets.bottom), child: Row( children: [ Expanded( child: Container( padding: EdgeInsets.only(left: 20, right: 10), margin: EdgeInsets.only(left: 15, right: 12, bottom: 25), decoration: BoxDecoration( color: Color(0xFF2D2D2D), borderRadius: BorderRadius.circular(50)), child: TextFormField( maxLines: 1, style: const TextStyle(color: Color(0xFFFFFFFF)), controller: _Controller, focusNode: _focusNode, decoration: const InputDecoration( //去除下划线 border: InputBorder.none, hintText: "這裡還缺一條你的優質評論", hintStyle: TextStyle(color: Color(0xFF666666)), ), ), ), ), Container( height: 30, width: 30, margin: const EdgeInsets.only(bottom: 25, right: 5), decoration: const BoxDecoration( image: DecorationImage( image: AssetImage( "assets/base_widgets/icon_dynamic_details_smiley.png"), fit: BoxFit.fitWidth, ), ), ), if (canSeeButton) GestureDetector( onTap: () { _focusNode.unfocus(); }, child: Container( margin: EdgeInsets.only(left: 5, right: 10, bottom: 25), padding: EdgeInsets.only( left: 10, right: 10, top: 5, bottom: 5), decoration: BoxDecoration( color: Color(0xFFE6CFA1), borderRadius: BorderRadius.circular(8)), child: Text( "发送", style: TextStyle(fontSize: 16), ), ), ), ], ), ), ], ), );
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。