小编Wil*_*ndi的帖子

在使用浮动appbar创建应用时使用StreamBuilder

这是使用浮动appbar构建应用的代码:

 @override
Widget build(BuildContext context) {
return new Scaffold(
  body: new CustomScrollView(slivers: <Widget>[
    new SliverAppBar(
      title: new Text('Sliver App Bar'),
      floating: true,
      snap: true,
      bottom: PreferredSize(
        preferredSize: const Size.fromHeight(90.0),
        child: new Text('dddd'),
      ),
    ),
    new SliverList(
        delegate: new SliverChildListDelegate(buildTextViews(50)))
  ]),
);
}
Run Code Online (Sandbox Code Playgroud)

这是使用StreamBuilder构建应用程序(没有浮动appbar)的代码:

 @override
Widget build(BuildContext context) {
return new Scaffold(
  appBar: new AppBar(
    backgroundColor: Colors.orangeAccent,
    title: new Text('Find Anything'),
    bottom: PreferredSize(
      preferredSize: const Size.fromHeight(48.0),
      child: new Text('dddd'),
    ),
  ),

  body: new StreamBuilder(
      stream: Firestore.instance.collection('posts').snapshots(),
      builder: (context, snapshot) {
        List<TekongoPost> …
Run Code Online (Sandbox Code Playgroud)

flutter

6
推荐指数
1
解决办法
2272
查看次数

标签 统计

flutter ×1