我試圖與在顫振一些圖標簡單AppBar窗口小部件,但我不斷收到這種說法:撲:IconButton不工作
The following assertion was thrown building IconButton(Icon(IconData(U+0E5D2)); disabled; tooltip:
我幾乎只是mimiced的文件,但這裏是我的代碼:
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
title: "Stateless Widget Example",
home: new AppBar(title: new Text("App Bar"))
));
}
class AppBar extends StatelessWidget {
AppBar({this.title});
final Widget title;
@override
Widget build(BuildContext context) {
return new Container(
height: 56.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(
color: Colors.cyan,
border: new Border(
bottom: new BorderSide(
width: 1.0,
color: Colors.black
)
)
),
child: new Row (
children: <Widget> [
new IconButton(
icon: new Icon(Icons.menu),
tooltip: 'Navigation menu',
onPressed: null, // null disables the button
),
new Expanded(child: title)
]
)
);
}
}
我覺得我錯過了導入或其他東西。但我不完全確定。也許我的電腦剛剛起作用,因爲Flutter運行對我來說已經是越野車了。我是Dart和Flutter的新手,所以也許我只是沒有看到明顯的錯誤。
這已經添加,任何其他的想法? –