小编kri*_*yaa的帖子

如何使父 div 激活子 div 的悬停和活动样式

我为侧栏导航制作了这种样式

在此输入图像描述

我做了一个盒子,并使用变换将其隐藏在左侧,以获得弯曲的边框效果。

悬停时、活动等

  • 边框按钮 -> bg-green-300
  • text-green-300 用于图标和文本
  • 半粗体字体仅适用于文本
<a href="/dashboard">
    <div class="flex flex-row space-x-8 w-72 text-lg pb-3 text-gray-200"> 
        
        <div class="h-8 w-8 rounded transform -translate-x-7 hover:bg-green-300"></div>

        <div class="flex flex-row items-center space-x-8 transform -translate-x-10 -translate-y-1">
            <i class="bi bi-columns-gap hover:text-green-300 transform translate-x-1"></i>
            <h2 class="hover:font-semibold hover:text-green-300 transform translate-y-1 text-base">Dashboard</h2>
        </div>
    </div>
</a>

Run Code Online (Sandbox Code Playgroud)

我可以在主 div 中添加一些内容来同时激活每个子元素中的悬停效果吗?

现在,只有当我将鼠标悬停在每个单独的元素上时,它才起作用。

任何帮助深表感谢 :)

css user-interface laravel tailwind-css

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

Flutter:go_router如何将多个参数传递到其他屏幕?

在普通颤动中,我用来将多个参数传递到其他屏幕,如下所示:

    Navigator.of(context).push(MaterialPageRoute(
                                    builder: (_) => CatalogFilterPage(
                                          list: list,
                                          bloc: bloc,
                                        )))
Run Code Online (Sandbox Code Playgroud)

非常简单和容易。我可以传递 2 个所需的参数,列表和块。在 CatalogFilterPage 中使用后。

现在,在切换到 go_router 并查看文档后,我似乎找不到如何传递多个数据。即使传递单个对象似乎也不是那么好:

    onTap: () =>
              context.pushNamed('SelectedCatalogItem', extra: list[index]),
Run Code Online (Sandbox Code Playgroud)

在路由器中,我必须使用强制转换来设置正确的类型:

    builder: (context, state) => SelectedCatalogItem(
                    item: state.extra as ListItemsModel,
                  ),
Run Code Online (Sandbox Code Playgroud)

对于单个参数来说很好。但现在我不知道如何传递多个参数。我该怎么做?甚至传递参数(例如模型)作为额外的方法是正确的方法吗?

PS 我知道您可以将参数传递为context.pushNamed('CatalogFilterPage', params: ___),但params类型为 Map<String, String> ,但不允许我传递模型的

navigation routes dart flutter flutter-go-router

49
推荐指数
3
解决办法
6万
查看次数

强制 Tailwind 在构建阶段包含一些类

在我的 Angular 项目中,我最近将菜单从打字稿变量移动到从后端动态加载的 json。

一些 Tailwind 类仅在此菜单中使用,因此现在在构建时 Tailwind 不知道它必须包含这些类的样式。

是否可以强制 Tailwind 始终包含某些类?例如,通过处理 tailwind.config.js 文件。

作为解决方法,实际上我已将此行包含在我的 index.html 中(但我不喜欢 eslint 的错误):

<!--<span class="hidden bg-green-400 bg-pink-400"></span>-->
Run Code Online (Sandbox Code Playgroud)

css user-interface angular tailwind-css

47
推荐指数
2
解决办法
2万
查看次数

Flutter go_router如何将结果返回到上一页?

我正在尝试打开一个页面并使用 go_router 包获取返回的结果。在导航 1.0 中我使用这个:

final result = await Navigator.push(
  context,
  MaterialPageRoute(builder: (context) => const SecondRoute()),
);
// handle result
Run Code Online (Sandbox Code Playgroud)

但我似乎无法用 go_router 做到这一点。有什么解决办法或者解释吗?

navigation routes dart flutter gorouter

35
推荐指数
2
解决办法
3万
查看次数

