mirror of
https://github.com/Livinglist/Hacki.git
synced 2025-08-06 18:24:42 +08:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
ff7e115418 |
@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
|
|||||||
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
import 'package:flutter_feather_icons/flutter_feather_icons.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:hacki/blocs/blocs.dart';
|
import 'package:hacki/blocs/blocs.dart';
|
||||||
|
import 'package:hacki/config/constants.dart';
|
||||||
import 'package:hacki/config/locator.dart';
|
import 'package:hacki/config/locator.dart';
|
||||||
import 'package:hacki/cubits/cubits.dart';
|
import 'package:hacki/cubits/cubits.dart';
|
||||||
import 'package:hacki/extensions/extensions.dart';
|
import 'package:hacki/extensions/extensions.dart';
|
||||||
@ -77,8 +78,23 @@ class MorePopupMenu extends StatelessWidget {
|
|||||||
return Semantics(
|
return Semantics(
|
||||||
excludeSemantics: state.status == Status.inProgress,
|
excludeSemantics: state.status == Status.inProgress,
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: const Icon(
|
leading: Column(
|
||||||
Icons.account_circle,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: <Widget>[
|
||||||
|
AnimatedCrossFade(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
duration: Durations.ms300,
|
||||||
|
crossFadeState: state.status.isLoading
|
||||||
|
? CrossFadeState.showFirst
|
||||||
|
: CrossFadeState.showSecond,
|
||||||
|
firstChild: const Icon(
|
||||||
|
Icons.account_circle_outlined,
|
||||||
|
),
|
||||||
|
secondChild: const Icon(
|
||||||
|
Icons.account_circle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
title: Text(item.by),
|
title: Text(item.by),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
|
@ -3,6 +3,7 @@ import 'package:flutter/rendering.dart';
|
|||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||||
import 'package:hacki/blocs/blocs.dart';
|
import 'package:hacki/blocs/blocs.dart';
|
||||||
|
import 'package:hacki/config/constants.dart';
|
||||||
import 'package:hacki/cubits/cubits.dart';
|
import 'package:hacki/cubits/cubits.dart';
|
||||||
import 'package:hacki/extensions/extensions.dart';
|
import 'package:hacki/extensions/extensions.dart';
|
||||||
import 'package:hacki/models/models.dart';
|
import 'package:hacki/models/models.dart';
|
||||||
@ -68,8 +69,18 @@ class _StoriesListViewState extends State<StoriesListView>
|
|||||||
previous.currentPageByType[storyType] == 0) ||
|
previous.currentPageByType[storyType] == 0) ||
|
||||||
(previous.storiesByType[storyType]!.length !=
|
(previous.storiesByType[storyType]!.length !=
|
||||||
current.storiesByType[storyType]!.length) ||
|
current.storiesByType[storyType]!.length) ||
|
||||||
(previous.readStoriesIds.length != current.readStoriesIds.length),
|
(previous.readStoriesIds.length !=
|
||||||
|
current.readStoriesIds.length) ||
|
||||||
|
(previous.statusByType[widget.storyType] !=
|
||||||
|
current.statusByType[widget.storyType]),
|
||||||
builder: (BuildContext context, StoriesState state) {
|
builder: (BuildContext context, StoriesState state) {
|
||||||
|
bool shouldShowLoadButton() {
|
||||||
|
return preferenceState.manualPaginationEnabled &&
|
||||||
|
state.statusByType[widget.storyType] == Status.success &&
|
||||||
|
(state.storiesByType[widget.storyType]?.length ?? 0) <
|
||||||
|
(state.storyIdsByType[widget.storyType]?.length ?? 0);
|
||||||
|
}
|
||||||
|
|
||||||
return ItemsListView<Story>(
|
return ItemsListView<Story>(
|
||||||
showOfflineBanner: true,
|
showOfflineBanner: true,
|
||||||
markReadStories: preferenceState.markReadStoriesEnabled,
|
markReadStories: preferenceState.markReadStoriesEnabled,
|
||||||
@ -100,30 +111,38 @@ class _StoriesListViewState extends State<StoriesListView>
|
|||||||
onPinned: context.read<PinCubit>().pinStory,
|
onPinned: context.read<PinCubit>().pinStory,
|
||||||
header: state.isOfflineReading ? null : header,
|
header: state.isOfflineReading ? null : header,
|
||||||
loadStyle: LoadStyle.HideAlways,
|
loadStyle: LoadStyle.HideAlways,
|
||||||
footer: preferenceState.manualPaginationEnabled &&
|
footer: Center(
|
||||||
state.statusByType[widget.storyType] == Status.success &&
|
child: AnimatedCrossFade(
|
||||||
(state.storiesByType[widget.storyType]?.length ?? 0) <
|
alignment: Alignment.center,
|
||||||
(state.storyIdsByType[widget.storyType]?.length ?? 0)
|
crossFadeState: shouldShowLoadButton()
|
||||||
? Padding(
|
? CrossFadeState.showFirst
|
||||||
padding: const EdgeInsets.only(
|
: CrossFadeState.showSecond,
|
||||||
left: Dimens.pt48,
|
duration: Durations.ms300,
|
||||||
right: Dimens.pt48,
|
firstChild: Padding(
|
||||||
top: Dimens.pt36,
|
padding: const EdgeInsets.only(
|
||||||
bottom: Dimens.pt12,
|
left: Dimens.pt48,
|
||||||
),
|
right: Dimens.pt48,
|
||||||
child: OutlinedButton(
|
top: Dimens.pt36,
|
||||||
onPressed: loadMoreStories,
|
bottom: Dimens.pt12,
|
||||||
style: ButtonStyle(
|
),
|
||||||
foregroundColor: MaterialStateColor.resolveWith(
|
child: OutlinedButton(
|
||||||
(_) => Theme.of(context).colorScheme.onSurface,
|
onPressed: loadMoreStories,
|
||||||
),
|
style: ButtonStyle(
|
||||||
|
minimumSize: MaterialStateProperty.all(
|
||||||
|
const Size(double.infinity, Dimens.pt48),
|
||||||
),
|
),
|
||||||
child: Text(
|
foregroundColor: MaterialStateColor.resolveWith(
|
||||||
'''Load Page ${(state.currentPageByType[widget.storyType] ?? 0) + 2}''',
|
(_) => Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
child: Text(
|
||||||
: null,
|
'''Load Page ${(state.currentPageByType[widget.storyType] ?? 0) + 2}''',
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
secondChild: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
|
),
|
||||||
onMoreTapped: onMoreTapped,
|
onMoreTapped: onMoreTapped,
|
||||||
itemBuilder: (Widget child, Story story) {
|
itemBuilder: (Widget child, Story story) {
|
||||||
return Slidable(
|
return Slidable(
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name: hacki
|
name: hacki
|
||||||
description: A Hacker News reader.
|
description: A Hacker News reader.
|
||||||
version: 2.3.0+129
|
version: 2.3.1+130
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
Reference in New Issue
Block a user