首页 > 解决方案 > 动画启动画面中图像资源的大小不变

问题描述

我正在尝试为应用程序创建动画启动画面。我已经使用 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”属性,但图像会突然变形或被切断。有关如何对此进行更改的任何建议?

标签: imageflutterflutter-animation

解决方案


AnimatedSplashScreen(
        duration: 3500,
        splash: 'assets/images/app_logo.png',
        splashIconSize: double.maxFinite,
        nextScreen: CompanyList(),
        centered: true,
        splashTransition: SplashTransition.rotationTransition,
        backgroundColor: Colors.white),

推荐阅读