我已经使用 flutter 和 firebase 大约 2 年了,在过去 3 周内部署了 4 个网站,而我当前的项目在部署时屏幕是空白的,我的控制台上出现了奇怪的错误有了承诺,这是我最近部署的“空白应用程序”之一 - https://inkanyezitravelings.web.app/,我看到 flutter 在他们的网络样板中进行了更新,可能表明这可能与它有关,但我在这里不知所措:
<!DOCTYPE html>
<html>
<head>
<base href="$FLUTTER_BASE_HREF">
<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="inkanyezitraveling">
<link rel="apple-touch-icon" href="icons/favicon.png">
<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>
<title>inkanyezitraveling</title>
<link rel="manifest" href="manifest.json">
</head>
<body>
<script src="flutter_bootstrap.js" async></script>
<script type="module">
// Import the functions you need from the SDKs you need
import { initializeApp } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-app.js";
import { getAnalytics } from "https://www.gstatic.com/firebasejs/10.12.2/firebase-analytics.js";
// TODO: Add SDKs for Firebase products that you want to use
// https://firebase.google.com/docs/web/setup#available-libraries
// Your web app's Firebase configuration
// For Firebase JS SDK v7.20.0 and later, measurementId is optional
const firebaseConfig = {
apiKey: ",
authDomain: ",
projectId: "",
storageBucket: "",
messagingSenderId: "",
appId: "1:",
measurementId: ""
};
// Initialize Firebase
const app = initializeApp(firebaseConfig);
const analytics = getAnalytics(app);
</script>
</body>
</html>
//////////
{
"hosting": {
"site":"inkanyezitravelings",
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
////////////////
import 'package:flutter/material.dart';
import 'package:inkanyezitraveling/FounderHeader.dart';
import 'package:inkanyezitraveling/Header.dart';
import 'package:inkanyezitraveling/Section.dart';
import 'package:inkanyezitraveling/SliverHeaders.dart';
import 'package:url_launcher/url_launcher.dart';
void main() async {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Inkanyezi',
theme: ThemeData(
fontFamily: "Elianto",
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(title: ''),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
double h = MediaQuery.of(context).size.height;
double w = MediaQuery.of(context).size.width;
final String urls =
'https://wa.me/${0814139437}?text=${Uri.encodeComponent("Greetings, I would like to enquire about,")}';
final Uri url = Uri.parse(urls);
var vs = SliverToBoxAdapter(
child: SizedBox(
height: h * 0.0125,
));
return Scaffold(
backgroundColor: Colors.black,
appBar: AppBar(
backgroundColor: Colors.black,
centerTitle: true,
title: Image.asset(
"assets/logo.jpg",
height: 90,
),
),
body: CustomScrollView(
slivers: [
Header(
image: "assets/wallpaper.jpg",
title: "",
),
vs,
SliverHeaderpinned(
pinned: true,
title: "Inkanyezi Luxury Travel",
repeatcount: 5,
headerColor: Colors.black,
titleColor: Colors.white,
w: w,
),
vs,
const SliverToBoxAdapter(
child: FounderHeader(),
),
vs,
Header(
image: "assets/section1.jpg",
title: "",
),
const SliverToBoxAdapter(
child: SectionStruct(
prefix: "l",
name: "Destinations:",
sectionItems: [
"Sun City",
"Dubai",
"Dubai",
"Oribi Gorge",
"Switzerland",
"Caymen Islands"
],
)),
vs,
Header(
image: "assets/section2.jpg",
title: "",
),
const SliverToBoxAdapter(
child: SectionStruct(
prefix: "acc",
name: "Breath Taking Accomodation:",
sectionItems: [
"Tranquil Accomodation",
"First Class Suites",
"Comfortable Bedding",
"Premium Utilities",
],
)),
vs,
Header(
image: "assets/section5.jpg",
title: "",
),
const SliverToBoxAdapter(
child: SectionStruct(
prefix: "place",
name: "New Environments",
sectionItems: [
"Colourful Terrians",
"Heritage Sites",
"Aerial Views",
"Quad Biking",
"Floral Gardens"
],
)),
vs,
Header(
image: "assets/section4.jpg",
title: "",
),
const SliverToBoxAdapter(
child: SectionStruct(
prefix: "activity",
name: "Activities:",
sectionItems: [
"Aerial Cableway",
"Yacht Riding",
"Camel Riding",
"Exotic Parties",
"Sun Bathing",
"Henna Drawings"
],
)),
vs,
Header(
image: "assets/section3.jpg",
title: "",
),
const SliverToBoxAdapter(
child: SectionStruct(
prefix: "food",
name: "Cuisine:",
sectionItems: [
"Premium Breakfast",
"Champange Rolling",
"Savory Selections",
"High End Wine",
],
)),
vs,
vs,
],
),
floatingActionButton: FloatingActionButton(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
onPressed: () async {
if (await canLaunchUrl(url )) {
await launchUrl(url);
}
},
tooltip: 'Whatsapp',
child: Image.asset(
"wa.png",
color: Colors.white,
),
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
);
}
}
////////////
name: inkanyezitraveling
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=3.4.3 <4.0.0'
dependencies:
sliver_header_delegate: ^0.0.5
sliver_expandable: ^1.1.0
animated_text_kit: ^4.2.2
searchbar_animation: ^0.0.4
card_banner: ^0.0.1+2
sliver_tools: ^0.2.12
url_launcher: ^6.3.0
image_card: ^0.0.4
firebase_core: ^3.1.0
flutter:
sdk: flutter
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.6
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.0
flutter:
uses-material-design: true
assets:
- assets/
fonts:
- family: Elianto
fonts:
- asset: assets\Fonts\Elianto-Regular.ttf
我也有同样的问题。一周前部署了一个应用程序,没有任何问题,现在我在所有新部署上都出现白屏......