【发布时间】:2021-11-09 10:39:43
【问题描述】:
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child:
Container(
height: 200,
width: 100,
color: Colors.yellow,
),
),
);
}
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("asset/image/Bestone.jpg")))));
}
}
无论我使用什么,我在尝试运行或编码时都会遇到问题。我收到此错误。
缺少“StatefulWidget.createState”的具体实现。尝试实现缺少的方法,或者将类抽象为 MyApp ()
【问题讨论】:
标签: flutter dart stateful statefulwidget