flutter
Add a single widget as a sliver in Flutter
Scaffold(
body: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: Container(
child: Text('This is a single widget'),
),
)
],
),
);
If you want to add a single widget or child as slivers, you can use SliverToBoxAdapter sliver widget and pass your widget as its child.
This will only add a particular widget if there is a requirement. Like if you want to add a heading before sliverlist widget you can use it for that purpose.
Was this helpful?
Similar Posts
- Add border to widget in Flutter
- Add spacing between characters of Text widget Flutter
- Simple stateless widget in Flutter
- Create stateful widget in Flutter
- Center Row widget children vertically and horizontally Flutter
- Convert text of Text widget to uppercase or lowercase in Flutter
- Pass Data to Stateless Widget in Flutter