flutter 应用程序似乎正在从 android\app\src\main\res\drawable\launchbackground.xml 加载启动画面,但我试图让它从 lib\screen\splash.dart 加载启动画面< /p>
这是发生了什么:
加载应用程序时,launchbackground.xml 中的启动画面正在加载 splash.dart 之前加载...
我的launchbackground.xml代码:
<?xml version="1.0" encoding="utf-8"?>
<item android:drawable="@android:color/holo_white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/logo1" />
</item>
我的 splash.dart 代码:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class Splash extends StatefulWidget {
@override
_SplashState createState() => _SplashState();
}
class _SplashState extends State<Splash> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [
Color.fromRGBO(8, 94, 180, 1.0),
Color.fromRGBO(30, 144, 255, 1.0),
Color.fromRGBO(0, 191, 255, 1.0)
],
begin: Alignment.bottomLeft,
end: Alignment.topRight,
),
),
child: Container(
height: 120,
width: 200,
child: Image.asset(
"asset/Logo11.png",
fit: BoxFit.contain,
)),
));
}
}