当前位置:网站首页>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)),
));
}
}
边栏推荐
- Initial JDBC programming
- Codeforces 771-div2 C (trouble, permutation is not very good)
- Simple understanding of ThreadLocal
- From scratch, develop a web office suite (3): mouse events
- CDA数据分析——Excel数据处理的常见知识点归纳
- Intel 内部指令 --- AVX和AVX2学习笔记
- Intel internal instructions - AVX and avx2 learning notes
- The second composition template of postgraduate entrance examination English / chart composition, English chart composition is enough
- 记录一下MySql update会锁定哪些范围的数据
- Docker compose configuration mysql, redis, mongodb
猜你喜欢

Drools dynamically add, modify, and delete rules

CDH6之Sqoop添加数据库驱动

(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?

Performance tuning project case

初始JDBC 编程

This "little routine" is set on the dough cake of instant noodles. No wonder programmers are always hungry

Deep understanding of P-R curve, ROC and AUC

SparkContext: Error initializing SparkContext解决方法

Brush questions --- binary tree --2

Sweetheart leader: Wang Xinling
随机推荐
LeetCode—<动态规划专项>剑指 Offer 19、49、60
ThreadLocal的简单理解
High performance erasure code coding
(C语言)输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数。
高德地图测试用例
Use sqoop to export ads layer data to MySQL
Is the neural network (pinn) with embedded physical knowledge a pit?
Jenkins voucher management
PyTorch nn. Full analysis of RNN parameters
分布式机器学习框架与高维实时推荐系统
CDA数据分析——AARRR增长模型的介绍、使用
(C语言)3个小代码:1+2+3+···+100=?和判断一个年份是闰年还是平年?和计算圆的周长和面积?
堆(優先級隊列)
Maximum profit of jz63 shares
CPU指令集介绍
Drools executes the specified rule
Full link voltage measurement
Leetcode122 the best time to buy and sell stocks II
Tas (file d'attente prioritaire)
Go learning notes - go based interprocess communication