如何在同一层次结构路由中将 Shell Route 与 GoRoute 一起使用

\n

如何在同一层次结构路由中将 Shell Route 与 GoRoute 一起使用

\n\n

如何使用导航栏按钮之一从 ShellRoute 推送到与 ShellRoute 同一层次结构中的 GoRoute?

\n

目前GoRouter的路由有两个值:ShellRoute和GoRoute。ShellRoute 中的 Child 代表 Home、Discover 和 Shop Widget。然而,除了上面提到的 Widget 的三个按钮之外,NavBar 还多了一个第四个按钮。这个按钮(MY)用于转到前面提到的 GoRoute。

\n

正如您从下面附加的代码中看到的,我希望在 ShellRoute 上按下第四个按钮时显示登录小部件,因为 GoRoute 堆叠在 ShellRoute 上。但实际上,随着 ShellRoute 被删除,GoRoute 成为顶部堆栈,iOS 没有后退按钮,Android 在 BackPress 时关闭应用程序。

\n

官方文档examples中没有这方面的例子,所以我迷失了很多。\n我发现了类似的例子一万个\n https://github.com/flutter/packages/blob/main/packages/go_router/示例/lib/shell_route.dart \n在上面的示例中,GoRoute 依赖于 ShellRoute。\n我不想要这个。我想让登录路线可以从任何地方访问。

\n

我将在下面附上我的代码和操作屏幕。\n我需要你的帮助。

\n

预期成绩: \n当按下第四个按钮时,GoRoute 堆叠在 ShellRoute 上,按下背面时 ShellRoute 重新出现

\n

实际结果: \n当按下第四个按钮时,ShellRoute 被移除,创建一个 GoRoute 并将其堆叠在顶部,当您按 Back 时应用程序结束。

\n

\xe1\x84\x92\xe1\x85\xaa\xe1\x84\x86\xe1\x85\xa7\xe1\x86\xab \xe1\x84\x80\xe1\x85\xb5\xe1\x84\x85\xe1 \x85\xa9\xe1\x86\xa8 2022-11-30 \xe1\x84\x8b\xe1\x85\xa9\xe1\x84\x92\xe1\x85\xae 4 21 12 mov

\n
Performing hot restart...\nSyncing files to device iPhone 12...\nRestarted application in 368ms.\nflutter: MyTest …
Run Code Online (Sandbox Code Playgroud)

android routes ios dart flutter

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

Go_Router 将对象传递到新路由

我想将对象从列表视图传递到子路线。似乎没有办法传递对象。

有什么办法吗?

