提问人:Rock 提问时间:1/29/2022 最后编辑:Rock 更新时间:1/29/2022 访问量:484
Flutter - Slideble 小部件如何以编程方式打开和关闭
Flutter - Slideble widget how to open and close programatically
问:
当用户导航到页面时,如何以编程方式打开和关闭 slideble 小部件。
我想向用户展示小部件是可滑动的,当用户在左侧滑动时有两个选项。因此,当页面打开时,我需要可滑动的自动打开和关闭
这是我的源代码:
Slidable(
endActionPane: ActionPane(
extentRatio: 0.18,
motion: const BehindMotion(),
children: [
Expanded(
child: Column(
children: [
Expanded(
child: InkWell(
onTap: () => Get.find<BookController>().saveBookMark(),
child: Container(
decoration: const BoxDecoration(
borderRadius: BorderRadius.only(
topRight: Radius.circular(10),
),
color: AppColors.primary),
child: Center(
child: Icon(
isBookMarked ? Icons.bookmark : Icons.bookmark_outline_rounded,
color: Colors.white,
),
),
),
),
),
const SizedBox(height: 2),
Expanded(
child: InkWell(
onTap: shareOnTap,
child: Container(
decoration: const BoxDecoration(borderRadius: BorderRadius.only(bottomRight: Radius.circular(10)), color: AppColors.primary),
child: const Center(
child: Icon(
Icons.share_outlined,
color: Colors.white,
),
),
),
),
),
],
),
)
],
),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 15),
constraints: const BoxConstraints(minHeight: 100),
decoration: BoxDecoration(
color: Theme.of(context).canvasColor,
borderRadius: BorderRadius.circular(10),
),
child: Container()
),
);
答: 暂无答案
评论