Browse Source

修复页面生成导致显示错误bug

tags/0.0.1
Weller 4 years ago
parent
commit
346db3545d
1 changed files with 14 additions and 6 deletions
  1. +14
    -6
      lib/util/widget_factory.dart

+ 14
- 6
lib/util/widget_factory.dart View File

@@ -37,7 +37,7 @@ class WidgetFactory {
creater = widgetCreaters[name]; creater = widgetCreaters[name];
List<Widget> result = []; List<Widget> result = [];
// if (type == WidgetType.normal) // if (type == WidgetType.normal)
result = creater.createWidgets(model);
result = creater.createWidgets(model);
// else // else
// result = creater.createSkeleton(model); // result = creater.createSkeleton(model);
if (isSliver) { if (isSliver) {
@@ -50,21 +50,29 @@ class WidgetFactory {
} }
} else { } else {
if (creater.isSliverChild()) { if (creater.isSliverChild()) {
return _createEmpty();
return _createEmpty(isSliver);
} else { } else {
return result; return result;
} }
} }
} }
return _createEmpty();
return _createEmpty(isSliver);
} }


static List<Widget> _createEmpty() {
static List<Widget> _createEmpty(bool isSliver) {
const bool inProduction = const bool.fromEnvironment("dart.vm.product"); const bool inProduction = const bool.fromEnvironment("dart.vm.product");
if (!inProduction) { if (!inProduction) {
return [];
return isSliver
? [
SliverToBoxAdapter(
child: Container(),
)
]
: [];
} else { } else {
return [EmptyPage()];
return isSliver
? [SliverToBoxAdapter(child: EmptyPage())]
: [EmptyPage()];
} }
} }




Loading…
Cancel
Save