Skip to content
Binary file modified assets/fonts/LichessIcons.ttf
Binary file not shown.
30 changes: 15 additions & 15 deletions fluttericon.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,6 @@
"crown"
]
},
{
"uid": "1274d7838088971ac536aa8fd4d4c970",
"css": "lichess",
"code": 59419,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M779.1 10C708.5 18.4 650.1 28 593.4 69.7 110.7 35.7-13.8 370.7 13.6 587.3 69.9 1004.3 638.4 1115.7 826.6 834 677.7 987.9 441.1 1009 260.1 895.7 79.2 782.3-10.1 547.8 93.7 351.3 197.5 154.8 379.9 90.7 580.6 128.1 629.2 99.7 685.1 63.7 733.7 64.4L699.8 161.6 954.9 589C946.1 702 845.7 711.2 845.7 711.2 834.2 681.8 813 652.4 748.8 590.5 684.7 528.6 399.5 386.9 433.1 266.3 393.1 405.7 639.3 549.4 713.9 619.6 788.5 689.8 822.4 740.4 829.8 754.7 829.8 754.7 1017.6 704.6 986.5 576.2L748 143.4Z",
"width": 1000
},
"search": [
"lichess"
]
},
{
"uid": "6f50db2f2fedbef2169c25553039e9f7",
"css": "tags",
Expand Down Expand Up @@ -565,6 +551,20 @@
"search": [
"body-cut"
]
},
{
"uid": "7777f0a33fc6c5c9f6e2c293dcb55c59",
"css": "logo_lichess",
"code": 59419,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M458.1 232.8Q455.7 245.1 455.7 250.5 455.7 306.1 618.2 422.4 780.6 538.7 813.6 604 873.4 587.8 881.1 520.4L659.9 149.7Q655.7 142.7 678.7 76.8 650.7 84.7 579.1 126.5 573.5 129.7 551.7 126.2 513 120 477.2 120 312.2 120 216.6 229.5 121.1 339 121.1 463.3 121.1 610 234.2 720.7 347.3 831.5 506.9 831.5 586.5 831.5 651.7 802.2 716.9 772.8 750.4 743.5 783.8 714.2 786.4 714.2 732.3 859.9 501.7 886.2 321.8 886.2 186.5 767.2 51.2 648.3 51.2 464.1 51.2 289.5 179.1 157.2 307 25 576.4 42 602.7 23.7 647.8 8.1T725.7-9.1 762.3 7.5Q762.3 9.6 736 122.2L942.4 496.7Q964.6 537 923.9 597.5T793.7 679.1Q784 681.7 764.7 655.5 708.2 579.2 617.7 509.3 419.1 356.1 419.1 260.2 419.1 220.5 435.8 215.3 458.1 208.3 458.1 232.8Z",
"width": 1020
},
"search": [
"logo_lichess"
]
}
]
}
}
16 changes: 0 additions & 16 deletions lib/src/model/relation/relation_repository_providers.dart

This file was deleted.

10 changes: 5 additions & 5 deletions lib/src/model/study/study.dart
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ sealed class StudyChapterMeta with _$StudyChapterMeta {
}

@Freezed(fromJson: true)
sealed class StudyPageData with _$StudyPageData {
const StudyPageData._();
sealed class StudyPageItem with _$StudyPageItem {
const StudyPageItem._();

const factory StudyPageData({
const factory StudyPageItem({
required StudyId id,
required String name,
required bool liked,
Expand All @@ -162,9 +162,9 @@ sealed class StudyPageData with _$StudyPageData {
required IList<StudyMember> members,
required IList<String> chapters,
required String? flair,
}) = _StudyPageData;
}) = _StudyPageItem;

factory StudyPageData.fromJson(Map<String, Object?> json) => _$StudyPageDataFromJson(json);
factory StudyPageItem.fromJson(Map<String, Object?> json) => _$StudyPageItemFromJson(json);
}

@Freezed(fromJson: true)
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/study/study_list_paginator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'study_list_paginator.g.dart';

typedef StudyList = ({IList<StudyPageData> studies, int? nextPage});
typedef StudyList = ({IList<StudyPageItem> studies, int? nextPage});

/// Gets a list of studies from the paginated API.
@riverpod
Expand Down
2 changes: 1 addition & 1 deletion lib/src/model/study/study_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class StudyRepository {
studies: pick(
paginator,
'currentPageResults',
).asListOrThrow((pick) => StudyPageData.fromJson(pick.asMapOrThrow())).toIList(),
).asListOrThrow((pick) => StudyPageItem.fromJson(pick.asMapOrThrow())).toIList(),
nextPage: pick(paginator, 'nextPage').asIntOrNull(),
);
},
Expand Down
8 changes: 4 additions & 4 deletions lib/src/styles/lichess_icons.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/// Flutter icons LichessIcons
/// Copyright (C) 2024 by original authors @ fluttericon.com, fontello.com
/// Copyright (C) 2025 by original authors @ fluttericon.com, fontello.com
/// This font was generated by FlutterIcon.com, which is derived from Fontello.
///
/// To use this font, place it in your fonts/ directory and include the
Expand All @@ -11,7 +11,7 @@
/// fonts:
/// - asset: fonts/LichessIcons.ttf
///
///
///
/// * Font Awesome 4, Copyright (C) 2016 by Dave Gandy
/// Author: Dave Gandy
/// License: SIL ()
Expand All @@ -27,13 +27,13 @@
///
import 'package:flutter/widgets.dart';

