-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 使用 Material Design 3 中的 medium top app bar (#287)
- Loading branch information
Showing
50 changed files
with
2,131 additions
and
2,002 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,43 @@ | ||
part of 'board_home_bloc.dart'; | ||
|
||
abstract class BoardHomeState extends Equatable { | ||
const BoardHomeState(); | ||
class BoardHomeState extends Equatable { | ||
/// 当前状态 | ||
final BoardHomeStatus status; | ||
|
||
@override | ||
List<Object> get props => []; | ||
} | ||
|
||
class BoardHomeInProgress extends BoardHomeState { | ||
@override | ||
String toString() => 'BoardHomeInProgress'; | ||
} | ||
|
||
class BoardHomeFailure extends BoardHomeState { | ||
final String message; | ||
|
||
const BoardHomeFailure(this.message); | ||
|
||
@override | ||
List<Object> get props => [message]; | ||
|
||
@override | ||
String toString() => 'BoardHomeFailure(message: $message)'; | ||
} | ||
/// 错误信息 | ||
final String error; | ||
|
||
class BoardHomeSuccess extends BoardHomeState { | ||
/// 位置页面所需数据 | ||
final List<Topic> topics; | ||
final PageInfo pageInfo; | ||
|
||
const BoardHomeSuccess({ | ||
required this.topics, | ||
required this.pageInfo, | ||
const BoardHomeState({ | ||
this.status = BoardHomeStatus.initial, | ||
this.error = '', | ||
// 初始为空值 | ||
this.topics = const [], | ||
this.pageInfo = const PageInfo(hasNextPage: false), | ||
}); | ||
|
||
bool get hasReachedMax => !pageInfo.hasNextPage; | ||
|
||
@override | ||
List<Object> get props => [topics, pageInfo]; | ||
List<Object?> get props => [status, error, topics, pageInfo]; | ||
|
||
@override | ||
String toString() => | ||
'BoardHomeSuccess(topics: ${topics.length}, pageInfo: $pageInfo)'; | ||
bool get stringify => true; | ||
|
||
BoardHomeState copyWith({ | ||
BoardHomeStatus? status, | ||
String? error, | ||
List<Topic>? topics, | ||
PageInfo? pageInfo, | ||
}) { | ||
return BoardHomeState( | ||
status: status ?? this.status, | ||
error: error ?? this.error, | ||
topics: topics ?? this.topics, | ||
pageInfo: pageInfo ?? this.pageInfo, | ||
); | ||
} | ||
} |
Oops, something went wrong.