Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
refactor(home_page): always show titles in mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
zyrouge committed Oct 25, 2021
1 parent 81210c4 commit 2ef6458
Showing 1 changed file with 14 additions and 20 deletions.
34 changes: 14 additions & 20 deletions lib/pages/home_page/anime_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import '../../plugins/translator/translator.dart';
final StatefulHolder<myanimelist.HomeResult?> _cache =
StatefulHolder<myanimelist.HomeResult?>(null);

final bool _useHoverTitle = AppState.isDesktop;

class Page extends StatefulWidget {
const Page({
final Key? key,
Expand Down Expand Up @@ -101,20 +103,16 @@ class _PageState extends State<Page> with DidLoadStater {
animationDuration: animationDuration,
fastAnimationDuration: fastAnimationDuration,
entities: _cache.value!.seasonEntities,
active: (final int i) => seasonAnimeHoverIndex == i,
active: (final int i) =>
!_useHoverTitle || seasonAnimeHoverIndex == i,
onHover: (final int i, final bool hovered) {
setState(() {
seasonAnimeHoverIndex = hovered ? i : null;
});
},
onTap: (final int i, final VoidCallback openContainer) {
if (seasonAnimeHoverIndex != i) {
if (_useHoverTitle) {
setState(() {
seasonAnimeHoverIndex = i;
seasonAnimeHoverIndex = hovered ? i : null;
});
return;
}

},
onTap: (final int i, final VoidCallback openContainer) {
openContainer();
},
openBuilder: (
Expand All @@ -141,20 +139,16 @@ class _PageState extends State<Page> with DidLoadStater {
animationDuration: animationDuration,
fastAnimationDuration: fastAnimationDuration,
entities: _cache.value!.recentlyUpdated,
active: (final int i) => recentlyUpdatedHoverIndex == i,
active: (final int i) =>
!_useHoverTitle || recentlyUpdatedHoverIndex == i,
onHover: (final int i, final bool hovered) {
setState(() {
recentlyUpdatedHoverIndex = hovered ? i : null;
});
},
onTap: (final int i, final VoidCallback openContainer) {
if (recentlyUpdatedHoverIndex != i) {
if (_useHoverTitle) {
setState(() {
recentlyUpdatedHoverIndex = i;
recentlyUpdatedHoverIndex = hovered ? i : null;
});
return;
}

},
onTap: (final int i, final VoidCallback openContainer) {
openContainer();
},
openBuilder: (
Expand Down

0 comments on commit 2ef6458

Please sign in to comment.