image - 动画启动画面中图像资源的大小不变
问题描述
我正在尝试为应用程序创建动画启动画面。我已经使用 Image.asset() 在初始屏幕中插入了一个图像,但是当我输入任何高度或宽度的数字时,图像根本不会改变。它仍然很小,但我希望它更大。
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: AnimatedSplashScreen(
duration: 4000,
splash:
Image.asset("assets/icons/icon.png",
height: 200),
nextScreen: Homepage(title: "Travel Nepal",),
splashTransition: SplashTransition.fadeTransition,
backgroundColor: Color(0xffF99DC8),
),
);
}
}
我也使用了“fit:BoxFit.fill”属性,但图像会突然变形或被切断。有关如何对此进行更改的任何建议?
解决方案
AnimatedSplashScreen(
duration: 3500,
splash: 'assets/images/app_logo.png',
splashIconSize: double.maxFinite,
nextScreen: CompanyList(),
centered: true,
splashTransition: SplashTransition.rotationTransition,
backgroundColor: Colors.white),
推荐阅读
- angular - 从用户角度看 Angular 服务生命周期
- reactjs - 无法运行反应项目
- emacs - Doom emacs 在终端中显示各种主题
- javascript - Javascript 在移动浏览器中不起作用
- javascript - typeof a where var a = 2 + [] is string 的解释是什么?
- vb.net - 通过匹配文件名中的字符串将文件从一个文件夹复制到另一个文件夹,并通过将日期和时间附加到文件名来重命名复制的文件
- python - 非规范化公司名称的 DataFrame [第 1 部分]
- if-statement - ARRAYFORMULA 但仅在行中出现 EMPTY 单元格 - 不起作用
- algorithm - 计算数组的深度
- java - 什么算法可用于以最佳方式在 A1 尺寸的纸张上包装规则形状