123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- class NewsState {
- int? activeTabIndex =0;
- int? curPage =0;
- int? pageSize =10;
- int? filterCount =0;
- List<String>? tabsList = ['News', 'Following', 'For You'];
- List<Map<String, dynamic>>? list = [];
- NewsState({
- this.activeTabIndex,
- this.curPage,
- this.pageSize,
- this.filterCount,
- this.tabsList,
- this.list,
- });
- NewsState copyWith({
- int? activeTabIndex,
- int? curPage,
- int? pageSize,
- int? filterCount,
- List<String>? tabsList,
- List<Map<String, dynamic>>? list,
- }) {
- return NewsState(
- activeTabIndex: activeTabIndex ?? this.activeTabIndex,
- curPage: curPage ?? this.curPage,
- pageSize: pageSize ?? this.pageSize,
- filterCount: filterCount ?? this.filterCount,
- tabsList: tabsList ?? this.tabsList,
- list: list ?? this.list,
- );
- }
- Map<String, dynamic> toMap() {
- return {
- 'activeTabIndex': this.activeTabIndex,
- 'curPage': this.curPage,
- 'pageSize': this.pageSize,
- 'filterCount': this.filterCount,
- 'tabsList': this.tabsList,
- 'list': this.list,
- };
- }
- factory NewsState.fromMap(Map<String, dynamic> map) {
- return NewsState(
- activeTabIndex: map['activeTabIndex'] as int,
- curPage: map['curPage'] as int,
- pageSize: map['pageSize'] as int,
- filterCount: map['filterCount'] as int,
- tabsList: map['tabsList'] as List<String>,
- list: map['list'] as List<Map<String, dynamic>>,
- );
- }
- }
|