buildSliverScaffold method
Implementation
@protected
Widget buildSliverScaffold(BuildParameters params) {
final props = params.spec.props;
final widgets = params.spec.widgets;
List<Widget>? persistentFooterButtons;
if (widgets["persistentFooterButtons"] != null) {
persistentFooterButtons = <Widget>[];
for (Map childSpec in widgets["persistentFooterButtons"] as List<Map>) {
persistentFooterButtons.add(builder.buildWidget(
params.context, childSpec, params.state, params.parentContext));
}
}
final appBar = builder.tryBuildWidget(
params.context, widgets["appBar"], params.state, params.parentContext);
final bottomSheet = builder.tryBuildWidget(params.context,
widgets["bottomSheet"], params.state, params.parentContext);
final bottomNavigationBar = builder.tryBuildWidget(params.context,
widgets["bottomNavigationBar"], params.state, params.parentContext);
final floatingActionButton = builder.tryBuildWidget(params.context,
widgets["floatingActionButton"], params.state, params.parentContext);
final drawer = builder.tryBuildWidget(
params.context, widgets["drawer"], params.state, params.parentContext);
final children = <Widget>[];
if (params.widgets["children"] != null) {
for (Map childSpec in params.widgets["children"] as List<Map>) {
children.add(builder.buildWidget(
params.context, childSpec, params.state, params.parentContext));
}
}
final scrollView = CustomScrollView(
key: properties.getKey(params.id),
reverse: parseBool(params.props["reverse"]),
shrinkWrap: parseBool(params.props["shrinkWrap"]),
scrollDirection: params.buildProp("scrollDirection") ?? Axis.vertical,
keyboardDismissBehavior: params.buildProp("keyboardDismissBehavior") ??
ScrollViewKeyboardDismissBehavior.manual,
slivers: [
if (appBar != null) appBar,
SliverList(delegate: SliverChildListDelegate(children)),
],
);
Widget widget = Scaffold(
key: properties.getKey(params.id),
backgroundColor: tryParseColor(props["backgroundColor"]),
body: scrollView,
bottomSheet: bottomSheet,
bottomNavigationBar: bottomNavigationBar,
floatingActionButton: floatingActionButton,
persistentFooterButtons: persistentFooterButtons,
drawer: drawer,
extendBody: parseBool(props["extendBody"]),
extendBodyBehindAppBar: parseBool(props["extendBodyBehindAppBar"]),
floatingActionButtonLocation:
params.buildProp("floatingActionButtonLocation"),
);
if (props["tabController"] != null) {
widget = DefaultTabController(
length: parseInt(props["tabController"]["length"]),
initialIndex: parseInt(props["tabController"]["initialIndex"]),
child: widget,
);
}
return widget;
}