gpt4 book ai didi

flutter - flutter web 应用程序作为 PWA 安装时如何更改菜单栏的颜色?

转载 作者:行者123 更新时间:2023-12-04 13:37:11 32 4
gpt4 key购买 nike

我创建了一个 flutter 网络应用程序。当我从 URL 将该应用程序安装为渐进式 Web 应用程序时,菜单栏颜色不是 list 文件中指定的颜色。

这是manifest.json文件:

{
"short_name": "Lorem",
"name": "Lorem Ipsum",
"description": "Neque porro quisquam est qui dolorem ipsum",
"icons": [
{
"src": "icons/Icon-192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "icons/Icon-512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"start_url": "/",
"background_color": "#393557",
"theme_color": "#393557",
"display": "minimal-ui",
"orientation": "portrait-primary"
}

这是我的 index.html文件:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="Neque porro quisquam est qui dolorem ipsum">
<meta name="robots" content="noindex">

<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="Lorem ipsum">
<meta id="flutterweb-theme" name="theme-color" content="#393557">
<link rel="apple-touch-icon" href="/icons/Icon-192.png">

<title>Lorem ipsum</title>
<link rel="manifest" href="/manifest.json">
</head>
<body id="app-container">
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('/flutter_service_worker.js');
});
}
</script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>

缺少的是什么?任何帮助都会很棒。谢谢!

最佳答案

将此元标记放在 index.html 文件中的“head”标记之间。

  <meta name="theme-color" content="#393557">
它将更改您的移动浏览器的顶部菜单颜色。

关于flutter - flutter web 应用程序作为 PWA 安装时如何更改菜单栏的颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61201189/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com