Blame view

lib/utils/image_util.dart 557 Bytes
c95453ce   Key   feat: User界面完善
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
  import 'package:flutter/material.dart';
  import 'package:wow_english/common/core/assets_const.dart';
  
  class ImageUtil {
    static ImageProvider getImageProviderOnDefault(String? uri, {scale = 1.0}) {
      if (uri == null || uri.isEmpty) {
        return ExactAssetImage(AssetsConst.wowLogo, scale: scale);
      }
      if (uri.startsWith('http')) {
        return NetworkImage(uri);
      } else {
        return ExactAssetImage(uri, scale: scale);
      }
      //return uri.startsWith('http') ? NetworkImage(uri) : ExactAssetImage(uri, scale: 0.5) as ImageProvider?;
    }
  }