Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions lib/core/iconography.dart
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,18 @@ class KapyIcons {
0xE092,
HugeIcons.strokeRoundedUserMultiple,
);
static const filterRounded = KapyIconData(
0xE0D0,
HugeIcons.strokeRoundedFilterHorizontal,
);
static const listViewRounded = KapyIconData(
0xE0D1,
HugeIcons.strokeRoundedListView,
);
static const gridViewRounded = KapyIconData(
0xE0D2,
HugeIcons.strokeRoundedGridView,
);
static const photoLibraryOutlined = KapyIconData(
0xE049,
HugeIcons.strokeRoundedImage02,
Expand Down
17 changes: 17 additions & 0 deletions lib/core/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ class CalcPalette extends ThemeExtension<CalcPalette> {
/// A switch that is off: the track reads as a slot, not as a control.
final Color switchTrackOff;

/// The title on a note's sticky card or list row, and the sage that marks
/// a link inside the list, such as See all.
final Color cardTitle;
final Color accentText;

/// How much of the desktop the window's chrome lets through: a multiplier on
/// the alpha of every [GlassSurface]. 1 is fully opaque.
///
Expand Down Expand Up @@ -230,6 +235,8 @@ class CalcPalette extends ThemeExtension<CalcPalette> {
required this.cardBackground,
required this.paneEdge,
required this.switchTrackOff,
required this.cardTitle,
required this.accentText,
this.translucency = 1,
this.paperTranslucency = 1,
});
Expand Down Expand Up @@ -292,6 +299,8 @@ class CalcPalette extends ThemeExtension<CalcPalette> {
Color? cardBackground,
Color? paneEdge,
Color? switchTrackOff,
Color? cardTitle,
Color? accentText,
double? translucency,
double? paperTranslucency,
}) => CalcPalette(
Expand Down Expand Up @@ -351,6 +360,8 @@ class CalcPalette extends ThemeExtension<CalcPalette> {
cardBackground: cardBackground ?? this.cardBackground,
paneEdge: paneEdge ?? this.paneEdge,
switchTrackOff: switchTrackOff ?? this.switchTrackOff,
cardTitle: cardTitle ?? this.cardTitle,
accentText: accentText ?? this.accentText,
translucency: translucency ?? this.translucency,
paperTranslucency: paperTranslucency ?? this.paperTranslucency,
);
Expand Down Expand Up @@ -419,6 +430,8 @@ class CalcPalette extends ThemeExtension<CalcPalette> {
cardBackground: mix(cardBackground, other.cardBackground),
paneEdge: mix(paneEdge, other.paneEdge),
switchTrackOff: mix(switchTrackOff, other.switchTrackOff),
cardTitle: mix(cardTitle, other.cardTitle),
accentText: mix(accentText, other.accentText),
translucency: translucency + (other.translucency - translucency) * t,
paperTranslucency:
paperTranslucency + (other.paperTranslucency - paperTranslucency) * t,
Expand Down Expand Up @@ -1000,6 +1013,8 @@ class KapyTheme {
cardBackground: Color(0xFF292621),
paneEdge: Color(0xFF2C2924),
switchTrackOff: Color(0xFF3A362F),
cardTitle: Color(0xFFD9D3C6),
accentText: Color(0xFF9DB384),
);

/// A cool, clean paper palette rather than the previous warm stationery.
Expand Down Expand Up @@ -1062,6 +1077,8 @@ class KapyTheme {
cardBackground: Color(0xFFF2F1ED),
paneEdge: Color(0xFFE2E0DA),
switchTrackOff: Color(0xFFDAD8D2),
cardTitle: Color(0xFF2A2620),
accentText: Color(0xFF56703C),
);

/// Transparency mode.
Expand Down
14 changes: 14 additions & 0 deletions lib/data/layout_prefs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class LayoutPrefs extends ChangeNotifier {
static const String _resultsVisibleKey = 'resultsVisible.v1';
static const String _sidebarKey = 'sidebar.v1';
static const String _hiddenFolderVisibleKey = 'hiddenFolderVisible.v1';
static const String _noteCardsKey = 'noteCards.v1';
static const String _windowWidthKey = 'windowWidth.v1';
static const String _windowHeightKey = 'windowHeight.v1';
static const String _windowXKey = 'windowX.v1';
Expand Down Expand Up @@ -140,6 +141,7 @@ class LayoutPrefs extends ChangeNotifier {
double _sidebarWidth = defaultSidebarWidth;
bool _sidebarVisible = false;
bool _hiddenFolderVisible = true;
bool _noteCards = true;
Size _windowSize = defaultWindowSize;
Offset? _windowPosition;
bool _readyToTypeOnOpen = true;
Expand Down Expand Up @@ -181,6 +183,10 @@ class LayoutPrefs extends ChangeNotifier {
double get sidebarWidth => _sidebarWidth;
bool get sidebarVisible => _sidebarVisible;
bool get hiddenFolderVisible => _hiddenFolderVisible;

/// Whether the desktop notes list draws its notes as sticky cards rather
/// than as rows. Cards are how the list first appears.
bool get noteCards => _noteCards;
Size get windowSize => _windowSize;
Offset? get windowPosition => _windowPosition;

Expand Down Expand Up @@ -330,6 +336,7 @@ class LayoutPrefs extends ChangeNotifier {
// state for this session, not a preference carried into the next one.
_sidebarVisible = false;
_hiddenFolderVisible = _store.read<bool>(_hiddenFolderVisibleKey) ?? true;
_noteCards = _store.read<bool>(_noteCardsKey) ?? true;
_windowSize = _clampWindowSize(
Size(
_readDouble(_windowWidthKey) ?? defaultWindowSize.width,
Expand Down Expand Up @@ -769,6 +776,13 @@ class LayoutPrefs extends ChangeNotifier {

void toggleHiddenFolder() => hiddenFolderVisible = !_hiddenFolderVisible;

set noteCards(bool value) {
if (value == _noteCards) return;
_noteCards = value;
_store.putNow(_noteCardsKey, value);
notifyListeners();
}

void toggleSidebar() {
_sidebarVisible = !_sidebarVisible;
notifyListeners();
Expand Down
4 changes: 4 additions & 0 deletions lib/data/notes_store.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class NotesStore extends ChangeNotifier {

final LocalStore _store;
final DateTime Function() _now;

/// The time the store dates its notes by, for anything that says how long
/// ago they were changed.
DateTime now() => _now();
List<Note> _notes = const [];
List<Note> _activeNotes = const [];
List<Note> _archivedNotes = const [];
Expand Down
34 changes: 33 additions & 1 deletion lib/ui/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import 'empty_state.dart';
import 'hidden_notes_gate.dart';
import 'kapy_header_mascot.dart';
import 'mobile_page_swipe.dart';
import 'notes_list.dart';
import 'sidebar.dart';
import 'settings_dialog.dart';
import 'sidebar_swipe.dart';
Expand Down Expand Up @@ -207,6 +208,16 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
/// wide window: the compact list has no rail to leave it by.
bool _drawingsOnly = false;

/// The kinds of media the list beside the rail is narrowed to. Not kept
/// across launches, so a filter left on cannot pass for missing notes.
Set<NoteMedia> _mediaFilter = NoteMedia.values.toSet();

/// Whether that list shows every pinned note, after See all.
bool _pinnedOnly = false;

bool get _showingPinnedOnly =>
_pinnedOnly && !_specialMode && widget.notes.pinnedNoteIds.isNotEmpty;

bool _initialNoteScheduled = false;
bool _openSessionScheduled = false;
bool _drawerContentReady = false;
Expand Down Expand Up @@ -2325,6 +2336,7 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
/// are.
void _showSpace(LibrarySpace space) {
if (space == _space) return;
_pinnedOnly = false;
switch (space) {
case LibrarySpace.archive:
_toggleArchive();
Expand All @@ -2343,13 +2355,23 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
}

List<Note> get _visibleNotes {
final notes = _narrowed(
var notes = _narrowed(
_archiveMode
? widget.notes.searchArchived(_query)
: _hiddenMode
? widget.notes.searchHidden(_query)
: widget.notes.search(_query),
);
final pinnedOnly = _showingPinnedOnly;
if (pinnedOnly || _mediaFilter.length < NoteMedia.values.length) {
final pinned = widget.notes.pinnedNoteIds;
notes = [
for (final note in notes)
if (NoteMedia.shows(note, _mediaFilter) &&
(!pinnedOnly || pinned.contains(note.id)))
note,
];
}
final recent = widget.prefs.recentlyOpenedNoteIds;
if (notes.length < 2 || recent.isEmpty) return notes;

Expand Down Expand Up @@ -2571,6 +2593,16 @@ class _HomePageState extends State<HomePage> with WidgetsBindingObserver {
emptyMessage: space == LibrarySpace.drawings
? 'No drawings yet'
: null,
engine: widget.engines.engine,
now: widget.notes.now,
cards: widget.prefs.noteCards,
onCardsChanged: (cards) => widget.prefs.noteCards = cards,
mediaFilter: _mediaFilter,
onMediaFilterChanged: (media) =>
setState(() => _mediaFilter = media),
pinnedOnly: _showingPinnedOnly,
onPinnedOnlyChanged: (value) =>
setState(() => _pinnedOnly = value),
windowBar: SidebarWindowBar(
title: space.title,
count: _spaceCount,
Expand Down
Loading
Loading