flutter之Dismissible组件


/**
* 滑动删除
*
* const Dismissible({
@required Key key,//
@required this.child,//
this.background,
//滑动时组件下一层显示的内容,没有设置secondaryBackground时,从右往左或者从左往右滑动都显示该内容,设置了secondaryBackground后,从左往右滑动显示该内容,从右往左滑动显示secondaryBackground的内容
//secondaryBackground不能单独设置,只能在已经设置了background后才能设置,从右往左滑动时显示
this.secondaryBackground,//
this.onResize,//组件大小改变时回调
this.onDismissed,//组件消失后回调
this.direction = DismissDirection.horizontal,//
this.resizeDuration = const Duration(milliseconds: 300),//组件大小改变的时长
this.dismissThresholds = const <DismissDirection, double>{},//
this.movementDuration = const Duration(milliseconds: 200),//组件消失的时长
this.crossAxisEndOffset = 0.0,//
})
*/


Dismissible(
key: Key('a${index}'),
secondaryBackground: Container(
child: Text('左滑删除', style: TextStyle(fontSize: Screen.width(32), color: Colors.white)),
color: Colors.red,
padding: EdgeInsets.only(right: Screen.width(10)),
alignment: Alignment.centerRight,
),
background: Container(
child: Text('右滑删除', style: TextStyle(fontSize: Screen.width(32), color: Colors.white)),
color: Colors.red,
padding: EdgeInsets.only(left: Screen.width(10)),
alignment: Alignment.centerLeft,
),
onDismissed: (direction) {
print('onDismissed');
},
child:
),


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM