44
55// PigHub API session. https://www.pighub.top
66
7+ // ignore_for_file: non_constant_identifier_names
8+
79import 'dart:math' as math;
810import 'dart:isolate' ;
911
@@ -23,26 +25,23 @@ List<PigHubImage>? _cachedImages;
2325
2426class PigHubImage {
2527 final String id;
26- final String thumbnail ; // relative path, e.g. /data/xxx.jpg
28+ final String image_url ; // relative path, e.g. /data/xxx.jpg
2729 final String title;
28- final String imageType; // "static" or "gif"
2930
3031 const PigHubImage ({
3132 required this .id,
32- required this .thumbnail ,
33+ required this .image_url ,
3334 required this .title,
34- required this .imageType,
3535 });
3636
3737 factory PigHubImage .fromJson (Map <String , dynamic > json) => PigHubImage (
3838 id: json["id" ].toString (),
39- thumbnail : json["thumbnail " ].toString (),
39+ image_url : json["image_url " ].toString (),
4040 title: json["title" ].toString (),
41- imageType: json["image_type" ].toString (),
4241 );
4342
4443 /// Full URL of the image.
45- String get url => "$_base $thumbnail " ;
44+ String get url => "$_base $image_url " ;
4645}
4746
4847List <dynamic > _extractImageList (dynamic data) {
@@ -86,7 +85,7 @@ Future<List<PigHubImage>> _getAllPigs({bool forceRefresh = false}) async {
8685 return _cachedImages! ;
8786 }
8887
89- final response = await _dio.get ("$_base /api/all- images" );
88+ final response = await _dio.get ("$_base /api/images?sort=0 " );
9089
9190 // Parse in a background isolate to avoid UI jank on large payloads.
9291 final parsed = await Isolate .run (() => _parsePigImages (response.data));
0 commit comments