admin
2022-05-07 4c7cde7ae5ed57335405459e47de4bbd2726c4ba
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import 'dart:io';
 
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
 
import '../../model/video/home_type_model.dart';
import '../../model/video/video_model.dart';
import '../../utils/jump_page.dart';
import '../../utils/ui_constant.dart';
import '../../utils/ui_utils.dart';
import '../../utils/video/video_util.dart';
Widget CommonImage(String url,
    {fit = BoxFit.cover,
    double? width,
    double? height,
    Widget? defaultWidget}) {
  if (url.startsWith("http")) {
    return CachedNetworkImage(
      imageUrl: url,
      fit: fit,
      width: width,
      height: height,
      placeholder: (context, st) =>
          defaultWidget ??
          Container(
            color: const Color(0xFFFFE8F0),
          ),
      errorWidget: (context, url, error) =>
          defaultWidget ?? const Icon(Icons.error),
    );
  } else {
    return Image.asset(
      url,
      width: width,
      height: height,
      fit: fit,
    );
  }
}