flutter作业x2
一点没学,但要写作业,记录报错
错误代码:
final List<BottomNavigationBarItem> item = [
BottomNavigationBarItem(
icon: Icon(Icons.camera),
label: 'Camera',
backgroundColor: Colors.white70,
),
BottomNavigationBarItem(
icon: Icon(Icons.alarm),
label: 'Alarm',
backgroundColor: Colors.white70,
),
BottomNavigationBarItem(
icon: Icon(Icons.wifi),
label: 'WIFI',
backgroundColor: Colors.white70,
),
BottomNavigationBarItem(
icon: Icon(Icons.sms),
label: 'SMS',
backgroundColor: Colors.white70,
),
];
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Flutter Basic Widgets"),
backgroundColor: Colors.orange,
actions: <Widget>[
Icon(Icons.search),
IconButton(
tooltip: 'like',
icon: Icon(Icons.star),
onPressed: (){}),
],
),
floatingActionButton: FloatingActionButton(
onPressed: () { },
backgroundColor: Colors.deepOrange,
),
bottomNavigationBar: BottomNavigationBar(
items: item,
type: BottomNavigationBarType.shifting,
unselectedItemColor: Colors.black54,
fixedColor: Colors.purple,
showUnselectedLabels: true,
),
body: Container(
margin: const EdgeInsets.all(30.0),
child: new Row(
children: [
new Image.network(
"https://cn.bing.com/images/search?view=detailV2&ccid=FezNllMB&id=27C24F0C45EDD81C4C1CB068B5D748EB90D6CA4F&thid=OIP.FezNllMBkUcWofhpHkKnPgHaNK&mediaurl=https%3A%2F%2Fimg.18183.cn%2Fuploads%2Fallimg%2F210326%2F112-2103261F411.jpg&exph=1920&expw=1080&q=%e5%8e%9f%e7%a5%9e&simid=608036325871869065&form=IRPRST&ck=10DDEAE782D4120715DCF5FAEA850DC8&selectedindex=2&ajaxhist=0&ajaxserp=0&vt=0&sim=11",
width: 100,
height: 200,
),
new Text("I am Flutter Image"),
],),
),
),
);
}
}
修改:
new Image.network(
"https://img.18183.cn/uploads/allimg/210326/112-2103261F411.jpg",
width: 100,
height: 200,
),
因为给的图片地址复制错了,右键复制图片连接