我用过颤振插件flutter_native_splash: ^2.2.2
我需要实现飞溅屏幕准确的2秒与自定义的图像。我尝试了插件描述中的所有例子,但效果并不完美。
flutter_native_splash:
background_image: "assets/images/splash.png"发布于 2022-05-31 12:49:13
不可能在精确的时间内显示颤振本机启动屏幕,因为splash是在加载颤振框架时显示的。根据设备的处理速度,这可能需要或多或少的时间。可以想象的是,在较旧的设备上,即使没有添加额外的延迟,它也可以持续超过2秒。
发布于 2022-06-01 06:55:47
您可以在main方法中尝试此代码:
void main() async{
await Future.delayed(const Duration(seconds: 2))
.then((value) => FlutterNativeSplash.remove());
runApp(const MyApp());
}发布于 2022-06-06 11:18:54
我不使用颤振飞溅屏幕,而是尝试这个添加在脚手架中的图像
Scaffold(
backgroundColor: Colors.white,
body: Center(
child: FadeInImage(
image: AssetImage("assets/images/splash.png"),//some animation
height: 400,
fadeInDuration: const Duration(seconds: 1),
placeholder: MemoryImage(kTransparentImage),//transparent_image: ^2.0.0 add this to pub.yaml file
),
)
);//从init调用此函数
void userData() async{
setState(() {
Timer(
Duration(seconds: 2),
()=> );
});
} 在闪存屏幕后要导航到的屏幕。
https://stackoverflow.com/questions/72448022
复制相似问题