PubSpec中的飘动暗模式飞溅屏幕设置

发布于 2025-01-21 22:33:56 字数 353 浏览 1 评论 0原文

我为我的飞溅屏幕使用软件包splash_screen_view。 它为该应用程序的默认主题提供了深色和轻度的图像。 但是,如果用户主题手机很轻,并且想使用该应用程序Dark,那么如何为飞溅设置条件呢? 此软件包的设置设置在pubspec.yaml

,请有人帮助我吗?

这是我的Pubspec:

I use package splash_screen_view for my splash screen.
and it got the dark and light image for the default theme of the app.
but if the user theme mobile is light and wants to use the app dark, how can I set a condition for my splash?
the setting of this package sets In pubspec.yaml

so can anyone help me, please?

here is my pubspec:
enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别低头,皇冠会掉 2025-01-28 22:33:56

检查您的材料App()是否具有主题和DarkTheme设置并设置thememode:thememode.system,因此您的应用程序遵循用户手机的设置。

看起来像这样:

MaterialApp(
title: 'Great App',
theme: lightTheme, //create this
darkTheme: darkTheme, //create this
themeMode: ThemeMode.system, //follows user's device setting
home: GoHome(),
);

SplashScreen将遵循正确的设置。

奖励:搜索 flutter_native_splash 也将本机SplashColor设置为PhoneSetting。

Check that your MaterialApp() has theme and darkTheme set AND set themeMode: ThemeMode.system, so your app follows the settings of the user's phone.

Looks something like this:

MaterialApp(
title: 'Great App',
theme: lightTheme, //create this
darkTheme: darkTheme, //create this
themeMode: ThemeMode.system, //follows user's device setting
home: GoHome(),
);

Your splashscreen will follow the correct setting.

Bonus: Search for flutter_native_splash to ALSO set the native splashcolor to phonesetting.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文