예제 #1
0
 public override Widget build(BuildContext context)
 {
     return(new DefaultTabController(
                length: TabsDemoUtils._allPages.Count,
                child: new Scaffold(
                    body: new NestedScrollView(
                        headerSliverBuilder: (BuildContext subContext, bool innerBoxIsScrolled) => {
         return new List <Widget> {
             new SliverOverlapAbsorber(
                 handle: NestedScrollView.sliverOverlapAbsorberHandleFor(subContext),
                 sliver: new SliverAppBar(
                     title: new Text("Tabs and scrolling"),
                     actions: new List <Widget> {
                 new MaterialDemoDocumentationButton(routeName)
             },
                     pinned: true,
                     expandedHeight: 150.0f,
                     forceElevated: innerBoxIsScrolled,
                     bottom: new TabBar(
                         tabs: TabsDemoUtils._allPages.Keys.Select <_TabPage, Widget>(
                             (_TabPage page) => new Tab(text: page.label)
                             ).ToList()
                         )
                     )
                 )
         };
     },
                        body: new TabBarView(
                            children: TabsDemoUtils._allPages.Keys.Select <_TabPage, Widget>((_TabPage page) => {
         return new SafeArea(
             top: false,
             bottom: false,
             child: new Builder(
                 builder: (BuildContext subContext) => {
             return new CustomScrollView(
                 key: new PageStorageKey <_TabPage>(page),
                 slivers: new List <Widget> {
                 new SliverOverlapInjector(
                     handle: NestedScrollView.sliverOverlapAbsorberHandleFor(subContext)
                     ),
                 new SliverPadding(
                     padding: EdgeInsets.symmetric(
                         vertical: 8.0f,
                         horizontal: 16.0f
                         ),
                     sliver: new SliverFixedExtentList(
                         itemExtent: _CardDataItem.height,
                         del: new SliverChildBuilderDelegate(
                             (BuildContext subsubContext, int index) => {
                     _CardData data = TabsDemoUtils._allPages[page][index];
                     return new Padding(
                         padding: EdgeInsets.symmetric(
                             vertical: 8.0f
                             ),
                         child: new _CardDataItem(
                             page: page,
                             data: data
                             )
                         );
                 },
                             childCount: TabsDemoUtils._allPages[page].Count
                             )
                         )
                     )
             }
                 );
         }
                 )
             );
     }).ToList()
                            )
                        )
                    )
                ));
 }
예제 #2
0
 public _CardDataItem(_TabPage page, _CardData data)
 {
     this.page = page;
     this.data = data;
 }