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