Compiler message:
lib/main.dart:12:11: Error: No named parameter with the name 'body'.
body: Image(
^^^^
import 'package:flutter/material.dart';
//main fuction is the starting point for all our apps.
void main() {
runApp(
MaterialApp(
home: Scaffold(
backgroundColor: Colors.blueGrey[150],
appBar: AppBar(
title: Text('I Am Rich'),
backgroundColor: Colors.deepOrange,
body: Image(
image:
NetworkImage('https://www.w3schools.com/w3css/img_lights.jpg'),
),
),
),
),
);
}
答案 0 :(得分:1)
body
是Scaffold
的参数,而不是AppBar
Scaffold(
backgroundColor: Colors.blueGrey[150],
appBar: AppBar(
title: Text('I Am Rich'),
backgroundColor: Colors.deepOrange,
),
body: Image(
image:
NetworkImage('https://www.w3schools.com/w3css/img_lights.jpg'),
),
),
此处有更多信息:https://api.flutter.dev/flutter/material/Scaffold-class.html