Chrome Extension

Add a single widget as a sliver in Flutter

Scaffold(
  body: CustomScrollView(
    slivers: <Widget>[
      SliverToBoxAdapter(
        child: Container(
          child: Text('This is a single widget'),
        ),
      )
    ],
  ),
);
Best JSON Validator, JSON Tree Viewer, JSON Beautifier at same place. Check how cool is the tool

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.

Search Index Data (The code snippet can also be found with below search text)

Add a single text or container as sliver in Flutter
Was this helpful?
0 Comments
Join Devsheet Ask a Question