2016-12-07 68 views
1

我試圖做一個簡單的選項卡頁面與TabBarSelection沒有這樣的方法錯誤

class NotePageState extends State<NotePage> { 

    @override 
    Widget build(BuildContext context) { 
    final List<Note> _notes = <Note>[new Note(title: "Note 1", description: "Description 1"), new Note(title: "Note 3", description: "Description 2")]; 
    return new Scaffold(
     appBar: new AppBar(
     // Here we take the value from the MyHomePage object that 
     // was created by the App.build method, and use it to set 
     // our appbar title. 
      title: new Text("Title"), 
     ), 
     body: new TabBarSelection<Note>(
      values:_notes, 
      key: new GlobalKey(), 
      child: new TabBarView<Note>(
       key : new GlobalKey(), 
       children: _notes.map((Note note) { 
       new NoteContainer(note); 
       }).toList() 
     ) 
     ) 
    ); 
    } 

但我得到:

0  Object._noSuchMethod (dart:core-patch/object_patch.dart:44) 
1  Object.noSuchMethod (dart:core-patch/object_patch.dart:47) 
2  KeyedSubtree.KeyedSubtree.wrap (package:flutter/src/widgets/basic.dart:3092:21) 
3  _TabBarViewState._updateItemsFromChildren (package:flutter/src/material/tabs.dart:1152:11) 
4  _TabBarViewState._updateItemsForSelectedIndex (package:flutter/src/material/tabs.dart:1161:7) 
5  _TabBarViewState._updateItemsAndScrollBehavior (package:flutter/src/material/tabs.dart:1183:5) 
6  _TabBarViewState._initSelection (package:flutter/src/material/tabs.dart:1128:7) 
7  _TabBarViewState.buildContent (package:flutter/src/material/tabs.dart:1263:5) 
8  ScrollableState.build (package:flutter/src/widgets/scrollable.dart:776:16) 
9  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2895:23) 
10  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
11  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
12  StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3013:22) 
13  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
14  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
15  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
16  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16) 
17  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
18  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
19  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
20  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
21  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
22  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16) 
23  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
24  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
25  StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3013:22) 
26  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
27  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
28  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
29  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16) 
30  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
31  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
32  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
33  ParentDataElement.mount (package:flutter/src/widgets/framework.dart:3196:16) 
34  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
35  MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:3939:32) 
36  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
37  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
38  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16) 
39  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
40  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
41  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
42  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
43  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
44  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16) 
45  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
46  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
47  StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:3013:22) 
48  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
49  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
50  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
51  SingleChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:3843:14) 
52  Element.inflateWidget (package:flutter/src/widgets/framework.dart:2248:14) 
53  Element.updateChild (package:flutter/src/widgets/framework.dart:2076:12) 
54  ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:2907:16) 
55  BuildableElement.rebuild (package:flutter/src/widgets/framework.dart:2784:5) 
56  ComponentElement._firstBuild (package:flutter/src/widgets/framework.dart:2875:5) 
57  ComponentElement.mount (package:flutter/src/widgets/framework.dart:2870:5) 
+0

好奇,您使用的IDE或鏢分析? –

回答

相關問題