web image caching test
This commit is contained in:
parent
66094b4dc2
commit
a43dc894b7
|
|
@ -12,7 +12,7 @@ build:
|
|||
image: cirrusci/flutter:latest
|
||||
script:
|
||||
- flutter clean
|
||||
- flutter build web --web-renderer canvaskit
|
||||
- flutter build web --web-renderer html
|
||||
only:
|
||||
- test
|
||||
- dev
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import 'package:didvan/services/network/request.dart';
|
|||
import 'package:didvan/services/network/request_helper.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:transparent_image/transparent_image.dart';
|
||||
|
||||
class SkeletonImage extends StatefulWidget {
|
||||
final String imageUrl;
|
||||
|
|
@ -54,32 +53,28 @@ class _SkeletonImageState extends State<SkeletonImage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (kIsWeb) {
|
||||
// if (_isLoading) {
|
||||
// return _aspectRatioGenerator(
|
||||
// child: ShimmerPlaceholder(
|
||||
// borderRadius: widget.borderRadius,
|
||||
// width: widget.aspectRatio == null ? widget.width : null,
|
||||
// height: widget.aspectRatio == null ? widget.height : null,
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
return _aspectRatioGenerator(
|
||||
child: ClipRRect(
|
||||
borderRadius: widget.borderRadius,
|
||||
child: FadeInImage(
|
||||
image: NetworkImage(
|
||||
RequestHelper.baseUrl + widget.imageUrl,
|
||||
headers: {'Authorization': 'Bearer ${RequestService.token}'},
|
||||
),
|
||||
placeholder: MemoryImage(kTransparentImage),
|
||||
fit: BoxFit.cover,
|
||||
width: widget.width,
|
||||
height: widget.height,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
// if (kIsWeb) {
|
||||
// if (_isLoading) {
|
||||
// return _aspectRatioGenerator(
|
||||
// child: ShimmerPlaceholder(
|
||||
// borderRadius: widget.borderRadius,
|
||||
// width: widget.aspectRatio == null ? widget.width : null,
|
||||
// height: widget.aspectRatio == null ? widget.height : null,
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// return _aspectRatioGenerator(
|
||||
// child: ClipRRect(
|
||||
// borderRadius: widget.borderRadius,
|
||||
// child: Image.memory(
|
||||
// _bytes,
|
||||
// fit: BoxFit.cover,
|
||||
// width: widget.width,
|
||||
// height: widget.height,
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
return _aspectRatioGenerator(
|
||||
child: CachedNetworkImage(
|
||||
httpHeaders: {'Authorization': 'Bearer ${RequestService.token}'},
|
||||
|
|
|
|||
|
|
@ -378,6 +378,13 @@ packages:
|
|||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.11"
|
||||
material_color_utilities:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: material_color_utilities
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.3"
|
||||
meta:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -648,7 +655,7 @@ packages:
|
|||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.4.3"
|
||||
version: "0.4.8"
|
||||
transparent_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
|||
Loading…
Reference in New Issue