当前位置:网站首页>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)),
));
}
}
边栏推荐
- Why do programmers have the idea that code can run without moving? Is it poisonous? Or what?
- From scratch, develop a web office suite (3): mouse events
- Brush questions --- binary tree --2
- LeetCode—剑指 Offer 51. 数组中的逆序对
- 初始JDBC 编程
- Deep understanding of P-R curve, ROC and AUC
- WSL 2 will not be installed yet? It's enough to read this article
- 堆(优先级队列)
- Those logs in MySQL
- Intel internal instructions - AVX and avx2 learning notes
猜你喜欢

Interview with meituan, a 34 year old programmer, was rejected: only those under the age of 30 who work hard and earn little overtime

The blink code based on Arduino and esp8266 runs successfully (including error analysis)

深拷贝 事件总线

mysql索引和事务

记录一下MySql update会锁定哪些范围的数据

Mysql database foundation

堆(优先级队列)

Lekao.com: experience sharing of junior economists and previous candidates in customs clearance

使用Sqoop把ADS层数据导出到MySQL

寻找二叉树中任意两个数的公共祖先
随机推荐
Intel internal instructions - AVX and avx2 learning notes
CDA data analysis -- Introduction and use of aarrr growth model
刷题---二叉树--2
Leetcode739 每日温度
Differences between nodes and sharding in ES cluster
Error in kubeadm join: [error port-10250]: port 10250 is in use [error fileavailable--etc kubernetes PKI
Find the common ancestor of any two numbers in a binary tree
使用Sqoop把ADS层数据导出到MySQL
Heap (priority queue)
mysql数据库基础
Adding database driver to sqoop of cdh6
kubeadm join时出现错误:[ERROR Port-10250]: Port 10250 is in use [ERROR FileAvailable--etc-kubernetes-pki
Lekao.com: experience sharing of junior economists and previous candidates in customs clearance
Leetcode - Sword finger offer 37, 38
drools中then部分的写法
drools执行完某个规则后终止别的规则执行
Day12 control flow if switch while do While guessing numbers game
jenkins 凭证管理
Multiply LCA (nearest common ancestor)
In development, why do you find someone who is paid more than you but doesn't write any code?