我的目标是在应用程序初始化时显示闪屏。
所以我使用这个包:flutter_native_splash: 0.1.9
根据pubt .dev上的flutter_native_splash文档,我按要求创建了这个文件:
flutter_native_splash:
image: assets/images/splash.png
color: "#ffffff"
fill: true
# android_disable_fullscreen: true
和在终端我运行这个命令:
flutter pub run flutter_native_splash:create
程序包生成了drawable-hdpi, drawable-mdpi, drawable-xdpi, drawable-xxdpi, drawable-xxxhdpi中的图像
现在我能够成功地使用这个闪屏,但问题是,当我测试时,生成的图像在物理设备上非常模糊…
有关于如何从一开始画这个图像的指导方针吗?
它只是一个简单的黑色图像,中间有文字…比如说"闪屏">
我使用figma来绘制然后将文件导出为SVG。
所以我的问题是:
我应该为我画里面的画布指定宽度和高度吗?!
我应该为文本指定一个固定的字体大小吗?如果是这样的话……假设有两篇文章…为中心……还有一个副标题
我操纵了很多次字体大小,但每次生成的图像都很模糊…
任何帮助都将非常感激。
编辑:
这是我在绘制图像时从figma截取的截图:
figma截图
1。制作一个大小为1080*1920的开机画面背景图,添加到drawable文件夹(android/app/src/main/res/drawable)
2)。在android的styles.xml中添加下面的代码
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/splash</item>
</style>
</resources>
3)。在AndroidManifest.xml标签
中添加以下代码android:name="io.flutter.app.FlutterApplication"
4)。在你的第一个活动中添加元数据
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme" />