大佬教程收集整理的这篇文章主要介绍了如何在 Flutter 中获取 gridview 索引?,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
@overrIDe
ScrollController _controller = ScrollController();
Widget build(BuildContext context) {
return Scaffold(
body: new Container(
child: padding(
padding: EdgeInsets.only(top: 20,bottom: 20),child: DraggableScrollbar.semicircle(
controller: _controller,child: GrIDVIEw.builder(
controller: _controller,grIDDelegate: SliverGrIDDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,),padding: EdgeInsets.zero,itemCount: 8,itemBuilder: (context,indeX){
return Stack(
children: <Widget>[
new Container(
margin: EdgeInsets.all(1.0),color: colors.greY[200],child: new Image.network(
globals.images[index],// size setTing
)
),new Align(
alignment: Alignment.bottomleft,child: Container(
child: column(
children: <Widget>[
Flexible(
fit: FlexFit.tight,child: Row(
mainAxisSize: MainAxisSize.min,crossAxisAlignment: CrossAxisAlignment.start,children: <Widget>[
Expanded(
child: new Down(),Expanded(
child: new comment(),Expanded(
child: new star()
)
],]
)
)
)
]
);
}
),)
)
);
}
}
class _StarC extends State<star> {
@overrIDe
Widget build(BuildContext context) {
return new likebutton(
// color setTing
),likeBuilder: (bool isliked) {
return Icon(
isliked? Icons.star_rounded : Icons.star_border_rounded,color: isliked ? colors.orangeAccent : colors.grey,size: 34,);
},onTap: onlikebuttonTapped,);
}
}
Future<bool> onlikebuttonTapped(bool isliked) async{
isliked ? globals.falist.removeAt(0) : globals.falist.insert(0,globals.images[1]) ;
return !isliked;
}
@H_801_2@我正在制作图库应用程序并且知道
我尝试将 globals.falist.insert(0,globals.images[index]) instead of globals.falist.insert(0,globals.images[1])
与维护代码一起使用两天......有人知道怎么做吗?请帮我! * 我使用了 this 包 likebutton。 (对不起,我的英语不好...)
Expanded(
child: new star()
)
Future<bool> onLikeButtonTapped(bool isLiked) async{
isLiked ? globals.falist.removeAt(0) : globals.falist.insert(0,globals.images[1]) ;
return !isLiked;
}
@H_801_2@变化↓
Expanded(
child: new LikeButton(
//color setTing
),likeBuilder: (bool isLiked) {
return Icon(
isLiked? Icons.star_rounded : Icons.star_border_rounded,color: isLiked ? Colors.orangeAccent : Colors.grey,size: 34,);
},onTap: (bool isLiked) {
return onLikeButtonTapped(isLiked,indeX);
},)
)
Future<bool> onLikeButtonTapped(bool isLiked,id) async{
isLiked ? globals.falist.remove(globals.images[id]) : globals.falist.insert(0,globals.images[id]);
return !isLiked;
}
@H_801_2@它有效,但我认为这不是最佳答案...
因此,如果您有任何想法,请在此处发布!谢谢。以上是大佬教程为你收集整理的如何在 Flutter 中获取 gridview 索引?全部内容,希望文章能够帮你解决如何在 Flutter 中获取 gridview 索引?所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。