我在我的 flutter 应用程序中使用 build_runner 包进行 JSON 序列化。我已将其正确安装pubspec.yaml在dev dependencies. 但是当我尝试使用flutter pub run build_runner build它时会释放以下内容。
C:\\Users\\MoBix\\Music\\islamic_social_media>flutter pub run build_runner build\nUnhandled exception:\nBad state: Unable to generate package graph, no `C:\\Users\\MoBix\\Music\\islamic_social_media\\.dart_tool\\flutter_gen\\pubspec.yaml` found.\n#0 _pubspecForPath (package:build_runner_core/src/package_graph/package_graph.dart:232:5)\n#1 _parsePackageDependencies (package:build_runner_core/src/package_graph/package_graph.dart:206:21)\n#2 PackageGraph.forPath (package:build_runner_core/src/package_graph/package_graph.dart:101:33)\n<asynchronous suspension>\n#3 main (file:///C:/flutter/.pub-cache/hosted/pub.dartlang.org/build_runner-2.1.5/bin/build_runner.dart:27:30)\n<asynchronous suspension>\npub finished with exit code 255\nRun Code Online (Sandbox Code Playgroud)\n我的pubspec.yaml
dev_dependencies:\n flutter_launcher_icons: ^0.9.2\n flutter_app_name: ^0.1.1\n build_runner:\n flutter_test:\n sdk: flutter\nRun Code Online (Sandbox Code Playgroud)\n我的flutter doctor -v
C:\\Users\\MoBix>flutter doctor -v\n[\xe2\x88\x9a] Flutter (Channel stable, 2.5.3, on Microsoft Windows [Version …Run Code Online (Sandbox Code Playgroud) 我在 next js 13 和 redux 中使用应用程序目录。我有多个 redux 减速器,所以我需要使用next-redux-wrapperpackage.json 将它们组合起来。使用旧方法时,export default wrapper.withRedux(RootLayout);它可以工作,但不适用于其他浏览器。它显示一个警告/!\ You are using legacy implementaion. Please update your code: use createWrapper() and wrapper.useWrappedStore().。所以我更新了我的layout.js.
"use client";
import { ChakraProvider } from "@chakra-ui/react";
import "../styles/globals.css";
import { Provider } from "react-redux";
import { wrapper } from "../store";
function RootLayout({ children }) {
const { store } = wrapper.useWrappedStore();
return (
<html>
<head />
<body className="max-w-7xl mx-auto">
<Provider store={store}>
<ChakraProvider>{children}</ChakraProvider>
</Provider>
</body>
</html> …Run Code Online (Sandbox Code Playgroud) 在最近的 Next JS 13 更新中,他们引入了一种处理元标记的新方法,该方法与传统方法不同,即创建 Next Head 并编写常用的 html 元标记。在新方法中,我们创建一个类似元数据对象的方法。但我还没有找到使用开放图元数据的方法。
export const metadata = {
title:
" this is the title of the web",
description:
" this is the description section",
ogtitle: "this is open graph title for testing", // i thought this could be the case
};
Run Code Online (Sandbox Code Playgroud)
那么我如何在元数据中使用开放图呢?
在 next js 13 之前,我们曾经使用动态头作为导入。但在 Next JS 13 中,他们引入了 head.js 类。这在使用静态页面时有效,但是在加载动态页面时我们如何更改头部的标题和描述?我直接导入了next/head然后分配数据但没有改变head。
export default function DetailPage({ params: { itemid } }) {
const [datas, setDatas] = useState({});
const getData = async () => {
const docRef = doc(db, "items", itemid);
const docSnap = await getDoc(docRef);
setDatas(docSnap.data());
};
useEffect(() => {
if (Object.keys(datas).length == 0) {
getData();
}
}, [datas]);
return (
<>
<Head>
<title>{datas.title}</title>
<meta name="viewport" content="initial-scale=1.0, width=device-width" />
<meta
name="keywords"
content="some contents"
/>
<meta
name="description"
content={datas.desc}
/>
</Head>
<section>...</section>
</> …Run Code Online (Sandbox Code Playgroud) 在我的 NextJS 应用程序中,我使用<h1>文本标签并将其包装在 a 中,<div>但是当我尝试对文本应用颜色时,它不起作用。我什至添加了我的global.css但它引发了错误。
<div className="mt-2 flex justify-start items-center text-2xl font-bold text-gray-300">
<Image
src={Logo}
width={40}
height={40}
/>
<h1>some text here</h1>
</div>
Run Code Online (Sandbox Code Playgroud)
上面的代码不会引发错误,但它也不会将样式应用于文本。
样式/global.css
<div className="mt-2 flex justify-start items-center text-2xl font-bold text-gray-300">
<Image
src={Logo}
width={40}
height={40}
/>
<h1>some text here</h1>
</div>
Run Code Online (Sandbox Code Playgroud)
在基础层(上面)中应用样式会引发以下错误。
.../styles/globals.css 该类
text-gray-300不存在。如果text-gray-300是自定义类,请确保它是在@layer指令中定义的。
tailwind.config.js
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base{
body{
@apply bg-[#06202A] text-gray-300;
}
}
Run Code Online (Sandbox Code Playgroud)
postcss.config.js
@type {import('tailwindcss').Config} */
module.exports = {
mode: "jit", …Run Code Online (Sandbox Code Playgroud) 我正在我的 flutter 应用程序中实现一个 YouTube 播放器,当我运行它时,构建将失败并抛出贬值错误。
\n我目前使用的是 2012 年中的 MacBook,所以我无法使用最新版本的 x 代码。我当前的版本是 Version 12.4 。因此,为了在 ios 上使用 flutter,我使用 flutter 2.5。
\n所以现在当我尝试使用 youtube 播放器时它不会构建应用程序。
\nXcode build done. 43.0s\nFailed to build iOS app\nError output from Xcode build:\n\xe2\x86\xb3\n ** BUILD FAILED **\n\n\nXcode's output:\n\xe2\x86\xb3\n /Users/mobix/Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.5.0+2/ios/\n Classes/InAppBrowser/InAppBrowserWebViewController.swift:562:13: warning: setter for 'statusBarStyle'\n was deprecated in iOS 9.0: Use -[UIViewController preferredStatusBarStyle]\n UIApplication.shared.statusBarStyle = UIStatusBarStyle(rawValue: previousStatusBarStyle)!\n ^\n /Users/mobix/Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.5.0+2/ios/\n Classes/InAppWebView/InAppWebView.swift:521:31: warning: 'mediaPlaybackRequiresUserAction' was\n deprecated in iOS 9.0\n configuration.mediaPlaybackRequiresUserAction =\n options.mediaPlaybackRequiresUserGesture\n ^\n /Users/mobix/Development/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_inappwebview-5.5.0+2/ios/\n Classes/InAppWebView/InAppWebView.swift:932:31: warning: 'mediaPlaybackRequiresUserAction' was\n deprecated …Run Code Online (Sandbox Code Playgroud) 在我的 flutter 应用程序中,我想控制 IOS 的 will pop 范围,但它不起作用。我没有按照一些示例建议使用 PageRoute,并且CupertinoWillPopScope包无法正常工作,它会引发anchorpoint. 那么有人可以帮我吗?
我尝试了gestureDetectorIOS,但它没有触发上一页的操作,这正是我想要做的。
if (!Platform.isIOS) {
return WillPopScope(
onWillPop: () async {
timerController.startTimer();
!Navigator.of(context).userGestureInProgress;
return true;
},
child: MyPage(),
);
} else {
return GestureDetector(
onHorizontalDragUpdate: (details) {
int sensitivity = 8;
if (details.delta.dx > sensitivity) {
// Right Swipe
//timerController.startTimer();
} else if (details.delta.dx < -sensitivity) {
//Left Swipe
timerController.startTimer();
}
},
child: MyPage(),
);
}
Run Code Online (Sandbox Code Playgroud) 我最近遇到了 Cloudflare 的 R2 存储桶。这个桶有大量的免费套餐,我想将其用于我的个人项目。但没有关于如何在下一个 JS 13 中使用它的文档。可能有一些教程展示如何在 Node js 中使用它。
那么我如何使用 Next 13 API 路由上传到 R2 存储?
next.js ×5
reactjs ×5
flutter ×3
ios ×2
meta-tags ×2
android ×1
cloudflare ×1
dart ×1
javascript ×1
react-redux ×1
redux ×1
swift ×1
tailwind-css ×1
vercel ×1
xcode ×1