小编Can*_*bag的帖子

升级到Flutter 1.7.8 + hotfix.3时无法编译

将Flutter版本升级到1.7.8 + hotfix.3时,我收到一些错误消息。

这是消息:

Compiler message:
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/svg.dart:158:18: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
 - 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
        context: 'picture failed to precache',
                 ^
file:///C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.12.4+1/lib/src/picture_provider.dart:335:20: Error: The argument type 'String' can't be assigned to the parameter type 'DiagnosticsNode'.
 - 'DiagnosticsNode' is from 'package:flutter/src/foundation/diagnostics.dart' ('file:///C:/src/flutter/packages/flutter/lib/src/foundation/diagnostics.dart').
Try changing the type of the parameter, or casting the argument to 'DiagnosticsNode'.
          context: 'while …
Run Code Online (Sandbox Code Playgroud)

flutter

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

如何为 Padding 小部件提供动态填充值?

我的应用程序将用于不同的设备和不同的屏幕尺寸,一个编码良好的应用程序应该在不同的屏幕尺寸下显示相同。Flutter 有 MediaQuery.of(context).size 属性。我想为 Padding 小部件提供一个填充值,例如“padding: E​​dgeInsets.only(top:_height/3)”,但这是不可接受的。只是静态值已接受填充。如何将动态值写入填充?

我试图在 initState 确定“var _paddingTop = _height/3”,但仍然不可接受。

     Padding(
            padding: EdgeInsets.only(top: _height/4), 
            child: Row(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                // some widgets
              ],
            ),
          ),
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

在 flutter 中使用 bloc 模式时的建议

使用 flutter bloc 时有什么建议,是否建议每个页面都有自己的 bloc,或者我可以为多个页面重用一个块,如果可以,如何?

flutter bloc

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

如何将 Stepper 小部件的背景颜色更改为透明色?

步进器小部件的背景颜色在垂直类型时是透明的。当像 StepperType.horizo​​ntal 这样更改类型时,步进器具有白灰色背景颜色。我怎样才能改变水平轴的背景颜色?

这是我的示例代码:

Container(
   width: _width,
   child: Stepper(
      type: StepperType.horizontal,
      steps: [
        Step(
          title: Text("First"),
          content: Text("This is our first example."),
        ),
        Step(
          title: Text("Second"),
          content: Text("This is our second example."),
        ),
      ],
    ),
  ),
Run Code Online (Sandbox Code Playgroud)

flutter

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

标签 统计

flutter ×4

bloc ×1

dart ×1