renderSliverEffect method
Render sliver listview
if widget.scrollDirection set to Axis.horizontal
the function will render an horizontal sliver listview
else it will render a vertical listview
Implementation
Widget renderSliverEffect() {
return widget.scrollDirection == Axis.horizontal
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
verticalDirection:
widget.searchTextPosition == SearchTextPosition.top
? VerticalDirection.down
: VerticalDirection.up,
children: [
if (widget.showSearchField)
Padding(
padding: widget.searchFieldPadding ?? const EdgeInsets.all(0),
child: SizedBox(
width: widget.searchFieldWidth,
child: _buildSearchTextField(),
),
),
Expanded(
child: CustomScrollView(
scrollDirection: widget.scrollDirection,
physics: widget.physics,
controller: scrollController,
slivers: [renderSliverListView()],
),
),
],
)
: CustomScrollView(
scrollDirection: widget.scrollDirection,
physics: widget.physics,
reverse: widget.searchTextPosition == SearchTextPosition.bottom,
slivers: [
if (widget.showSearchField)
SliverAppBar(
backgroundColor: Colors.transparent,
flexibleSpace: _buildSearchTextField(),
),
renderSliverListView(),
],
);
}