11 changed files with 786 additions and 191 deletions
@ -1 +1,5 @@ |
|||||||
include: package:flutter_lints/flutter.yaml |
include: package:flutter_lints/flutter.yaml |
||||||
|
|
||||||
|
analyzer: |
||||||
|
errors: |
||||||
|
invalid_annotation_target: ignore |
||||||
|
@ -1,88 +1,24 @@ |
|||||||
import 'package:flutter/material.dart'; |
import 'package:freezed_annotation/freezed_annotation.dart'; |
||||||
|
|
||||||
@immutable |
part 'server_problem.freezed.dart'; |
||||||
class ServerProblem { |
part 'server_problem.g.dart'; |
||||||
final String id; |
|
||||||
final String title; |
|
||||||
final String location; |
|
||||||
final String? censorTaskId; |
|
||||||
final String? rowId; |
|
||||||
final String? bindData; |
|
||||||
final List<String>? imageUrls; |
|
||||||
final DateTime creationTime; |
|
||||||
final String creatorId; |
|
||||||
final DateTime lastModificationTime; |
|
||||||
final String lastModifierId; |
|
||||||
|
|
||||||
const ServerProblem({ |
@freezed |
||||||
required this.id, |
abstract class ServerProblem with _$ServerProblem { |
||||||
required this.title, |
const factory ServerProblem({ |
||||||
required this.location, |
required String id, |
||||||
this.censorTaskId, |
required String title, |
||||||
this.rowId, |
required String location, |
||||||
this.bindData, |
|
||||||
this.imageUrls, |
|
||||||
required this.creationTime, |
|
||||||
required this.creatorId, |
|
||||||
required this.lastModificationTime, |
|
||||||
required this.lastModifierId, |
|
||||||
}); |
|
||||||
|
|
||||||
factory ServerProblem.fromJson(Map<String, dynamic> json) => ServerProblem( |
|
||||||
id: json['id'] as String, |
|
||||||
title: json['title'] as String, |
|
||||||
location: json['location'] as String, |
|
||||||
censorTaskId: json['censorTaskId'] as String?, |
|
||||||
rowId: json['rowId'] as String?, |
|
||||||
bindData: json['bindData'] as String?, |
|
||||||
imageUrls: json['imageUrls'] as List<String>?, |
|
||||||
creationTime: DateTime.parse(json['creationTime'] as String), |
|
||||||
creatorId: json['creatorId'] as String, |
|
||||||
lastModificationTime: DateTime.parse( |
|
||||||
json['lastModificationTime'] as String, |
|
||||||
), |
|
||||||
lastModifierId: json['lastModifierId'] as String, |
|
||||||
); |
|
||||||
|
|
||||||
Map<String, dynamic> toJson() => { |
|
||||||
'id': id, |
|
||||||
'title': title, |
|
||||||
'location': location, |
|
||||||
'censorTaskId': censorTaskId, |
|
||||||
'rowId': rowId, |
|
||||||
'bindData': bindData, |
|
||||||
'imageUrls': imageUrls, |
|
||||||
'creationTime': creationTime.toUtc().toIso8601String(), |
|
||||||
'creatorId': creatorId, |
|
||||||
'lastModificationTime': lastModificationTime.toUtc().toIso8601String(), |
|
||||||
'lastModifierId': lastModifierId, |
|
||||||
}; |
|
||||||
|
|
||||||
ServerProblem copyWith({ |
|
||||||
String? id, |
|
||||||
String? title, |
|
||||||
String? location, |
|
||||||
String? censorTaskId, |
String? censorTaskId, |
||||||
String? rowId, |
String? rowId, |
||||||
String? bindData, |
String? bindData, |
||||||
List<String>? imageUrls, |
List<String>? imageUrls, |
||||||
DateTime? creationTime, |
required DateTime creationTime, |
||||||
String? creatorId, |
required String creatorId, |
||||||
DateTime? lastModificationTime, |
DateTime? lastModificationTime, |
||||||
String? lastModifierId, |
String? lastModifierId, |
||||||
}) { |
}) = _ServerProblem; |
||||||
return ServerProblem( |
|
||||||
id: id ?? this.id, |
factory ServerProblem.fromJson(Map<String, Object?> json) => |
||||||
title: title ?? this.title, |
_$ServerProblemFromJson(json); |
||||||
location: location ?? this.location, |
|
||||||
censorTaskId: censorTaskId ?? this.censorTaskId, |
|
||||||
rowId: rowId ?? this.rowId, |
|
||||||
bindData: bindData ?? this.bindData, |
|
||||||
imageUrls: imageUrls ?? this.imageUrls, |
|
||||||
creationTime: creationTime ?? this.creationTime, |
|
||||||
creatorId: creatorId ?? this.creatorId, |
|
||||||
lastModificationTime: lastModificationTime ?? this.lastModificationTime, |
|
||||||
lastModifierId: lastModifierId ?? this.lastModifierId, |
|
||||||
); |
|
||||||
} |
|
||||||
} |
} |
||||||
|
@ -0,0 +1,315 @@ |
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||||
|
// coverage:ignore-file |
||||||
|
// ignore_for_file: type=lint |
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark |
||||||
|
|
||||||
|
part of 'server_problem.dart'; |
||||||
|
|
||||||
|
// ************************************************************************** |
||||||
|
// FreezedGenerator |
||||||
|
// ************************************************************************** |
||||||
|
|
||||||
|
// dart format off |
||||||
|
T _$identity<T>(T value) => value; |
||||||
|
|
||||||
|
/// @nodoc |
||||||
|
mixin _$ServerProblem { |
||||||
|
|
||||||
|
String get id; String get title; String get location; String? get censorTaskId; String? get rowId; String? get bindData; List<String>? get imageUrls; DateTime get creationTime; String get creatorId; DateTime? get lastModificationTime; String? get lastModifierId; |
||||||
|
/// Create a copy of ServerProblem |
||||||
|
/// with the given fields replaced by the non-null parameter values. |
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false) |
||||||
|
@pragma('vm:prefer-inline') |
||||||
|
$ServerProblemCopyWith<ServerProblem> get copyWith => _$ServerProblemCopyWithImpl<ServerProblem>(this as ServerProblem, _$identity); |
||||||
|
|
||||||
|
/// Serializes this ServerProblem to a JSON map. |
||||||
|
Map<String, dynamic> toJson(); |
||||||
|
|
||||||
|
|
||||||
|
@override |
||||||
|
bool operator ==(Object other) { |
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ServerProblem&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.location, location) || other.location == location)&&(identical(other.censorTaskId, censorTaskId) || other.censorTaskId == censorTaskId)&&(identical(other.rowId, rowId) || other.rowId == rowId)&&(identical(other.bindData, bindData) || other.bindData == bindData)&&const DeepCollectionEquality().equals(other.imageUrls, imageUrls)&&(identical(other.creationTime, creationTime) || other.creationTime == creationTime)&&(identical(other.creatorId, creatorId) || other.creatorId == creatorId)&&(identical(other.lastModificationTime, lastModificationTime) || other.lastModificationTime == lastModificationTime)&&(identical(other.lastModifierId, lastModifierId) || other.lastModifierId == lastModifierId)); |
||||||
|
} |
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false) |
||||||
|
@override |
||||||
|
int get hashCode => Object.hash(runtimeType,id,title,location,censorTaskId,rowId,bindData,const DeepCollectionEquality().hash(imageUrls),creationTime,creatorId,lastModificationTime,lastModifierId); |
||||||
|
|
||||||
|
@override |
||||||
|
String toString() { |
||||||
|
return 'ServerProblem(id: $id, title: $title, location: $location, censorTaskId: $censorTaskId, rowId: $rowId, bindData: $bindData, imageUrls: $imageUrls, creationTime: $creationTime, creatorId: $creatorId, lastModificationTime: $lastModificationTime, lastModifierId: $lastModifierId)'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// @nodoc |
||||||
|
abstract mixin class $ServerProblemCopyWith<$Res> { |
||||||
|
factory $ServerProblemCopyWith(ServerProblem value, $Res Function(ServerProblem) _then) = _$ServerProblemCopyWithImpl; |
||||||
|
@useResult |
||||||
|
$Res call({ |
||||||
|
String id, String title, String location, String? censorTaskId, String? rowId, String? bindData, List<String>? imageUrls, DateTime creationTime, String creatorId, DateTime? lastModificationTime, String? lastModifierId |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
/// @nodoc |
||||||
|
class _$ServerProblemCopyWithImpl<$Res> |
||||||
|
implements $ServerProblemCopyWith<$Res> { |
||||||
|
_$ServerProblemCopyWithImpl(this._self, this._then); |
||||||
|
|
||||||
|
final ServerProblem _self; |
||||||
|
final $Res Function(ServerProblem) _then; |
||||||
|
|
||||||
|
/// Create a copy of ServerProblem |
||||||
|
/// with the given fields replaced by the non-null parameter values. |
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? title = null,Object? location = null,Object? censorTaskId = freezed,Object? rowId = freezed,Object? bindData = freezed,Object? imageUrls = freezed,Object? creationTime = null,Object? creatorId = null,Object? lastModificationTime = freezed,Object? lastModifierId = freezed,}) { |
||||||
|
return _then(_self.copyWith( |
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,location: null == location ? _self.location : location // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,censorTaskId: freezed == censorTaskId ? _self.censorTaskId : censorTaskId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?,rowId: freezed == rowId ? _self.rowId : rowId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?,bindData: freezed == bindData ? _self.bindData : bindData // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?,imageUrls: freezed == imageUrls ? _self.imageUrls : imageUrls // ignore: cast_nullable_to_non_nullable |
||||||
|
as List<String>?,creationTime: null == creationTime ? _self.creationTime : creationTime // ignore: cast_nullable_to_non_nullable |
||||||
|
as DateTime,creatorId: null == creatorId ? _self.creatorId : creatorId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,lastModificationTime: freezed == lastModificationTime ? _self.lastModificationTime : lastModificationTime // ignore: cast_nullable_to_non_nullable |
||||||
|
as DateTime?,lastModifierId: freezed == lastModifierId ? _self.lastModifierId : lastModifierId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?, |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ServerProblem]. |
||||||
|
extension ServerProblemPatterns on ServerProblem { |
||||||
|
/// A variant of `map` that fallback to returning `orElse`. |
||||||
|
/// |
||||||
|
/// It is equivalent to doing: |
||||||
|
/// ```dart |
||||||
|
/// switch (sealedClass) { |
||||||
|
/// case final Subclass value: |
||||||
|
/// return ...; |
||||||
|
/// case _: |
||||||
|
/// return orElse(); |
||||||
|
/// } |
||||||
|
/// ``` |
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ServerProblem value)? $default,{required TResult orElse(),}){ |
||||||
|
final _that = this; |
||||||
|
switch (_that) { |
||||||
|
case _ServerProblem() when $default != null: |
||||||
|
return $default(_that);case _: |
||||||
|
return orElse(); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
/// A `switch`-like method, using callbacks. |
||||||
|
/// |
||||||
|
/// Callbacks receives the raw object, upcasted. |
||||||
|
/// It is equivalent to doing: |
||||||
|
/// ```dart |
||||||
|
/// switch (sealedClass) { |
||||||
|
/// case final Subclass value: |
||||||
|
/// return ...; |
||||||
|
/// case final Subclass2 value: |
||||||
|
/// return ...; |
||||||
|
/// } |
||||||
|
/// ``` |
||||||
|
|
||||||
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ServerProblem value) $default,){ |
||||||
|
final _that = this; |
||||||
|
switch (_that) { |
||||||
|
case _ServerProblem(): |
||||||
|
return $default(_that);case _: |
||||||
|
throw StateError('Unexpected subclass'); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
/// A variant of `map` that fallback to returning `null`. |
||||||
|
/// |
||||||
|
/// It is equivalent to doing: |
||||||
|
/// ```dart |
||||||
|
/// switch (sealedClass) { |
||||||
|
/// case final Subclass value: |
||||||
|
/// return ...; |
||||||
|
/// case _: |
||||||
|
/// return null; |
||||||
|
/// } |
||||||
|
/// ``` |
||||||
|
|
||||||
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ServerProblem value)? $default,){ |
||||||
|
final _that = this; |
||||||
|
switch (_that) { |
||||||
|
case _ServerProblem() when $default != null: |
||||||
|
return $default(_that);case _: |
||||||
|
return null; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
/// A variant of `when` that fallback to an `orElse` callback. |
||||||
|
/// |
||||||
|
/// It is equivalent to doing: |
||||||
|
/// ```dart |
||||||
|
/// switch (sealedClass) { |
||||||
|
/// case Subclass(:final field): |
||||||
|
/// return ...; |
||||||
|
/// case _: |
||||||
|
/// return orElse(); |
||||||
|
/// } |
||||||
|
/// ``` |
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String title, String location, String? censorTaskId, String? rowId, String? bindData, List<String>? imageUrls, DateTime creationTime, String creatorId, DateTime? lastModificationTime, String? lastModifierId)? $default,{required TResult orElse(),}) {final _that = this; |
||||||
|
switch (_that) { |
||||||
|
case _ServerProblem() when $default != null: |
||||||
|
return $default(_that.id,_that.title,_that.location,_that.censorTaskId,_that.rowId,_that.bindData,_that.imageUrls,_that.creationTime,_that.creatorId,_that.lastModificationTime,_that.lastModifierId);case _: |
||||||
|
return orElse(); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
/// A `switch`-like method, using callbacks. |
||||||
|
/// |
||||||
|
/// As opposed to `map`, this offers destructuring. |
||||||
|
/// It is equivalent to doing: |
||||||
|
/// ```dart |
||||||
|
/// switch (sealedClass) { |
||||||
|
/// case Subclass(:final field): |
||||||
|
/// return ...; |
||||||
|
/// case Subclass2(:final field2): |
||||||
|
/// return ...; |
||||||
|
/// } |
||||||
|
/// ``` |
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String title, String location, String? censorTaskId, String? rowId, String? bindData, List<String>? imageUrls, DateTime creationTime, String creatorId, DateTime? lastModificationTime, String? lastModifierId) $default,) {final _that = this; |
||||||
|
switch (_that) { |
||||||
|
case _ServerProblem(): |
||||||
|
return $default(_that.id,_that.title,_that.location,_that.censorTaskId,_that.rowId,_that.bindData,_that.imageUrls,_that.creationTime,_that.creatorId,_that.lastModificationTime,_that.lastModifierId);case _: |
||||||
|
throw StateError('Unexpected subclass'); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
/// A variant of `when` that fallback to returning `null` |
||||||
|
/// |
||||||
|
/// It is equivalent to doing: |
||||||
|
/// ```dart |
||||||
|
/// switch (sealedClass) { |
||||||
|
/// case Subclass(:final field): |
||||||
|
/// return ...; |
||||||
|
/// case _: |
||||||
|
/// return null; |
||||||
|
/// } |
||||||
|
/// ``` |
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String title, String location, String? censorTaskId, String? rowId, String? bindData, List<String>? imageUrls, DateTime creationTime, String creatorId, DateTime? lastModificationTime, String? lastModifierId)? $default,) {final _that = this; |
||||||
|
switch (_that) { |
||||||
|
case _ServerProblem() when $default != null: |
||||||
|
return $default(_that.id,_that.title,_that.location,_that.censorTaskId,_that.rowId,_that.bindData,_that.imageUrls,_that.creationTime,_that.creatorId,_that.lastModificationTime,_that.lastModifierId);case _: |
||||||
|
return null; |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// @nodoc |
||||||
|
@JsonSerializable() |
||||||
|
|
||||||
|
class _ServerProblem implements ServerProblem { |
||||||
|
const _ServerProblem({required this.id, required this.title, required this.location, this.censorTaskId, this.rowId, this.bindData, final List<String>? imageUrls, required this.creationTime, required this.creatorId, this.lastModificationTime, this.lastModifierId}): _imageUrls = imageUrls; |
||||||
|
factory _ServerProblem.fromJson(Map<String, dynamic> json) => _$ServerProblemFromJson(json); |
||||||
|
|
||||||
|
@override final String id; |
||||||
|
@override final String title; |
||||||
|
@override final String location; |
||||||
|
@override final String? censorTaskId; |
||||||
|
@override final String? rowId; |
||||||
|
@override final String? bindData; |
||||||
|
final List<String>? _imageUrls; |
||||||
|
@override List<String>? get imageUrls { |
||||||
|
final value = _imageUrls; |
||||||
|
if (value == null) return null; |
||||||
|
if (_imageUrls is EqualUnmodifiableListView) return _imageUrls; |
||||||
|
// ignore: implicit_dynamic_type |
||||||
|
return EqualUnmodifiableListView(value); |
||||||
|
} |
||||||
|
|
||||||
|
@override final DateTime creationTime; |
||||||
|
@override final String creatorId; |
||||||
|
@override final DateTime? lastModificationTime; |
||||||
|
@override final String? lastModifierId; |
||||||
|
|
||||||
|
/// Create a copy of ServerProblem |
||||||
|
/// with the given fields replaced by the non-null parameter values. |
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false) |
||||||
|
@pragma('vm:prefer-inline') |
||||||
|
_$ServerProblemCopyWith<_ServerProblem> get copyWith => __$ServerProblemCopyWithImpl<_ServerProblem>(this, _$identity); |
||||||
|
|
||||||
|
@override |
||||||
|
Map<String, dynamic> toJson() { |
||||||
|
return _$ServerProblemToJson(this, ); |
||||||
|
} |
||||||
|
|
||||||
|
@override |
||||||
|
bool operator ==(Object other) { |
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ServerProblem&&(identical(other.id, id) || other.id == id)&&(identical(other.title, title) || other.title == title)&&(identical(other.location, location) || other.location == location)&&(identical(other.censorTaskId, censorTaskId) || other.censorTaskId == censorTaskId)&&(identical(other.rowId, rowId) || other.rowId == rowId)&&(identical(other.bindData, bindData) || other.bindData == bindData)&&const DeepCollectionEquality().equals(other._imageUrls, _imageUrls)&&(identical(other.creationTime, creationTime) || other.creationTime == creationTime)&&(identical(other.creatorId, creatorId) || other.creatorId == creatorId)&&(identical(other.lastModificationTime, lastModificationTime) || other.lastModificationTime == lastModificationTime)&&(identical(other.lastModifierId, lastModifierId) || other.lastModifierId == lastModifierId)); |
||||||
|
} |
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false) |
||||||
|
@override |
||||||
|
int get hashCode => Object.hash(runtimeType,id,title,location,censorTaskId,rowId,bindData,const DeepCollectionEquality().hash(_imageUrls),creationTime,creatorId,lastModificationTime,lastModifierId); |
||||||
|
|
||||||
|
@override |
||||||
|
String toString() { |
||||||
|
return 'ServerProblem(id: $id, title: $title, location: $location, censorTaskId: $censorTaskId, rowId: $rowId, bindData: $bindData, imageUrls: $imageUrls, creationTime: $creationTime, creatorId: $creatorId, lastModificationTime: $lastModificationTime, lastModifierId: $lastModifierId)'; |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
/// @nodoc |
||||||
|
abstract mixin class _$ServerProblemCopyWith<$Res> implements $ServerProblemCopyWith<$Res> { |
||||||
|
factory _$ServerProblemCopyWith(_ServerProblem value, $Res Function(_ServerProblem) _then) = __$ServerProblemCopyWithImpl; |
||||||
|
@override @useResult |
||||||
|
$Res call({ |
||||||
|
String id, String title, String location, String? censorTaskId, String? rowId, String? bindData, List<String>? imageUrls, DateTime creationTime, String creatorId, DateTime? lastModificationTime, String? lastModifierId |
||||||
|
}); |
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
/// @nodoc |
||||||
|
class __$ServerProblemCopyWithImpl<$Res> |
||||||
|
implements _$ServerProblemCopyWith<$Res> { |
||||||
|
__$ServerProblemCopyWithImpl(this._self, this._then); |
||||||
|
|
||||||
|
final _ServerProblem _self; |
||||||
|
final $Res Function(_ServerProblem) _then; |
||||||
|
|
||||||
|
/// Create a copy of ServerProblem |
||||||
|
/// with the given fields replaced by the non-null parameter values. |
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? title = null,Object? location = null,Object? censorTaskId = freezed,Object? rowId = freezed,Object? bindData = freezed,Object? imageUrls = freezed,Object? creationTime = null,Object? creatorId = null,Object? lastModificationTime = freezed,Object? lastModifierId = freezed,}) { |
||||||
|
return _then(_ServerProblem( |
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,title: null == title ? _self.title : title // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,location: null == location ? _self.location : location // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,censorTaskId: freezed == censorTaskId ? _self.censorTaskId : censorTaskId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?,rowId: freezed == rowId ? _self.rowId : rowId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?,bindData: freezed == bindData ? _self.bindData : bindData // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?,imageUrls: freezed == imageUrls ? _self._imageUrls : imageUrls // ignore: cast_nullable_to_non_nullable |
||||||
|
as List<String>?,creationTime: null == creationTime ? _self.creationTime : creationTime // ignore: cast_nullable_to_non_nullable |
||||||
|
as DateTime,creatorId: null == creatorId ? _self.creatorId : creatorId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String,lastModificationTime: freezed == lastModificationTime ? _self.lastModificationTime : lastModificationTime // ignore: cast_nullable_to_non_nullable |
||||||
|
as DateTime?,lastModifierId: freezed == lastModifierId ? _self.lastModifierId : lastModifierId // ignore: cast_nullable_to_non_nullable |
||||||
|
as String?, |
||||||
|
)); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
// dart format on |
@ -0,0 +1,41 @@ |
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND |
||||||
|
|
||||||
|
part of 'server_problem.dart'; |
||||||
|
|
||||||
|
// ************************************************************************** |
||||||
|
// JsonSerializableGenerator |
||||||
|
// ************************************************************************** |
||||||
|
|
||||||
|
_ServerProblem _$ServerProblemFromJson(Map<String, dynamic> json) => |
||||||
|
_ServerProblem( |
||||||
|
id: json['id'] as String, |
||||||
|
title: json['title'] as String, |
||||||
|
location: json['location'] as String, |
||||||
|
censorTaskId: json['censorTaskId'] as String?, |
||||||
|
rowId: json['rowId'] as String?, |
||||||
|
bindData: json['bindData'] as String?, |
||||||
|
imageUrls: (json['imageUrls'] as List<dynamic>?) |
||||||
|
?.map((e) => e as String) |
||||||
|
.toList(), |
||||||
|
creationTime: DateTime.parse(json['creationTime'] as String), |
||||||
|
creatorId: json['creatorId'] as String, |
||||||
|
lastModificationTime: json['lastModificationTime'] == null |
||||||
|
? null |
||||||
|
: DateTime.parse(json['lastModificationTime'] as String), |
||||||
|
lastModifierId: json['lastModifierId'] as String?, |
||||||
|
); |
||||||
|
|
||||||
|
Map<String, dynamic> _$ServerProblemToJson(_ServerProblem instance) => |
||||||
|
<String, dynamic>{ |
||||||
|
'id': instance.id, |
||||||
|
'title': instance.title, |
||||||
|
'location': instance.location, |
||||||
|
'censorTaskId': instance.censorTaskId, |
||||||
|
'rowId': instance.rowId, |
||||||
|
'bindData': instance.bindData, |
||||||
|
'imageUrls': instance.imageUrls, |
||||||
|
'creationTime': instance.creationTime.toIso8601String(), |
||||||
|
'creatorId': instance.creatorId, |
||||||
|
'lastModificationTime': instance.lastModificationTime?.toIso8601String(), |
||||||
|
'lastModifierId': instance.lastModifierId, |
||||||
|
}; |
@ -0,0 +1,35 @@ |
|||||||
|
// sync_progress_state.dart |
||||||
|
import 'package:get/get.dart'; |
||||||
|
|
||||||
|
class SyncProgressState { |
||||||
|
final RxBool isSyncing = false.obs; |
||||||
|
final RxString currentStep = ''.obs; |
||||||
|
final RxDouble progress = 0.0.obs; |
||||||
|
final RxInt totalSteps = 0.obs; |
||||||
|
final RxInt completedSteps = 0.obs; |
||||||
|
|
||||||
|
void startSync(int totalSteps) { |
||||||
|
isSyncing.value = true; |
||||||
|
this.totalSteps.value = totalSteps; |
||||||
|
completedSteps.value = 0; |
||||||
|
progress.value = 0.0; |
||||||
|
currentStep.value = '开始同步...'; |
||||||
|
} |
||||||
|
|
||||||
|
void updateProgress(String step, int completed) { |
||||||
|
completedSteps.value = completed; |
||||||
|
progress.value = completed / totalSteps.value; |
||||||
|
currentStep.value = step; |
||||||
|
} |
||||||
|
|
||||||
|
void completeSync() { |
||||||
|
isSyncing.value = false; |
||||||
|
currentStep.value = '同步完成'; |
||||||
|
progress.value = 1.0; |
||||||
|
} |
||||||
|
|
||||||
|
void errorSync(String error) { |
||||||
|
isSyncing.value = false; |
||||||
|
currentStep.value = '同步失败: $error'; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,40 @@ |
|||||||
|
// sync_progress_dialog.dart |
||||||
|
import 'package:flutter/material.dart'; |
||||||
|
import 'package:get/get.dart'; |
||||||
|
import 'package:problem_check_system/modules/problem/controllers/sync_progress_state.dart'; |
||||||
|
|
||||||
|
class SyncProgressDialog extends StatelessWidget { |
||||||
|
final SyncProgressState progressState; |
||||||
|
|
||||||
|
const SyncProgressDialog({super.key, required this.progressState}); |
||||||
|
|
||||||
|
@override |
||||||
|
Widget build(BuildContext context) { |
||||||
|
return Obx( |
||||||
|
() => AlertDialog( |
||||||
|
title: const Text('数据同步中'), |
||||||
|
content: Column( |
||||||
|
mainAxisSize: MainAxisSize.min, |
||||||
|
children: [ |
||||||
|
LinearProgressIndicator( |
||||||
|
value: progressState.progress.value, |
||||||
|
backgroundColor: Colors.grey[300], |
||||||
|
valueColor: const AlwaysStoppedAnimation<Color>(Colors.blue), |
||||||
|
), |
||||||
|
const SizedBox(height: 16), |
||||||
|
Text( |
||||||
|
progressState.currentStep.value, |
||||||
|
style: const TextStyle(fontSize: 14), |
||||||
|
textAlign: TextAlign.center, |
||||||
|
), |
||||||
|
const SizedBox(height: 8), |
||||||
|
Text( |
||||||
|
'${(progressState.progress.value * 100).toStringAsFixed(1)}%', |
||||||
|
style: const TextStyle(fontSize: 12, color: Colors.grey), |
||||||
|
), |
||||||
|
], |
||||||
|
), |
||||||
|
), |
||||||
|
); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue