From eae9aaf32e0c7267c5dc82e65daff42ebb5eefac Mon Sep 17 00:00:00 2001 From: junior Vasquez Date: Tue, 21 Jan 2020 17:42:03 -0300 Subject: [PATCH] fix multiples footer --- lib/loadany_widget.dart | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/loadany_widget.dart b/lib/loadany_widget.dart index 13d829f..9920bf7 100644 --- a/lib/loadany_widget.dart +++ b/lib/loadany_widget.dart @@ -38,6 +38,8 @@ class LoadAny extends StatefulWidget { ///底部 loadmore 高度 final double footerHeight; + final Key _KEY_LAST_ITEM = Key("__LAST_ITEM"); + LoadAny({ @required this.status, @required this.child, @@ -56,8 +58,16 @@ class _LoadAnyState extends State { @override Widget build(BuildContext context) { ///添加 Footer Sliver + dynamic check = + widget.child.slivers.elementAt(widget.child.slivers.length - 1); + + if (check is SliverSafeArea && check.key == widget._KEY_LAST_ITEM) { + widget.child.slivers.removeLast(); + } + widget.child.slivers.add( SliverSafeArea( + key: widget._KEY_LAST_ITEM, top: false, left: false, right: false,