小编Plu*_*Dev的帖子

Flutter:如何修复行溢出?

我有一个Row内部 a DropdownMenuItem,但是当它内部的一部分变得很长时,我就会溢出。

这是一个屏幕截图:这是一个屏幕截图

这是代码:

Row(
                      children: [
                        Padding(
                          padding: const EdgeInsets.fromLTRB(5.0, 0.0, 30.0, 0.0),
                          child: Center(
                            widthFactor: 1,
                            child: CachedNetworkImage(
                              width: 40,
                              height: 40,
                              imageUrl: "https://[...].vercel.app/static/boatClasses/" + boat.boatClass + ".png",
                              progressIndicatorBuilder: (context, url, downloadProgress) => CircularProgressIndicator(value: downloadProgress.progress),
                              errorWidget: (context, url, error) => Icon(Icons.error),
                            ),
                          ),
                        ),
                        Column(
                          crossAxisAlignment: CrossAxisAlignment.start,
                          children: [
                            Text(
                              boat.name,
                              style: Theme.of(context).textTheme.bodyText1,
                              overflow: TextOverflow.ellipsis,
                            ),
                            Text(
                              (boat.country == "" ? "" : boat.country + " ") + boat.sailNumber.toString(),
                              style: Theme.of(context).textTheme.bodyText2,
                            ),
                          ],
                        ), …
Run Code Online (Sandbox Code Playgroud)

row overflow flutter

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

Docker 命令在 Windows 上的 Git Bash 中不起作用(exec:“com.docker.cli”:在 %PATH% 中找不到可执行文件)

我的计算机上安装了适用于 Windows 的 Docker Desktop 和 Git(包括 Git Bash)。该docker命令在命令提示符和 Powershell 中有效,但在 Git Bash 中无效。当我docker在 Git Bash 中运行命令时,出现以下错误。

exec: "com.docker.cli": executable file not found in %PATH%
Current PATH : ...;C:\Program Files\Docker\Docker\resources\bin;D:\Program Files\Git\cmd;C:\ProgramData\DockerDesktop\version-bin;...
Run Code Online (Sandbox Code Playgroud)

我需要让 Docker 通过 Git Bash 工作,以便使用 Git Bash运行.sh包含命令的文件。docker我找不到发生此错误的任何原因。

...是 中的其他路径PATH,但未连接到 Git Bash 或 Docker

git path git-bash docker docker-cli

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

Sign_in_with_apple:AuthorizationErrorCode.invalidResponse:未设置代码查询参数

我使用最新版本的sign_in_with_apple,并使用以下代码来允许通过Apple登录我在Android上的Flutter应用程序。

final credential = await SignInWithApple.getAppleIDCredential(
  scopes: [
    AppleIDAuthorizationScopes.email,
    AppleIDAuthorizationScopes.fullName,
  ],
  webAuthenticationOptions: WebAuthenticationOptions(
    clientId: '***Service Identifier***',
    redirectUri:
        // For web your redirect URI needs to be the host of the "current page",
        // while for Android you will be using the API server that redirects back into your app via a deep link
        kIsWeb ? Uri.parse('https://${window.location.host}/') : Uri.parse('https://***Backend***/callback'),
  ),
  nonce: nonce,
);
Run Code Online (Sandbox Code Playgroud)

我从README.md包中获取了后端代码:

apple_router.post("/callback", (request, response) => {
    console.log(">>> Apple callback received <<<");
    console.log("Body:");
    console.log(request.body);
    console.log("Query:");
    console.log(request.query); …
Run Code Online (Sandbox Code Playgroud)

authentication dart flutter apple-sign-in apple-authentication

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

Flutter 1.22 以变量为键的国际化

我实现了 Flutter 的新(官方)本地化(https://pascalw.me/blog/2020/10/02/flutter-1.22-internationalization.html),一切正常,除了我不知道如何获取变量键的翻译。

翻译位于 ARB 文件中,但我如何访问它?

通常我使用 访问翻译Translations.of(context).formsBack,但现在我想获得 的翻译value["labels"]["label"]

类似的东西Translations.of(context).(value["labels"]["label"])当然行不通。

variables internationalization arb dart flutter

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

Flutter:关闭DropdownButton(DropdownMenu)

有没有办法在执行 onTap 函数时关闭包含所有 DropdownMenuItems的DropdownButton的选择菜单(DropdownMenuItem 内的 GestureDetector)?

这是我对 Alperen Baskaya 方法的实现(稍微简化的版本,以便于理解)。然而,这种方法还不起作用,我不确定是因为我错误地实施了它,还是因为该方法不适用于我的问题。

class _BoatSelectionState extends State<BoatSelection> {
  FocusNode focusNode;
  
  @override
  void initState() {
    super.initState();
    focusNode = FocusNode();
  }

  @override
  Widget build(BuildContext context) {
    return Row(
      children: [
        Expanded(
          child: 
            DropdownButtonHideUnderline(
              child: DropdownButton<Boat>(
                focusNode: focusNode,
                icon: Icon(
                  Icons.keyboard_arrow_down_rounded,
                  color: Colors.black,
                ),
                isExpanded: true,
                value: selectedBoat,
                onChanged: (Boat _boat) => Provider.of<BoatStreamsCubit>(context, listen: false).setBoat(_boat),
                selectedItemBuilder: (BuildContext context) {
                  return widget.boats.map<Widget>((Boat boat) {
                    return Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: [
                        BoatClassLogo(boat: boat),
                        Expanded(
                          child: …
Run Code Online (Sandbox Code Playgroud)

flutter dropdownbutton flutter-dropdownbutton

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