如何将自定义子滚动视图 silverlist 中的元素居中?
return CustomScrollView(
physics: BouncingScrollPhysics(),
slivers: <Widget>[
SliverList(
delegate: SliverChildListDelegate([
SizedBox(height: widget.height),
HeaderTitle("Hello there"),
(data.length == 0)
? Center(
child: Container(
// padding: EdgeInsets.fromLTRB(0, 150, 0, 0),
child: Column(
children: [
Text("No Data Yet"),
OutlineButton(
onPressed: () {
Navigator.of(context).pop();
},
textColor: Colors.black,
child: Text("Do Something"),
),
],
),
),
)
: Container()
])),
SliverGrid(
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
childAspectRatio: 10.0 / 10.0,
crossAxisCount: 2,
),
delegate:
SliverChildBuilderDelegate((BuildContext context, int index) {
return CastCard(data[index], null);
}, childCount: data.length),
),
],
); …Run Code Online (Sandbox Code Playgroud)