How to Show an Local image till the NetworkImage() Loads Up in flutter?

前端 未结 9 1000
忘掉有多难
忘掉有多难 2021-02-13 03:15
            new CircleAvatar(
                              backgroundColor: Colors.black87,
                              backgroundImage: new NetworkImage(url),
               


        
9条回答
  •  南方客
    南方客 (楼主)
    2021-02-13 03:30

    You can also use the frameBuilder property. The good thing: you can implement your custom placeholder widget here.

    Image.network('https://example.com/my-image',
      height: 100,
      frameBuilder: (context, child, frame, _) {
        if (frame == null) {
          // fallback to placeholder
          return MyPlaceholderWidget();
        }
        return child;
      }
    )
    

提交回复
热议问题