What should I do to apply my background image in my project? Did I miss something? My background image found under lib/assets/background.jpg
void main() async {
WidgetsFlutterBinding.ensureInitialized();
Util flameUtil = Util();
await flameUtil.fullScreen();
await flameUtil.setOrientation(DeviceOrientation.portraitUp);
LangawGame game = LangawGame();
runApp(game.widget);
}
langaw-game.dart
class LangawGame extends Game {
Size screenSize;
double tileSize;
@override
void render(Canvas canvas) {
body:
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/background.jpg"),
fit: BoxFit.cover,
),
),
);
}
@override
void update(double t) {}
@override
void resize(Size size) {
super.resize(size);
screenSize = size;
tileSize = screenSize.width / 9;
}
}
This is the result
This is the background
i dont have error receive but the image didnt refect