gpt4 book ai didi

dart - GestureDetector onTap 卡片

转载 作者:IT王子 更新时间:2023-10-29 06:35:12 28 4
gpt4 key购买 nike

new Expanded(

child: _searchResult.length != 0 || controller.text.isNotEmpty
? new ListView.builder(
itemCount: _searchResult.length,
itemBuilder: (context, int i) {

return new Card(

child: new Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
new Row(children: <Widget>[
//new GestureDetector(),

new Container(

width: 45.0,
height: 45.0,
decoration: new BoxDecoration(
shape: BoxShape.circle,
image: new DecorationImage(
fit: BoxFit.fill,
image: new NetworkImage(
"https://raw.githubusercontent.com/flutter/website/master/_includes/code/layout/lakes/images/lake.jpg")))),
new Text(
" " +
userDetails[returnTicketDetails[i]
["user_id"]]["first_name"] +
" " +
(userDetails[returnTicketDetails[i]
["user_id"]]["last_name"]),
style: const TextStyle(
fontFamily: 'Poppins', fontSize: 20.0)),
]),
new Column(
children: <Widget>[
new Align(
alignment: FractionalOffset.topRight,
child: new FloatingActionButton(
onPressed: () {

groupId = returnTicketDetails[i]["id"];

print(returnTicketDetails[i]["id"]);
print(widget.id);

Navigator.push(
context,
new MaterialPageRoute(
builder: (context) => new Tickets(groupId,widget.id)));

},
heroTag: null,
backgroundColor: Color(0xFF53DD6C),
child: new Icon(Icons.arrow_forward),
)),
new Padding(padding: new EdgeInsets.all(3.0)),
],
)
]));
},
)
: new ListView.builder(
itemCount: _searchResult.length,
itemBuilder: (context, int i) {
return new Card(
child: new ListTile(
//title: new Text(userDetails[returnTicketDetails[i]["user_id"]]["first_name"]),
),
margin: const EdgeInsets.all(0.0),
);
},
),
),

大家好!当我在 ListView 中动态构建 Card 时,我想的不是像我已经做的那样在每个卡片中保留 FloatingActionButton,而是在每个卡片中实现一个 onTap 方法并触发一些东西。换句话说,我想让卡片尽可能简单,周围没有太多小部件。提前致谢!

最佳答案

作为Card是“一张 Material ”,您可能想使用 InkWell ,其中包括 Material 突出显示和飞溅效果,基于最接近的 Material 祖先。

return Card(
child: InkWell(
onTap: () {
// Function is executed on tap.
},
child: ..,
),
);

关于dart - GestureDetector onTap 卡片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50662428/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com