// dart format off
class LichessIcons {
LichessIcons._();

static const _kFontFam = 'LichessIcons';
static const String? _kFontPkg = null;

// dart format off
static const IconData patron = IconData(0xe800, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData target = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData blitz = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg);
Expand Down Expand Up @@ -61,7 +61,7 @@ class LichessIcons {
static const IconData tournament_cup = IconData(0xe818, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData cogs = IconData(0xe819, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData crown = IconData(0xe81a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData lichess = IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData logo_lichess = IconData(0xe81b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData adjust = IconData(0xe81c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData flow_cascade = IconData(0xe81d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData radio_tower_lichess = IconData(0xe81e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
Expand Down
67 changes: 46 additions & 21 deletions lib/src/tab_scaffold.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,43 +6,50 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:lichess_mobile/l10n/l10n.dart';
import 'package:lichess_mobile/src/constants.dart';
import 'package:lichess_mobile/src/styles/lichess_icons.dart';
import 'package:lichess_mobile/src/utils/l10n_context.dart';
import 'package:lichess_mobile/src/view/home/home_tab_screen.dart';
import 'package:lichess_mobile/src/view/learn/learn_tab_screen.dart';
import 'package:lichess_mobile/src/view/more/more_tab_screen.dart';
import 'package:lichess_mobile/src/view/puzzle/puzzle_tab_screen.dart';
import 'package:lichess_mobile/src/view/tools/tools_tab_screen.dart';
import 'package:lichess_mobile/src/view/watch/watch_tab_screen.dart';
import 'package:lichess_mobile/src/widgets/background.dart';
import 'package:material_symbols_icons/symbols.dart';

enum BottomTab {
home,
puzzles,
learn,
watch,
tools;
more;

String label(AppLocalizations strings) {
switch (this) {
case BottomTab.home:
return strings.mobileHomeTab;
case BottomTab.puzzles:
return strings.mobilePuzzlesTab;
case BottomTab.tools:
return strings.mobileToolsTab;
case BottomTab.learn:
return strings.learnMenu;
case BottomTab.watch:
return strings.mobileWatchTab;
case BottomTab.more:
return strings.more;
}
}

IconData get icon {
switch (this) {
case BottomTab.home:
return Symbols.home_rounded;
return LichessIcons.logo_lichess;
case BottomTab.puzzles:
return Symbols.extension_rounded;
case BottomTab.watch:
return Symbols.live_tv_rounded;
case BottomTab.tools:
return Symbols.handyman_rounded;
case BottomTab.learn:
return Symbols.school_rounded;
case BottomTab.more:
return Symbols.menu;
}
}
}
Expand All @@ -58,8 +65,10 @@ final currentNavigatorKeyProvider = Provider<GlobalKey<NavigatorState>>((ref) {
return puzzlesNavigatorKey;
case BottomTab.watch:
return watchNavigatorKey;
case BottomTab.tools:
return toolsNavigatorKey;
case BottomTab.learn:
return learnNavigatorKey;
case BottomTab.more:
return moreNavigatorKey;
}
});

Expand All @@ -70,22 +79,26 @@ final currentRootScrollControllerProvider = Provider<ScrollController>((ref) {
return homeScrollController;
case BottomTab.puzzles:
return puzzlesScrollController;
case BottomTab.tools:
return toolsScrollController;
case BottomTab.learn:
return learnScrollController;
case BottomTab.watch:
return watchScrollController;
case BottomTab.more:
return moreScrollController;
}
});

final homeNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'home');
final puzzlesNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'puzzles');
final toolsNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'tools');
final learnNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'learn');
final watchNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'watch');
final moreNavigatorKey = GlobalKey<NavigatorState>(debugLabel: 'more');

final homeScrollController = ScrollController(debugLabel: 'HomeScroll');
final puzzlesScrollController = ScrollController(debugLabel: 'PuzzlesScroll');
final toolsScrollController = ScrollController(debugLabel: 'ToolsScroll');
final learnScrollController = ScrollController(debugLabel: 'learnScroll');
final watchScrollController = ScrollController(debugLabel: 'WatchScroll');
final moreScrollController = ScrollController(debugLabel: 'MoreScroll');

final RouteObserver<PageRoute<void>> rootNavPageRouteObserver = RouteObserver<PageRoute<void>>();

Expand All @@ -97,14 +110,18 @@ final homeTabInteraction = _BottomTabInteraction();
/// interactions (pop stack, scroll to top) are done.
final puzzlesTabInteraction = _BottomTabInteraction();

/// A [ChangeNotifier] that can be used to notify when the Tools tab is tapped, and all the built interactions
/// A [ChangeNotifier] that can be used to notify when the learn tab is tapped, and all the built interactions
/// (pop stack, scroll to top) are done.
final toolsTabInteraction = _BottomTabInteraction();
final learnTabInteraction = _BottomTabInteraction();

/// A [ChangeNotifier] that can be used to notify when the Watch tab is tapped, and all the built in
/// interactions (pop stack, scroll to top) are done.
final watchTabInteraction = _BottomTabInteraction();

/// A [ChangeNotifier] that can be used to notify when the More tab is tapped, and all the built in
/// interactions (pop stack, scroll to top) are done.
final moreTabInteraction = _BottomTabInteraction();

class _BottomTabInteraction extends ChangeNotifier {
void notifyItemTapped() {
notifyListeners();
Expand Down Expand Up @@ -185,10 +202,12 @@ class MainTabScaffold extends ConsumerWidget {
homeTabInteraction.notifyItemTapped();
case BottomTab.puzzles:
puzzlesTabInteraction.notifyItemTapped();
case BottomTab.tools:
toolsTabInteraction.notifyItemTapped();
case BottomTab.learn:
learnTabInteraction.notifyItemTapped();
case BottomTab.watch:
watchTabInteraction.notifyItemTapped();
case BottomTab.more:
moreTabInteraction.notifyItemTapped();
}
}
} else {
Expand All @@ -211,16 +230,22 @@ class MainTabScaffold extends ConsumerWidget {
builder: (context) => const PuzzleTabScreen(),
);
case 2:
return _MaterialTabView(
navigatorKey: learnNavigatorKey,
tab: BottomTab.learn,
builder: (context) => const LearnTabScreen(),
);
case 3:
return _MaterialTabView(
navigatorKey: watchNavigatorKey,
tab: BottomTab.watch,
builder: (context) => const WatchTabScreen(),
);
case 3:
case 4:
return _MaterialTabView(
navigatorKey: toolsNavigatorKey,
tab: BottomTab.tools,
builder: (context) => const ToolsTabScreen(),
navigatorKey: moreNavigatorKey,
tab: BottomTab.more,
builder: (context) => const MoreTabScreen(),
);
default:
assert(false, 'Unexpected tab');
Expand Down
3 changes: 3 additions & 0 deletions lib/src/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,9 @@ ThemeData _makeBackgroundImageTheme({
? lighten(baseTheme.colorScheme.surface, 0.1).withValues(alpha: 0.9)
: baseTheme.colorScheme.surface.withValues(alpha: 0.9),
),
drawerTheme: DrawerThemeData(
backgroundColor: baseTheme.colorScheme.surfaceContainerLow.withValues(alpha: 0.9),
),
floatingActionButtonTheme: FloatingActionButtonThemeData(
backgroundColor: baseTheme.colorScheme.secondaryFixedDim,
foregroundColor: baseTheme.colorScheme.onSecondaryFixedVariant,
Expand Down
Loading