From 346db3545d1f275463cd6fb4f79a96c6fa140817 Mon Sep 17 00:00:00 2001 From: Weller <1812208341@qq.com> Date: Mon, 14 Sep 2020 11:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=A1=B5=E9=9D=A2=E7=94=9F?= =?UTF-8?q?=E6=88=90=E5=AF=BC=E8=87=B4=E6=98=BE=E7=A4=BA=E9=94=99=E8=AF=AF?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/util/widget_factory.dart | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/util/widget_factory.dart b/lib/util/widget_factory.dart index efe3cd0..9820b11 100644 --- a/lib/util/widget_factory.dart +++ b/lib/util/widget_factory.dart @@ -37,7 +37,7 @@ class WidgetFactory { creater = widgetCreaters[name]; List result = []; // if (type == WidgetType.normal) - result = creater.createWidgets(model); + result = creater.createWidgets(model); // else // result = creater.createSkeleton(model); if (isSliver) { @@ -50,21 +50,29 @@ class WidgetFactory { } } else { if (creater.isSliverChild()) { - return _createEmpty(); + return _createEmpty(isSliver); } else { return result; } } } - return _createEmpty(); + return _createEmpty(isSliver); } - static List _createEmpty() { + static List _createEmpty(bool isSliver) { const bool inProduction = const bool.fromEnvironment("dart.vm.product"); if (!inProduction) { - return []; + return isSliver + ? [ + SliverToBoxAdapter( + child: Container(), + ) + ] + : []; } else { - return [EmptyPage()]; + return isSliver + ? [SliverToBoxAdapter(child: EmptyPage())] + : [EmptyPage()]; } }