我正在尝试在资产中设置图片,但该图片未显示,除了该图片,我只能看到空白。.有人可以帮我解决这个问题吗?
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("Image from assets"),
),
body: Container(
height: 300,
decoration: BoxDecoration(
color: Colors.white,
image: DecorationImage(
colorFilter: new ColorFilter.mode(Colors.black.withOpacity(0.05), BlendMode.dstATop),
image: AssetImage('assets/sample/pexel.jpeg'),
fit: BoxFit.cover,
),
))));
}
}