This commit is contained in:
cxc
2023-02-08 17:20:16 +08:00
parent 06ff4a41f4
commit 53ff2fc59b
23 changed files with 458 additions and 104 deletions

View File

@ -0,0 +1,17 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:momo/models/image_resp.dart';
part 'image_list_resp.g.dart';
@JsonSerializable()
class ImageListResp {
List<ImageResp> list;
int total;
ImageListResp(this.list, this.total);
factory ImageListResp.fromJson(Map<String, dynamic> json) =>
_$ImageListRespFromJson(json);
Map<String, dynamic> toJson() => _$ImageListRespToJson(this);
}

View File

@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'image_list_resp.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ImageListResp _$ImageListRespFromJson(Map<String, dynamic> json) =>
ImageListResp(
(json['list'] as List<dynamic>)
.map((e) => ImageResp.fromJson(e as Map<String, dynamic>))
.toList(),
json['total'] as int,
);
Map<String, dynamic> _$ImageListRespToJson(ImageListResp instance) =>
<String, dynamic>{
'list': instance.list,
'total': instance.total,
};

View File

@ -0,0 +1,30 @@
import 'dart:ffi';
import 'package:json_annotation/json_annotation.dart';
part 'image_resp.g.dart';
@JsonSerializable()
class ImageResp {
int id;
String file_name;
String file_path;
int upload_time;
int size;
int width;
int height;
ImageResp(this.id, this.file_name, this.file_path, this.upload_time,
this.size, this.width, this.height);
/// A necessary factory constructor for creating a new Configs instance
/// from a map. Pass the map to the generated `_$ConfigsFromJson()` constructor.
/// The constructor is named after the source class, in this case, Configs.
factory ImageResp.fromJson(Map<String, dynamic> json) =>
_$ImageRespFromJson(json);
/// `toJson` is the convention for a class to declare support for serialization
/// to JSON. The implementation simply calls the private, generated
/// helper method `_$ImageRespToJson`.
Map<String, dynamic> toJson() => _$ImageRespToJson(this);
}

View File

@ -0,0 +1,27 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'image_resp.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ImageResp _$ImageRespFromJson(Map<String, dynamic> json) => ImageResp(
json['id'] as int,
json['file_name'] as String,
json['file_path'] as String,
json['upload_time'] as int,
json['size'] as int,
json['width'] as int,
json['height'] as int,
);
Map<String, dynamic> _$ImageRespToJson(ImageResp instance) => <String, dynamic>{
'id': instance.id,
'file_name': instance.file_name,
'file_path': instance.file_path,
'upload_time': instance.upload_time,
'size': instance.size,
'width': instance.width,
'height': instance.height,
};