mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-06 18:24:42 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
3fbf5d4eea | |||
332ffbb773 | |||
346a6c709e |
@ -359,7 +359,7 @@ class CommentsCubit extends Cubit<CommentsState> {
|
|||||||
.itemPositions.value
|
.itemPositions.value
|
||||||
// The header is also a part of the list view,
|
// The header is also a part of the list view,
|
||||||
// thus ignoring it here.
|
// thus ignoring it here.
|
||||||
.where((ItemPosition e) => e.index >= 1 && e.itemLeadingEdge < 0.7)
|
.where((ItemPosition e) => e.index >= 1 && e.itemLeadingEdge > 0.1)
|
||||||
.sorted((ItemPosition a, ItemPosition b) => a.index.compareTo(b.index))
|
.sorted((ItemPosition a, ItemPosition b) => a.index.compareTo(b.index))
|
||||||
.map(
|
.map(
|
||||||
(ItemPosition e) => e.index <= state.comments.length
|
(ItemPosition e) => e.index <= state.comments.length
|
||||||
@ -369,9 +369,19 @@ class CommentsCubit extends Cubit<CommentsState> {
|
|||||||
.whereNotNull()
|
.whereNotNull()
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
/// The index of last comment visible on screen.
|
if (onScreenComments.isEmpty && state.comments.isNotEmpty) {
|
||||||
final int lastVisibleIndex = state.comments.indexOf(onScreenComments.last);
|
itemScrollController.scrollTo(
|
||||||
final int startIndex = min(lastVisibleIndex + 1, totalComments);
|
index: 1,
|
||||||
|
alignment: 0.15,
|
||||||
|
duration: Durations.ms400,
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The index of first root level comment visible on screen.
|
||||||
|
final int firstVisibleRootIndex = state.comments
|
||||||
|
.indexOf(onScreenComments.firstWhere((Comment e) => e.isRoot));
|
||||||
|
final int startIndex = min(firstVisibleRootIndex + 1, totalComments);
|
||||||
|
|
||||||
for (int i = startIndex; i < totalComments; i++) {
|
for (int i = startIndex; i < totalComments; i++) {
|
||||||
final Comment cmt = state.comments.elementAt(i);
|
final Comment cmt = state.comments.elementAt(i);
|
||||||
|
@ -102,15 +102,12 @@ class InboxView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
Linkify(
|
Linkify(
|
||||||
text: e.text,
|
text: e.text,
|
||||||
style: Theme.of(context)
|
style: TextStyle(
|
||||||
.textTheme
|
color: unreadCommentsIds.contains(e.id)
|
||||||
.bodyLarge
|
? textColor
|
||||||
?.copyWith(
|
: Palette.grey,
|
||||||
color: unreadCommentsIds.contains(e.id)
|
fontSize: TextDimens.pt16,
|
||||||
? textColor
|
),
|
||||||
: Palette.grey,
|
|
||||||
fontSize: TextDimens.pt16,
|
|
||||||
),
|
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.primaryColor
|
.primaryColor
|
||||||
|
@ -51,7 +51,10 @@ class _SubmitScreenState extends State<SubmitScreen> with ItemActionMixin {
|
|||||||
backgroundColor: Theme.of(context).canvasColor,
|
backgroundColor: Theme.of(context).canvasColor,
|
||||||
elevation: Dimens.zero,
|
elevation: Dimens.zero,
|
||||||
leading: IconButton(
|
leading: IconButton(
|
||||||
icon: const Icon(Icons.close),
|
icon: Icon(
|
||||||
|
Icons.close,
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
showDialog<bool>(
|
showDialog<bool>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -83,8 +86,11 @@ class _SubmitScreenState extends State<SubmitScreen> with ItemActionMixin {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
title: const Text(
|
title: Text(
|
||||||
'Submit',
|
'Submit',
|
||||||
|
style: TextStyle(
|
||||||
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
actions: <Widget>[
|
actions: <Widget>[
|
||||||
if (state.status == Status.inProgress)
|
if (state.status == Status.inProgress)
|
||||||
|
@ -105,10 +105,9 @@ class ItemsListView<T extends Item> extends StatelessWidget {
|
|||||||
Linkify(
|
Linkify(
|
||||||
text: e.title,
|
text: e.title,
|
||||||
maxLines: 4,
|
maxLines: 4,
|
||||||
style:
|
style: const TextStyle(
|
||||||
Theme.of(context).textTheme.bodyLarge?.copyWith(
|
fontSize: TextDimens.pt16,
|
||||||
fontSize: TextDimens.pt16,
|
),
|
||||||
),
|
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
),
|
),
|
||||||
@ -141,7 +140,7 @@ class ItemsListView<T extends Item> extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (!showWebPreviewOnStoryTile)
|
if (useSimpleTileForStory || !showWebPreviewOnStoryTile)
|
||||||
const Divider(
|
const Divider(
|
||||||
height: Dimens.zero,
|
height: Dimens.zero,
|
||||||
),
|
),
|
||||||
@ -195,12 +194,9 @@ class ItemsListView<T extends Item> extends StatelessWidget {
|
|||||||
Linkify(
|
Linkify(
|
||||||
text: e.text,
|
text: e.text,
|
||||||
maxLines: 4,
|
maxLines: 4,
|
||||||
style: Theme.of(context)
|
style: const TextStyle(
|
||||||
.textTheme
|
fontSize: TextDimens.pt16,
|
||||||
.bodyLarge
|
),
|
||||||
?.copyWith(
|
|
||||||
fontSize: TextDimens.pt16,
|
|
||||||
),
|
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context).primaryColor,
|
color: Theme.of(context).primaryColor,
|
||||||
),
|
),
|
||||||
|
@ -96,6 +96,7 @@ class StoryTile extends StatelessWidget {
|
|||||||
.textTheme
|
.textTheme
|
||||||
.bodyLarge
|
.bodyLarge
|
||||||
?.color,
|
?.color,
|
||||||
|
fontWeight: hasRead ? null : FontWeight.w500,
|
||||||
fontSize: simpleTileFontSize,
|
fontSize: simpleTileFontSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: hacki
|
name: hacki
|
||||||
description: A Hacker News reader.
|
description: A Hacker News reader.
|
||||||
version: 2.0.0+125
|
version: 2.0.1+126
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
Reference in New Issue
Block a user