小编Moh*_*ele的帖子

在我的 flutter 应用程序中构建运行程序包以进行 JSON 序列化不起作用

我在我的 flutter 应用程序中使用 build_runner 包进行 JSON 序列化。我已将其正确安装pubspec.yamldev dependencies. 但是当我尝试使用flutter pub run build_runner build它时会释放以下内容。

\n
    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\n
Run Code Online (Sandbox Code Playgroud)\n

我的pubspec.yaml

\n
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\n
Run Code Online (Sandbox Code Playgroud)\n

我的flutter doctor -v

\n
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)

flutter

10
推荐指数
2
解决办法
8854
查看次数

如何在 next JS 13 上使用 next-redux-wrapper?

我在 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)

reactjs redux react-redux next.js

7
推荐指数
1
解决办法
5149
查看次数

如何在 next js 13 中使用开放图元标记?

在最近的 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)

那么我如何在元数据中使用开放图呢?

meta-tags reactjs next.js

6
推荐指数
1
解决办法
8296
查看次数

如何在 Next js 13 中使用动态头?

在 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)

javascript meta-tags reactjs next.js vercel

5
推荐指数
1
解决办法
4696
查看次数

使用 NextJS 和 Tailwind CSS 不会改变文本颜色

在我的 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)

reactjs next.js tailwind-css

2
推荐指数
1
解决办法
3885
查看次数

flutter inappwebview 中的 flutter 警告

我正在我的 flutter 应用程序中实现一个 YouTube 播放器,当我运行它时,构建将失败并抛出贬值错误。

\n

我目前使用的是 2012 年中的 MacBook,所以我无法使用最新版本的 x 代码。我当前的版本是 Version 12.4 。因此,为了在 ios 上使用 flutter,我使用 flutter 2.5。

\n

所以现在当我尝试使用 youtube 播放器时它不会构建应用程序。

\n
Xcode 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)

xcode ios swift flutter

2
推荐指数
1
解决办法
7915
查看次数

WillPopScope 不适用于 Flutter 中的 IOS

在我的 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)

android ios dart flutter

2
推荐指数
1
解决办法
4973
查看次数

如何将 Cloudflare 的 R2 存储桶与下一个 JS 13 api 一起使用?

我最近遇到了 Cloudflare 的 R2 存储桶。这个桶有大量的免费套餐,我想将其用于我的个人项目。但没有关于如何在下一个 JS 13 中使用它的文档。可能有一些教程展示如何在 Node js 中使用它。

那么我如何使用 Next 13 API 路由上传到 R2 存储?

cloudflare reactjs next.js cloudflare-workers

1
推荐指数
1
解决办法
1555
查看次数