Files
fcs/lib/pages/widgets/display_image_source.dart

31 lines
732 B
Dart
Raw Normal View History

2020-09-17 06:02:48 +06:30
import 'dart:io';
2020-09-18 21:33:41 +06:30
import 'package:cached_network_image/cached_network_image.dart';
2020-09-17 06:02:48 +06:30
import 'package:flutter/widgets.dart';
class DisplayImageSource {
String url;
File file;
DisplayImageSource({this.url, this.file});
ImageProvider get imageProvider =>
2020-09-18 21:33:41 +06:30
file == null ? CachedNetworkImageProvider(url) : FileImage(file);
2020-09-17 06:02:48 +06:30
@override
bool operator ==(other) {
if (identical(this, other)) {
return true;
}
return (other.file == this.file &&
(other.file != null || this.file != null)) ||
(other.url == this.url && (other.url != null || this.url != null));
}
@override
int get hashCode {
int result = 17;
result = 37 * result + file.hashCode;
return result;
}
}