mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-06 18:24:42 +08:00
improved UI.
This commit is contained in:
@ -40,6 +40,8 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
||||
return;
|
||||
}
|
||||
|
||||
emit(state.copyWith(status: CommentsStatus.loading));
|
||||
|
||||
if (state.item is Story) {
|
||||
final story = state.item;
|
||||
final updatedStory = state.offlineReading
|
||||
@ -68,10 +70,11 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit(state.copyWith(
|
||||
status: CommentsStatus.loaded,
|
||||
));
|
||||
if (!isClosed) {
|
||||
emit(state.copyWith(
|
||||
status: CommentsStatus.loaded,
|
||||
));
|
||||
}
|
||||
} else {
|
||||
final comment = state.item as Comment;
|
||||
|
||||
@ -97,9 +100,11 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
||||
}
|
||||
}
|
||||
|
||||
emit(state.copyWith(
|
||||
status: CommentsStatus.loaded,
|
||||
));
|
||||
if (!isClosed) {
|
||||
emit(state.copyWith(
|
||||
status: CommentsStatus.loaded,
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,7 +211,7 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
||||
}
|
||||
|
||||
void _onCommentFetched(Comment? comment) {
|
||||
if (comment != null) {
|
||||
if (comment != null && !isClosed) {
|
||||
_cacheService.cacheComment(comment);
|
||||
emit(state.copyWith(comments: List.from(state.comments)..add(comment)));
|
||||
}
|
||||
|
@ -471,12 +471,6 @@ class _StoryScreenState extends State<StoryScreen> {
|
||||
if (state.comments.length == state.item.kids.length)
|
||||
const SizedBox(
|
||||
height: 240,
|
||||
child: Center(
|
||||
child: Text(
|
||||
'The End',
|
||||
style: TextStyle(color: Colors.grey),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
@ -209,31 +209,28 @@ class CommentTile extends StatelessWidget {
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left: 12),
|
||||
child: Column(
|
||||
children: state.comments
|
||||
.map(
|
||||
(e) => FadeIn(
|
||||
child: CommentTile(
|
||||
comment: e,
|
||||
onlyShowTargetComment:
|
||||
onlyShowTargetComment &&
|
||||
targetComments.length > 1,
|
||||
targetComments: targetComments
|
||||
.isNotEmpty
|
||||
? targetComments.sublist(
|
||||
0,
|
||||
max(targetComments.length - 1,
|
||||
0))
|
||||
: [],
|
||||
myUsername: myUsername,
|
||||
onReplyTapped: onReplyTapped,
|
||||
onMoreTapped: onMoreTapped,
|
||||
onEditTapped: onEditTapped,
|
||||
level: level + 1,
|
||||
onStoryLinkTapped: onStoryLinkTapped,
|
||||
),
|
||||
children: [
|
||||
...state.comments.map(
|
||||
(e) => FadeIn(
|
||||
child: CommentTile(
|
||||
comment: e,
|
||||
onlyShowTargetComment:
|
||||
onlyShowTargetComment &&
|
||||
targetComments.length > 1,
|
||||
targetComments: targetComments.isNotEmpty
|
||||
? targetComments.sublist(0,
|
||||
max(targetComments.length - 1, 0))
|
||||
: [],
|
||||
myUsername: myUsername,
|
||||
onReplyTapped: onReplyTapped,
|
||||
onMoreTapped: onMoreTapped,
|
||||
onEditTapped: onEditTapped,
|
||||
level: level + 1,
|
||||
onStoryLinkTapped: onStoryLinkTapped,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
|
Reference in New Issue
Block a user