GoRouter routes(AuthBloc bloc) {
 return GoRouter(
navigatorKey: _rootNavigatorKey,
routes: <RouteBase>[
  GoRoute(
    routes: <RouteBase>[
      GoRoute(
        path: loginURLPagePath,
        builder: (BuildContext context, GoRouterState state) {
          return const LoginPage();
        },
      ),
      GoRoute(
        path: homeURLPagePath,
        builder: (BuildContext context, GoRouterState state) =>
            const HomePage(),
        routes: <RouteBase>[
          GoRoute(
              path: feeURLPagePath,
              name: 'a',
              builder: (context, state) => FeePage(),
              routes: [
                /// Fee Details page
                GoRoute(
                  name: 'b',
                  path: feeDetailsURLPagePath,
                  builder: (BuildContext context, GoRouterState state) =>
                      const FeeDetails(),
                ),
              ]),
        ],
      ),
    ],
    path: welcomeURLPagePath,
    builder: (BuildContext …
Run Code Online (Sandbox Code Playgroud)

android routes ios dart flutter

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

如何在 go_router 中使用 NavigationBar?| 扑

我目前正在努力使用go_router重构我的路由代码。

我已经得到了一些简单的路由,例如/signin& /signup,但是当我尝试使路由与具有多个屏幕的 BottomNavigationBar 一起工作时,问题就出现了。我想为他们每个人都有一条单独的路线,例如/home, /events& /profile

我发现我必须以某种方式返回具有不同参数的相同小部件,以防止每当按下 BottomNavigationBarItem 时整个屏幕发生变化,而只更新 BottomNavigationBar 上方的部分(即屏幕本身)。

我想出了一个非常棘手的解决方案:

GoRoute(
  path: '/:path',
  builder: (BuildContext context, GoRouterState state) {
    final String path = state.params['path']!;

    if (path == 'signin') {
      return const SignInScreen();
    }

    if (path == 'signup') {
      return const SignUpScreen();
    }

    if (path == 'forgot-password') {
      return const ForgotPasswordScreen();
    }

    // Otherwise it has to be the ScreenWithBottomBar

    final int index = getIndexFromPath(path);

    if (index != -1) …
Run Code Online (Sandbox Code Playgroud)

routes ios dart flutter flutter-go-router

20
推荐指数
3
解决办法
2万
查看次数

未捕获的类型错误:无法读取 null 的属性(读取“useContext”)

所以我的反应代码中没有任何地方使用 useContext 属性。我有一个 npm 包,其中有一个已编译的 webpack 文件,其中有一个组件。当我尝试在我的 React 应用程序中使用该组件时,它会抛出错误 Uncaught TypeError: Cannot read properties of null (reading 'useContext')。组件函数在那里并输出一个反应对象。它只是在使用时破坏页面。现在我研究了 useContext 是什么,我相信它与状态有关。

所以下面是我将在我的反应应用程序中使用的输入组件

import React from 'react';
import {TextField} from  '@mui/material';
class Input extends React.Component {
  constructor(props){
    super(props)
  }
  render(){
    return (
      <div className="input" style={{position:"relative",left:this.props.tabOver? this.props.tabOver.toString()+"px":"0px"}}>
        <label style={{display:"block", width:"100%",position:"relative", margin: "5px"}}> {this.props.labelName}</label>
        <TextField
        size="small"
        onChange={(e)=>{this.props.update(e.target.value)}}
        value={this.props.value}
        label={this.props.label? this.props.label:"type here"}
        error={this.props.error? this.props.error:false}
        required={this.props.required? this.props.required:false}
        disabled={this.props.disabled? this.props.disabled:false}
        helperText={this.props.helperText? this.props.helperText:""}
        InputProps={{ style: { fontSize: this.props.InputProps? this.props.InputProp:10 } }}
        InputLabelProps={{ style: { fontSize: (this.props.InputLabelProps? this.props.InputLabelProps:12) } …
Run Code Online (Sandbox Code Playgroud)

javascript npm reactjs webpack babeljs

20
推荐指数
2
解决办法
5万
查看次数

Firebase 云消息传递 API (V1):服务器密钥丢失

我们使用Urban Airship将推送消息发送到我们的 Android 应用程序。

在此过程中,我们需要使用Firebase Console -> Cloud Messaging中提供的“服务器密钥”来配置Airship

正如那里所建议的,我们正在尝试从 GCM 迁移到 FCM。

问题是“ Firebase Cloud Messaging API (V1) ”配置中缺少“服务器密钥” 。它在“ Cloud Messaging API(旧版) ”配置中仍然可用,但建议迁移。

按照 FCM 配置中的链接对解决此问题没有太大帮助。

Firebase 控制台 - 云消息传递

android ios firebase google-cloud-messaging google-cloud-platform

17
推荐指数
3
解决办法
1万
查看次数

如何在浏览器上使用 TailwindCSS 强制暗模式?

我有一个网站,使用 TailwindCSS 正确实现了深色/浅色 UI。

我想知道是否有一种方法可以强制网站以深色模式加载,直到用户通过单击切换按钮专门切换浅色模式。

为什么?因为我更喜欢网站在深色模式下的外观,但由于正确实现了浅色/深色主题,我宁愿保留它并强制它以深色模式加载,无论用户的浏览器设置如何。

html javascript css user-interface tailwind-css

12
推荐指数
2
解决办法
8468
查看次数