TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.orange,
),
labelText: 'email',),
onChanged: (v) {
_emailV = v;
},
);
GestureDetector(
onTap: () {},
child: Container(
child: Text(
'emaaail',
)),
);
我在Column(). 當用戶完成輸入電子郵件地址并按 時done,我希望應用程式執行GestureDetector - onTap()功能。
我嘗試過使用背景關系和內容,但沒有按預期作業。所以,我想知道是否有任何東西可以使這個作業?
uj5u.com熱心網友回復:
創建一個函式
// depending on your needs
void onTapFunction(){
...
}
將函式添加到手勢部分的 onTap
GestureDetector(
onTap: onTapFunction,
child: Container(
child: Text(
'emaaail',
)),
);
將函式添加到 TextFormField 部分中的 onEditingComplete
TextFormField(
decoration: InputDecoration(
prefixIcon: Icon(
Icons.email_outlined,
color: Colors.orange,
),
labelText: 'email',),
onChanged: (v) {
_emailV = v;
},
onEditingComplete: onTapFunction,
);
uj5u.com熱心網友回復:
如果您只想執行 ontap 函式,則應該嘗試 Inkwell() 而不是 GestureDetector();
Inkwell(
onTap: () {
//write your function
},
child: Container(
child: Text(
'emaaail',
)),
);
)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qukuanlian/421132.html
標籤:
