当前位置:网站首页>Input box assembly of the shutter package
Input box assembly of the shutter package
2022-07-02 12:28:00 【Xiao Er Li】
class LoginInput extends StatefulWidget {
final String title;
final String hint;
final ValueChanged<String> onChanged; // Input the callback in the input box
final ValueChanged<bool> focusChanged; // Get focus callback
final bool lineStretch; // Whether extensibility is supported
final bool obscureText; //
final TextInputType keyboardType; // Input type
LoginInput(this.title, this.hint,
{
Key key,
this.onChanged,
this.focusChanged,
this.lineStretch,
this.obscureText,
this.keyboardType})
: super(key: key);
@override
_LoginInputState createState() => _LoginInputState();
}
class _LoginInputState extends State<LoginInput> {
final _focusNode = FocusNode();
@override
void initState() {
super.initState();
// Whether to get cursor monitoring
_focusNode.addListener(() {
print("Has focus: ${_focusNode.hasFocus}");
// Callback the input box to get focus
widget.focusChanged(_focusNode.hasFocus);
});
}
@override
void dispose() {
super.dispose();
// Cancel getting focus
_focusNode.dispose();
}
@override
Widget build(BuildContext context) {
return Column(
children: [
Row(
children: [
Container(
padding: EdgeInsets.only(left: 15),
width: 100,
child: Text(
widget.title,
style: TextStyle(fontSize: 16),
),
),
_input(),
],
),
Padding(
padding: EdgeInsets.only(left: !widget.lineStretch ? 15 : 0),
child: Divider(
// line
height: 1,
thickness: 0.5, // The thickness of the thread
),
),
],
);
}
_input() {
return Expanded(
child: TextField(
focusNode: _focusNode,
onChanged: widget.onChanged,
// Input box content change callback
obscureText: widget.obscureText,
// Whether to hide the input text , Common words input password
keyboardType: widget.keyboardType,
// Input type
autofocus: !widget.obscureText,
// Get focus automatically
cursorColor: primary,
// Cursor color
style: TextStyle(
fontSize: 16, color: Colors.black, fontWeight: FontWeight.w300),
decoration: InputDecoration(
// Input text decoration
contentPadding: EdgeInsets.only(left: 20, right: 20), // padding
border: InputBorder.none, // Do not display the input box border
hintText: widget.hint ?? '',
hintStyle: TextStyle(fontSize: 15, color: Colors.grey)),
));
}
}
边栏推荐
- Embedded Software Engineer career planning
- The differences and relationships among port, targetport, nodeport and containerport in kubenetes
- ThreadLocal的简单理解
- Leetcode122 the best time to buy and sell stocks II
- CDH存在隐患 : 该角色的进程使用的交换内存为xx兆字节。警告阈值:200字节
- [FFH] little bear driver calling process (take calling LED light driver as an example)
- CONDA common command summary
- 记录一下MySql update会锁定哪些范围的数据
- 甜心教主:王心凌
- 输入一个三位的数字,输出它的个位数,十位数、百位数。
猜你喜欢
Distributed machine learning framework and high-dimensional real-time recommendation system
[C language] convert decimal numbers to binary numbers
mysql索引和事务
防抖 节流
(C语言)3个小代码:1+2+3+···+100=?和判断一个年份是闰年还是平年?和计算圆的周长和面积?
CDA data analysis -- Introduction and use of aarrr growth model
drools中then部分的写法
PyTorch nn. Full analysis of RNN parameters
CONDA common command summary
AI中台技术调研
随机推荐
kubeadm join时出现错误:[ERROR Port-10250]: Port 10250 is in use [ERROR FileAvailable--etc-kubernetes-pki
Simple use of drools decision table
刷题---二叉树--2
MySQL indexes and transactions
记录一下MySql update会锁定哪些范围的数据
Experiment of connecting mobile phone hotspot based on Arduino and esp8266 (successful)
CV2 in OpenCV VideoWriter_ Fourcc() function and cv2 Combined use of videowriter() function
post请求体内容无法重复获取
甜心教主:王心凌
When uploading a file, the server reports an error: iofileuploadexception: processing of multipart / form data request failed There is no space on the device
[C language] convert decimal numbers to binary numbers
Day12 control flow if switch while do While guessing numbers game
Heap (priority queue)
Jenkins用户权限管理
使用Sqoop把ADS层数据导出到MySQL
Lombok common annotations
drools执行String规则或执行某个规则文件
字符串回文hash 模板题 O(1)判字符串是否回文
子线程获取Request
(C language) 3 small Codes: 1+2+3+ · · +100=? And judge whether a year is a leap year or a normal year? And calculate the circumference and area of the circle?