[英]Slider in Flutter
我想制作與照片中相同的 slider。 什么是圓形按鈕。 我使用了flutter_slidable
插件,但它不起作用或者我做錯了什么?
下面是我試圖做的代碼
Slidable(
endActionPane: ActionPane(
motion: const DrawerMotion(),
children: [
SlidableAction(
onPressed: (BuildContext context) {},
borderRadius:
BorderRadius.all(Radius.circular(180)),
backgroundColor: const Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
),
SlidableAction(
onPressed: (BuildContext context) {},
borderRadius: BorderRadius.circular(180),
backgroundColor: const Color(0xFFFE4A49),
foregroundColor: Colors.white,
icon: Icons.delete,
),
],
),
child: ListTile(
title: Text("Text",
style: const TextStyle(fontSize: 18)),
subtitle: Text("Text2"),
onTap: () {
}));
試試我寫的這段代碼,它完全按照你想要的方式工作:
Scaffold(
backgroundColor: Color(0xffF3F3F6),
body: Center(
child: Slidable(
key: const ValueKey(0),
startActionPane: ActionPane(
motion: const ScrollMotion(),
children: [
Expanded(
child: Container(
color: Colors.transparent,
child: RawMaterialButton(
onPressed: () {},
elevation: 2.0,
fillColor: Colors.red,
child: Icon(
Icons.favorite,
),
padding: EdgeInsets.all(12.0),
shape: CircleBorder(),
),
)),
Expanded(
child: Container(
color: Colors.transparent,
child: RawMaterialButton(
onPressed: () {},
elevation: 2.0,
fillColor: Colors.red,
child: Icon(
Icons.favorite,
),
padding: EdgeInsets.all(12.0),
shape: CircleBorder(),
))),
],
),
child: const ListTile(
title: Text('Slide me'),
tileColor: Colors.white,
),
),
),
);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.