Compare commits

..

3 Commits

Author SHA1 Message Date
3fbf5d4eea improve shortcut button. (#284) 2023-10-22 20:34:09 -07:00
332ffbb773 bump version. (#282) 2023-10-22 00:14:12 -07:00
346a6c709e fix inconsistent font size. (#281) 2023-10-21 23:50:06 -07:00
6 changed files with 37 additions and 27 deletions

View File

@ -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);

View File

@ -102,10 +102,7 @@ class InboxView extends StatelessWidget {
), ),
Linkify( Linkify(
text: e.text, text: e.text,
style: Theme.of(context) style: TextStyle(
.textTheme
.bodyLarge
?.copyWith(
color: unreadCommentsIds.contains(e.id) color: unreadCommentsIds.contains(e.id)
? textColor ? textColor
: Palette.grey, : Palette.grey,

View File

@ -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)

View File

@ -105,8 +105,7 @@ 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(
@ -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,10 +194,7 @@ 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
.bodyLarge
?.copyWith(
fontSize: TextDimens.pt16, fontSize: TextDimens.pt16,
), ),
linkStyle: TextStyle( linkStyle: TextStyle(

View File

@ -96,6 +96,7 @@ class StoryTile extends StatelessWidget {
.textTheme .textTheme
.bodyLarge .bodyLarge
?.color, ?.color,
fontWeight: hasRead ? null : FontWeight.w500,
fontSize: simpleTileFontSize, fontSize: simpleTileFontSize,
), ),
), ),

View File

@ -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: