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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit(state.copyWith(status: CommentsStatus.loading));
|
||||||
|
|
||||||
if (state.item is Story) {
|
if (state.item is Story) {
|
||||||
final story = state.item;
|
final story = state.item;
|
||||||
final updatedStory = state.offlineReading
|
final updatedStory = state.offlineReading
|
||||||
@ -68,10 +70,11 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!isClosed) {
|
||||||
emit(state.copyWith(
|
emit(state.copyWith(
|
||||||
status: CommentsStatus.loaded,
|
status: CommentsStatus.loaded,
|
||||||
));
|
));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
final comment = state.item as Comment;
|
final comment = state.item as Comment;
|
||||||
|
|
||||||
@ -97,9 +100,11 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(state.copyWith(
|
if (!isClosed) {
|
||||||
status: CommentsStatus.loaded,
|
emit(state.copyWith(
|
||||||
));
|
status: CommentsStatus.loaded,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -206,7 +211,7 @@ class CommentsCubit<T extends Item> extends Cubit<CommentsState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onCommentFetched(Comment? comment) {
|
void _onCommentFetched(Comment? comment) {
|
||||||
if (comment != null) {
|
if (comment != null && !isClosed) {
|
||||||
_cacheService.cacheComment(comment);
|
_cacheService.cacheComment(comment);
|
||||||
emit(state.copyWith(comments: List.from(state.comments)..add(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)
|
if (state.comments.length == state.item.kids.length)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 240,
|
height: 240,
|
||||||
child: Center(
|
|
||||||
child: Text(
|
|
||||||
'The End',
|
|
||||||
style: TextStyle(color: Colors.grey),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -209,31 +209,28 @@ class CommentTile extends StatelessWidget {
|
|||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.only(left: 12),
|
padding: const EdgeInsets.only(left: 12),
|
||||||
child: Column(
|
child: Column(
|
||||||
children: state.comments
|
children: [
|
||||||
.map(
|
...state.comments.map(
|
||||||
(e) => FadeIn(
|
(e) => FadeIn(
|
||||||
child: CommentTile(
|
child: CommentTile(
|
||||||
comment: e,
|
comment: e,
|
||||||
onlyShowTargetComment:
|
onlyShowTargetComment:
|
||||||
onlyShowTargetComment &&
|
onlyShowTargetComment &&
|
||||||
targetComments.length > 1,
|
targetComments.length > 1,
|
||||||
targetComments: targetComments
|
targetComments: targetComments.isNotEmpty
|
||||||
.isNotEmpty
|
? targetComments.sublist(0,
|
||||||
? targetComments.sublist(
|
max(targetComments.length - 1, 0))
|
||||||
0,
|
: [],
|
||||||
max(targetComments.length - 1,
|
myUsername: myUsername,
|
||||||
0))
|
onReplyTapped: onReplyTapped,
|
||||||
: [],
|
onMoreTapped: onMoreTapped,
|
||||||
myUsername: myUsername,
|
onEditTapped: onEditTapped,
|
||||||
onReplyTapped: onReplyTapped,
|
level: level + 1,
|
||||||
onMoreTapped: onMoreTapped,
|
onStoryLinkTapped: onStoryLinkTapped,
|
||||||
onEditTapped: onEditTapped,
|
|
||||||
level: level + 1,
|
|
||||||
onStoryLinkTapped: onStoryLinkTapped,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
),
|
||||||
.toList(),
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user