小编Fei*_*ang的帖子

Flutter Navigator 2.0 页面过渡

我正在使用 Navigator 的声明式方法:

Navigator(
      pages: [
        MaterialPage(child: _screen),
      ],
      onPopPage: (route, result) {
        return route.didPop(result);
      },
);
Run Code Online (Sandbox Code Playgroud)

如何在屏幕之间添加过渡?

flutter flutter-navigation

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

当 Image.network() 失败时无法捕获 NetworkImageLoadException

我使用 Image.network() 显示来自 URL 的图像,这就是我使用它的方式

Image image = Image.network(
      _auth.currentUser!.photoURL!,
      width: 100.getWidth(context),
      height: 100.getWidth(context),
      frameBuilder: (context, child, frame, wasSynchronouslyLoaded) {
        return wasSynchronouslyLoaded
            ? child
            : _profileImagePlaceholder(context);
      },
      loadingBuilder: (context, child, loadingProgress) {
        return loadingProgress == null
            ? child
            : _profileImagePlaceholder(context);
      },
      errorBuilder: (context, error, stackTrace) {
        return _profileImagePlaceholder(context);
      },
    );
Run Code Online (Sandbox Code Playgroud)

但即使当我设置 errorBuilder 甚至用 try/catch 包装整个事情时这NetworkImageLoadException仍然显示

完全例外

The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 403,


When the exception was thrown, this was the …
Run Code Online (Sandbox Code Playgroud)

flutter flutter-image

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