1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import 'package:widgets/load_state_layout.dart';
- class NewsState {
- //页面 LoadView 状态的展示
- LoadState loadingState;
- String? errorMessage;
- List<Map<String, dynamic>>? list = [];
- NewsState({
- this.loadingState = LoadState.State_Loading,
- String? errorMessage,
- this.list,
- });
- NewsState copyWith({
- LoadState? loadingState,
- String? errorMessage,
- int? page,
- int? limit,
- int? count,
- List<Map<String, dynamic>>? list,
- List<String>? tabsList,
- }) {
- return NewsState(
- loadingState: loadingState ?? this.loadingState,
- errorMessage: errorMessage ?? this.errorMessage,
- list: list ?? this.list,
- );
- }
- Map<String, dynamic> toMap() {
- return {
- 'loadingState': this.loadingState,
- 'errorMessage': this.errorMessage,
- 'list': this.list,
- };
- }
- factory NewsState.fromMap(Map<String, dynamic> map) {
- return NewsState(
- loadingState: map['loadingState'] as LoadState,
- errorMessage: map['errorMessage'] as String,
- list: map['list'] as List<Map<String, dynamic>>,
- );
- }
- }
|