diff --git a/lib/core/iconography.dart b/lib/core/iconography.dart index a5cef41..0fdc698 100644 --- a/lib/core/iconography.dart +++ b/lib/core/iconography.dart @@ -576,4 +576,72 @@ class KapyIcons { 0xE086, HugeIcons.strokeRoundedZoomInArea, ); + + // The settings dialog's rail and General pane, as Riverbank draws them. + static const paintBoardOutlined = KapyIconData( + 0xE0C0, + HugeIcons.strokeRoundedPaintBoard, + ); + static const commandOutlined = KapyIconData( + 0xE0C1, + HugeIcons.strokeRoundedCommand, + ); + static const refreshOutlined = KapyIconData( + 0xE0C2, + HugeIcons.strokeRoundedRefresh, + ); + static const textCursorOutlined = KapyIconData( + 0xE0C3, + HugeIcons.strokeRoundedInputCursorText, + ); + static const spellCheckOutlined = KapyIconData(0xE0C4, [ + [ + 'path', + { + 'd': + 'M5.992 13h9m1 1.857l-2.61-7.033C12.187 4.607 11.59 2.998 10.55 3S8.918 4.612 7.732 7.833L3.993 18m9.999 1.393s1.2.652 1.8 1.607c0 0 1.8-3.75 4.2-5', + 'stroke': 'currentColor', + 'strokeWidth': '1.5', + 'strokeLinecap': 'round', + 'strokeLinejoin': 'round', + }, + ], + ]); + static const hashtagOutlined = KapyIconData( + 0xE0C5, + HugeIcons.strokeRoundedHashtag, + ); + static const uploadOutlined = KapyIconData( + 0xE0C6, + HugeIcons.strokeRoundedUpload04, + ); + static const lockKeyOutlined = KapyIconData( + 0xE0C7, + HugeIcons.strokeRoundedLockKey, + ); + static const computerOutlined = KapyIconData( + 0xE0C8, + HugeIcons.strokeRoundedComputer, + ); + static const panelColumnsOutlined = KapyIconData(0xE0C9, [ + [ + 'path', + { + 'd': + 'M20.109 3.891C21.5 5.282 21.5 7.521 21.5 12c0 4.478 0 6.718-1.391 8.109S16.479 21.5 12 21.5c-4.478 0-6.718 0-8.109-1.391S2.5 16.479 2.5 12c0-4.478 0-6.718 1.391-8.109S7.521 2.5 12 2.5c4.478 0 6.718 0 8.109 1.391', + 'stroke': 'currentColor', + 'strokeWidth': '1.5', + 'strokeLinecap': 'round', + 'strokeLinejoin': 'round', + }, + ], + [ + 'path', + { + 'd': 'M8.5 2.5v19m7-19v19', + 'stroke': 'currentColor', + 'strokeWidth': '1.5', + }, + ], + ]); } diff --git a/lib/core/theme.dart b/lib/core/theme.dart index 46827f8..04c9292 100644 --- a/lib/core/theme.dart +++ b/lib/core/theme.dart @@ -90,6 +90,22 @@ class CalcPalette extends ThemeExtension { /// that counts invitations. final Color clay; + /// The type ladder under the primary ink: a window or dialog's own title, + /// the heading over a group, the label of a row that is not selected, and + /// the line that describes what a row does. + final Color textHeading; + final Color textSubheading; + final Color textMuted; + final Color textDescription; + + /// A card of rows inside a dialog, a step off the pane it sits on, and the + /// edge between a dialog's navigation and its pane. + final Color cardBackground; + final Color paneEdge; + + /// A switch that is off: the track reads as a slot, not as a control. + final Color switchTrackOff; + /// How much of the desktop the window's chrome lets through: a multiplier on /// the alpha of every [GlassSurface]. 1 is fully opaque. /// @@ -207,6 +223,13 @@ class CalcPalette extends ThemeExtension { required this.totalPillBackground, required this.totalPillText, required this.clay, + required this.textHeading, + required this.textSubheading, + required this.textMuted, + required this.textDescription, + required this.cardBackground, + required this.paneEdge, + required this.switchTrackOff, this.translucency = 1, this.paperTranslucency = 1, }); @@ -262,6 +285,13 @@ class CalcPalette extends ThemeExtension { Color? totalPillBackground, Color? totalPillText, Color? clay, + Color? textHeading, + Color? textSubheading, + Color? textMuted, + Color? textDescription, + Color? cardBackground, + Color? paneEdge, + Color? switchTrackOff, double? translucency, double? paperTranslucency, }) => CalcPalette( @@ -314,6 +344,13 @@ class CalcPalette extends ThemeExtension { totalPillBackground: totalPillBackground ?? this.totalPillBackground, totalPillText: totalPillText ?? this.totalPillText, clay: clay ?? this.clay, + textHeading: textHeading ?? this.textHeading, + textSubheading: textSubheading ?? this.textSubheading, + textMuted: textMuted ?? this.textMuted, + textDescription: textDescription ?? this.textDescription, + cardBackground: cardBackground ?? this.cardBackground, + paneEdge: paneEdge ?? this.paneEdge, + switchTrackOff: switchTrackOff ?? this.switchTrackOff, translucency: translucency ?? this.translucency, paperTranslucency: paperTranslucency ?? this.paperTranslucency, ); @@ -375,6 +412,13 @@ class CalcPalette extends ThemeExtension { totalPillBackground: mix(totalPillBackground, other.totalPillBackground), totalPillText: mix(totalPillText, other.totalPillText), clay: mix(clay, other.clay), + textHeading: mix(textHeading, other.textHeading), + textSubheading: mix(textSubheading, other.textSubheading), + textMuted: mix(textMuted, other.textMuted), + textDescription: mix(textDescription, other.textDescription), + cardBackground: mix(cardBackground, other.cardBackground), + paneEdge: mix(paneEdge, other.paneEdge), + switchTrackOff: mix(switchTrackOff, other.switchTrackOff), translucency: translucency + (other.translucency - translucency) * t, paperTranslucency: paperTranslucency + (other.paperTranslucency - paperTranslucency) * t, @@ -949,6 +993,13 @@ class KapyTheme { totalPillBackground: Color(0xFF7D9468), totalPillText: Color(0xFF1C1A17), clay: Color(0xFFCF7A57), + textHeading: Color(0xFFDAD4C7), + textSubheading: Color(0xFFD3CCBE), + textMuted: Color(0xFFB2AA9A), + textDescription: Color(0xFF9C9485), + cardBackground: Color(0xFF292621), + paneEdge: Color(0xFF2C2924), + switchTrackOff: Color(0xFF3A362F), ); /// A cool, clean paper palette rather than the previous warm stationery. @@ -1004,6 +1055,13 @@ class KapyTheme { totalPillBackground: Color(0xFF56703C), totalPillText: Color(0xFFFCFAF4), clay: Color(0xFFD0663B), + textHeading: Color(0xFF292B30), + textSubheading: Color(0xFF3F4248), + textMuted: Color(0xFF55585E), + textDescription: Color(0xFF6B6D73), + cardBackground: Color(0xFFF2F1ED), + paneEdge: Color(0xFFE2E0DA), + switchTrackOff: Color(0xFFDAD8D2), ); /// Transparency mode. @@ -1208,6 +1266,7 @@ class KapyTheme { ), dialogTheme: DialogThemeData( backgroundColor: palette.surfaceBackground, + barrierColor: palette.scrim, surfaceTintColor: Colors.transparent, elevation: 0, shadowColor: Colors.transparent, diff --git a/lib/ui/account/sharing_pane.dart b/lib/ui/account/sharing_pane.dart index d047a39..1badd30 100644 --- a/lib/ui/account/sharing_pane.dart +++ b/lib/ui/account/sharing_pane.dart @@ -38,7 +38,7 @@ class SharingPane extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const SettingsLabel('SHARING'), + const SettingsLabel('Sharing'), SettingsGroup( children: [ SettingsRow( @@ -226,7 +226,7 @@ class _SharingPaneBodyState extends State { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const SettingsLabel('SHARING'), + const SettingsLabel('Sharing'), SettingsGroup( key: const ValueKey('sharing-group'), children: [ @@ -298,8 +298,8 @@ class _SharingPaneBodyState extends State { : 'Share from the people button, or long-press a note.', ), if (sharing.blocks.isNotEmpty) ...[ - const SizedBox(height: 18), - const SettingsLabel('BLOCKED'), + SizedBox(height: SettingsMetrics.groupGap), + const SettingsLabel('Blocked'), SettingsGroup( children: [ for (final block in sharing.blocks) diff --git a/lib/ui/account/sync_pane.dart b/lib/ui/account/sync_pane.dart index 9593d31..76b4574 100644 --- a/lib/ui/account/sync_pane.dart +++ b/lib/ui/account/sync_pane.dart @@ -1156,8 +1156,8 @@ class _ReadyState extends State<_Ready> { onTap: () => unawaited(showProSheet(context, billing: billing)), ), ], - const SizedBox(height: 18), - const SettingsLabel('ACCOUNT'), + SizedBox(height: SettingsMetrics.groupGap), + const SettingsLabel('Account'), SettingsGroup( children: [ SettingsRow( @@ -1303,7 +1303,7 @@ class DeleteAccountSettings extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const SettingsLabel('ACCOUNT DELETION'), + const SettingsLabel('Account deletion'), SettingsGroup( children: [ SettingsRow( diff --git a/lib/ui/control_surface.dart b/lib/ui/control_surface.dart index eaf240f..8161ce8 100644 --- a/lib/ui/control_surface.dart +++ b/lib/ui/control_surface.dart @@ -16,14 +16,15 @@ InputDecoration kapyFieldDecoration( BoxConstraints? suffixIconConstraints, EdgeInsetsGeometry? contentPadding, Color? fillColor, + double? borderWidth, + double? radius, }) { final palette = context.palette; final error = Theme.of(context).colorScheme.error; - OutlineInputBorder border(Color color, {double width = 1}) => - OutlineInputBorder( - borderRadius: BorderRadius.circular(AppRadii.control), - borderSide: BorderSide(color: color, width: width), - ); + OutlineInputBorder border(Color color, {double? width}) => OutlineInputBorder( + borderRadius: BorderRadius.circular(radius ?? AppRadii.control), + borderSide: BorderSide(color: color, width: width ?? borderWidth ?? 1), + ); return InputDecoration( hintText: hintText, diff --git a/lib/ui/settings_dialog.dart b/lib/ui/settings_dialog.dart index 1e37030..e5404b3 100644 --- a/lib/ui/settings_dialog.dart +++ b/lib/ui/settings_dialog.dart @@ -25,6 +25,7 @@ import '../speech/transcriber.dart'; import 'model_terms_sheet.dart'; import 'settings_rows.dart'; import 'settings_search.dart'; +import 'tonal_button.dart'; import 'sidebar_timestamp.dart'; import '../speech/local_models.dart'; import '../speech/speech_errors.dart'; @@ -87,6 +88,17 @@ extension SettingsSectionCopy on SettingsSection { SettingsSection.updates => KapyIcons.systemUpdateRounded, }; + /// The glyph beside the label in the desktop dialog's rail. + KapyIconData get railIcon => switch (this) { + SettingsSection.general => KapyIcons.tuneRounded, + SettingsSection.sync => KapyIcons.accountCircleOutlined, + SettingsSection.plan => KapyIcons.verifiedOutlined, + SettingsSection.voice => KapyIcons.micRounded, + SettingsSection.appearance => KapyIcons.paintBoardOutlined, + SettingsSection.shortcuts => KapyIcons.commandOutlined, + SettingsSection.updates => KapyIcons.refreshOutlined, + }; + /// What is behind the label, for the layouts that show a list of categories /// instead of the categories themselves. Names the contents rather than /// selling them: this line is read while looking for something. @@ -248,10 +260,10 @@ class _SettingsDialogState extends State /// Other desktop platforms may still stack at their narrowest. Windows /// borrows enough host-window width before opening, and always keeps the /// section rail visible while that resize reaches Flutter. - static const double _railBreakpoint = 520; - static const double _railWidth = 164; - static const double _panedWidth = 600; - static const double _stackedWidth = 440; + static const double _railBreakpoint = 560; + static const double _dialogWidth = 820; + static const double _dialogHeight = 700; + static const double _navWidth = 224; String? _shortcutError; String? _loginItemError; @@ -574,7 +586,7 @@ class _SettingsDialogState extends State (_speechConsent?.isAccepted ?? false) && prefs.transcriptEngine == TranscriptEngine.cloud; return [ - const SettingsLabel('TRANSCRIPTION'), + const SettingsLabel('Transcription'), SettingsGroup( children: [ _EngineChoiceRow( @@ -619,8 +631,8 @@ class _SettingsDialogState extends State ), ), ), - const SizedBox(height: 18), - const SettingsLabel('RECORDINGS & SUMMARIES'), + SizedBox(height: SettingsMetrics.groupGap), + const SettingsLabel('Recordings & summaries'), SettingsGroup( children: [ SettingsToggleRow( @@ -1143,34 +1155,145 @@ class _SettingsDialogState extends State Widget _buildDialog(BuildContext context) { final media = MediaQuery.sizeOf(context); - final available = media.width - 80; - final paned = AppPlatform.isWindows || available >= _railBreakpoint; - final width = math.min(paned ? _panedWidth : _stackedWidth, available); - // A fixed height keeps the dialog from resizing under the pointer - // as sections of different lengths are selected. - final height = (media.height - 140).clamp(260.0, 520.0); - - return AlertDialog( - insetPadding: const EdgeInsets.symmetric(horizontal: 24, vertical: 24), - titlePadding: const EdgeInsets.fromLTRB(24, 22, 24, 0), - contentPadding: EdgeInsets.fromLTRB(paned ? 18 : 22, 18, 24, 0), - actionsPadding: const EdgeInsets.fromLTRB(20, 10, 20, 18), - title: const Text( - 'Settings', - style: TextStyle(fontWeight: _settingsSemiboldWeight), - ), - content: SizedBox( + final palette = context.palette; + // A fixed size keeps the dialog from resizing under the pointer as + // sections of different lengths are selected; a small window takes all + // but a margin of itself. + final width = math.min(_dialogWidth, media.width - 48); + final height = math.min(_dialogHeight, media.height - 48); + final paned = AppPlatform.isWindows || width >= _railBreakpoint; + const corners = BorderRadius.all(Radius.circular(AppRadii.dialog)); + + return Dialog( + insetPadding: const EdgeInsets.all(24), + backgroundColor: Colors.transparent, + surfaceTintColor: Colors.transparent, + shadowColor: Colors.transparent, + elevation: 0, + child: Container( key: const ValueKey('settings-dialog-content'), width: width, height: height, - child: paned ? _buildPaned(context) : _buildStacked(context), + clipBehavior: Clip.antiAlias, + foregroundDecoration: BoxDecoration( + borderRadius: corners, + border: Border.all(color: palette.separator), + ), + decoration: BoxDecoration( + color: palette.surfaceBackground, + borderRadius: corners, + boxShadow: const [ + BoxShadow( + color: Color(0x80000000), + offset: Offset(0, 30), + blurRadius: 60, + spreadRadius: -24, + ), + BoxShadow( + color: Color(0x59000000), + offset: Offset(0, 2), + blurRadius: 8, + ), + ], + ), + // Line heights here are the design's, which centre a line's + // leading the way CSS does. + child: DefaultTextHeightBehavior( + textHeightBehavior: const TextHeightBehavior( + leadingDistribution: TextLeadingDistribution.even, + ), + child: paned ? _buildPaned(context) : _buildStacked(context), + ), ), - actions: [ - TextButton( - onPressed: () => Navigator.of(context).pop(), - child: const Text( - 'Done', - style: TextStyle(fontWeight: _settingsMediumWeight), + ); + } + + /// The pane's heading: what is on show, a line on what is in it, and the + /// way out. + Widget _paneHeader({required String title, required String summary}) { + final palette = context.palette; + return Padding( + padding: const EdgeInsets.fromLTRB(28, 22, 22, 18), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontFamily: 'Shantell Sans', + fontSize: 20, + fontWeight: FontWeight.w600, + height: 26 / 20, + color: palette.textPrimary, + ), + ), + const SizedBox(height: 3), + Text( + summary, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 12.5, + height: 16 / 12.5, + color: palette.textDescription, + ), + ), + ], + ), + ), + const SizedBox(width: 16), + TonalButton( + key: const ValueKey('settings-done'), + label: 'Done', + shortcut: 'esc', + onPressed: () => Navigator.of(context).pop(), + ), + ], + ), + ); + } + + /// [pane] under the pane's heading, fading out at its foot so the last + /// row reads as more to scroll to rather than as cut off. + Widget _paneColumn({ + required String title, + required String summary, + required Widget pane, + }) { + final surface = context.palette.surfaceBackground; + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + _paneHeader(title: title, summary: summary), + Expanded( + child: Stack( + children: [ + Positioned.fill(child: pane), + Positioned( + left: 0, + right: 0, + bottom: 0, + height: 64, + child: IgnorePointer( + child: DecoratedBox( + decoration: BoxDecoration( + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + stops: const [0, 0.85], + colors: [surface.withValues(alpha: 0), surface], + ), + ), + ), + ), + ), + ], ), ), ], @@ -1284,67 +1407,121 @@ class _SettingsDialogState extends State /// down for something and a field that finds it saves the looking. Its /// results take the pane's place, so the rail stays a way back out. Widget _buildPaned(BuildContext context) { + final palette = context.palette; + final section = _section; return Row( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - SizedBox( - width: _railWidth, + Container( + width: _navWidth, + padding: const EdgeInsets.fromLTRB(14, 20, 14, 16), + decoration: BoxDecoration( + color: palette.sidebarBackground, + border: Border(right: BorderSide(color: palette.paneEdge)), + ), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ + Container( + height: 26, + padding: const EdgeInsets.only(left: 10), + alignment: Alignment.centerLeft, + child: Text( + 'Settings', + style: TextStyle( + fontFamily: 'Shantell Sans', + fontSize: 17, + fontWeight: FontWeight.w600, + height: 22 / 17, + color: palette.textHeading, + ), + ), + ), + const SizedBox(height: 14), // Settings opened on purpose, sent to one pane, leaves the // keyboard to whatever that pane wanted it for. _searchField(autofocus: widget.section == null), - const SizedBox(height: 8), + const SizedBox(height: 14), Expanded( child: _SettingsRail( - sections: _sections, + sections: _railSections, // No category is the one on show while results are. - selected: _searching ? null : _section, + selected: _searching ? null : section, onSelect: _selectFromRail, ), ), + if (widget.updates case final updates?) + ListenableBuilder( + listenable: updates, + builder: (context, _) => _VersionStatus(updates: updates), + ), ], ), ), - const SizedBox(width: 14), Expanded( - child: _ScrollingPane( - key: _paneKey, - controller: _scrollController, - flashTarget: _flashTarget, - flash: _flash, - children: _searching ? [_searchResults()] : _paneFor(_section), + child: _paneColumn( + title: _searching ? 'Search' : section.label, + summary: _searching + ? 'Settings that match “$_query”' + : section.summary, + pane: _ScrollingPane( + key: _paneKey, + controller: _scrollController, + flashTarget: _flashTarget, + flash: _flash, + children: _searching ? [_searchResults()] : _paneFor(section), + ), ), ), ], ); } + /// The rail's order: the account sections, then the two that shape the + /// writing, then the keys and the app itself. + List get _railSections => [ + for (final section in const [ + SettingsSection.general, + SettingsSection.sync, + SettingsSection.plan, + SettingsSection.voice, + SettingsSection.appearance, + SettingsSection.shortcuts, + SettingsSection.updates, + ]) + if (_sections.contains(section)) section, + ]; + Widget _buildStacked(BuildContext context) { - return Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - _searchField(autofocus: widget.section == null), - const SizedBox(height: 12), - Expanded( - child: _ScrollingPane( - key: _paneKey, - controller: _scrollController, - flashTarget: _flashTarget, - flash: _flash, - children: _searching - ? [_searchResults()] - : [ - for (final section in _sections) ...[ - if (section != _sections.first) - const SizedBox(height: 20), - ..._paneFor(section), + return _paneColumn( + title: 'Settings', + summary: 'Everything in one list', + pane: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Padding( + padding: const EdgeInsets.fromLTRB(28, 0, 24, 12), + child: _searchField(autofocus: widget.section == null), + ), + Expanded( + child: _ScrollingPane( + key: _paneKey, + controller: _scrollController, + flashTarget: _flashTarget, + flash: _flash, + children: _searching + ? [_searchResults()] + : [ + for (final section in _sections) ...[ + if (section != _sections.first) + const SizedBox(height: 20), + ..._paneFor(section), + ], ], - ], + ), ), - ), - ], + ], + ), ); } @@ -1545,7 +1722,7 @@ class _SettingsDialogState extends State group: 'Window', icon: KapyIcons.viewColumnOutlined, target: 'panel-widths-setting', - keywords: ['reset', 'resize', 'sidebar width', 'results column'], + keywords: ['reset', 'resize', 'sidebar width'], ), ], @@ -1888,7 +2065,7 @@ class _SettingsDialogState extends State /// name, and a button loose under the last card. Now every row says what it /// is, next to the rows it is read with. List _generalPane() => [ - const SettingsLabel('OPENING'), + const SettingsLabel('Opening'), SettingsGroup( children: [ SettingsNavigationRow( @@ -1900,7 +2077,7 @@ class _SettingsDialogState extends State ), SettingsToggleRow( key: const ValueKey('ready-to-type-on-open-toggle'), - icon: KapyIcons.keyboardOutlined, + icon: KapyIcons.textCursorOutlined, title: 'Ready to type on open', subtitle: 'Restore your cursor or start a new dated line', value: widget.layoutPrefs.readyToTypeOnOpen, @@ -1908,11 +2085,11 @@ class _SettingsDialogState extends State ), ], ), - const SizedBox(height: 18), + SizedBox(height: SettingsMetrics.groupGap), // The time zone sits under the separators because they are what it // dates: a row further down, under a heading of its own, read as a // setting for the whole computer. - const SettingsLabel('WRITING'), + const SettingsLabel('Writing'), SettingsGroup( children: [ SettingsToggleRow( @@ -1935,7 +2112,7 @@ class _SettingsDialogState extends State ), SettingsToggleRow( key: const ValueKey('spell-check-toggle'), - icon: KapyIcons.spellcheckRounded, + icon: KapyIcons.spellCheckOutlined, title: 'Check spelling', subtitle: 'Underline possible misspellings', value: widget.layoutPrefs.spellCheckEnabled, @@ -1945,7 +2122,7 @@ class _SettingsDialogState extends State // they are typed. Nothing in a note is converted either way. SettingsToggleRow( key: const ValueKey('markdown-toggle'), - icon: KapyIcons.tagRounded, + icon: KapyIcons.hashtagOutlined, title: 'Markdown in notes', subtitle: 'Use # headings, - lists, and [] checkboxes', value: widget.layoutPrefs.markdownEnabled, @@ -1953,13 +2130,13 @@ class _SettingsDialogState extends State ), ], ), - const SizedBox(height: 18), - const SettingsLabel('YOUR NOTES'), + SizedBox(height: SettingsMetrics.groupGap), + const SettingsLabel('Your notes'), SettingsGroup( children: [ SettingsNavigationRow( key: const ValueKey('export-notes'), - icon: KapyIcons.shareRounded, + icon: KapyIcons.uploadOutlined, title: 'Export all notes', // The one-line warning the plaintext deserves, at the moment it // matters. Not called a backup, because nothing here runs on its own. @@ -1976,17 +2153,17 @@ class _SettingsDialogState extends State ], ), if (AppPlatform.isDesktop) ...[ - const SizedBox(height: 18), + SizedBox(height: SettingsMetrics.groupGap), // Everything about the window as a thing on the desktop: what is in it, // whether it outlives being closed, and the one reset. The reset is a // row like the others rather than a button under the card, which read // as belonging to the whole pane. - const SettingsLabel('WINDOW'), + const SettingsLabel('Window'), SettingsGroup( children: [ SettingsToggleRow( key: const ValueKey('sidebar-toggle'), - icon: KapyIcons.viewSidebarOutlined, + icon: KapyIcons.menuOpenRounded, // Named the way the shortcut that toggles it is named. title: 'Notes list', subtitle: 'Show the notes list beside your editor', @@ -1995,7 +2172,7 @@ class _SettingsDialogState extends State ), SettingsToggleRow( key: const ValueKey('hidden-notes-sidebar-toggle'), - icon: KapyIcons.lockRounded, + icon: KapyIcons.lockKeyOutlined, title: 'Hidden Notes', subtitle: 'Show the protected folder · ' @@ -2006,7 +2183,7 @@ class _SettingsDialogState extends State ), SettingsToggleRow( key: const ValueKey('keep-running-toggle'), - icon: KapyIcons.closeFullscreenRounded, + icon: KapyIcons.computerOutlined, title: AppPlatform.isMacOS ? 'Keep running in the menu bar' : 'Keep running in the tray', @@ -2030,9 +2207,9 @@ class _SettingsDialogState extends State ), SettingsRow( key: const ValueKey('panel-widths-setting'), - icon: KapyIcons.viewColumnOutlined, + icon: KapyIcons.panelColumnsOutlined, title: 'Panel widths', - subtitle: 'Reset the notes and results columns', + subtitle: 'Reset the notes list to its default width', trailing: SettingsRowButton( key: const ValueKey('reset-panel-widths'), label: 'Reset', @@ -2068,7 +2245,7 @@ class _SettingsDialogState extends State /// the reader nothing the word had not. The writing fonts keep their list, /// because each one is shown in itself, and that is the point of it. List _appearancePane() => [ - const SettingsLabel('THEME'), + const SettingsLabel('Theme'), SettingsGroup( children: [ _SegmentedRow( @@ -2133,8 +2310,8 @@ class _SettingsDialogState extends State ], ], ), - const SizedBox(height: 18), - const SettingsLabel('WRITING FONT'), + SizedBox(height: SettingsMetrics.groupGap), + const SettingsLabel('Writing font'), SettingsGroup( children: [ for (final font in WritingFont.values) @@ -2172,13 +2349,13 @@ class _SettingsDialogState extends State ], ), const SettingsNote( - 'Applies only to notes. Menus and controls use the system font.', + 'Applies only to notes. Menus and controls keep the app font.', ), - const SizedBox(height: 18), + SizedBox(height: SettingsMetrics.groupGap), // How numbers are written and where the currency rates behind them come // from, together: the credit used to be a heading of its own over one row, // which read as one more thing to set. - const SettingsLabel('NUMBERS'), + const SettingsLabel('Numbers'), SettingsGroup( children: [ for (final system in NumberSystem.values) @@ -2218,7 +2395,7 @@ class _SettingsDialogState extends State ), ), ), - const SettingsLabel('SYSTEM-WIDE'), + const SettingsLabel('System-wide'), SettingsGroup( children: [ for (final action in ShortcutAction.values.where( @@ -2234,8 +2411,8 @@ class _SettingsDialogState extends State ], ), for (final group in _ShortcutGroup.values) ...[ - const SizedBox(height: 18), - SettingsLabel(group.label), + SizedBox(height: SettingsMetrics.groupGap), + SettingsLabel(group.title), SettingsGroup( children: [ for (final action in ShortcutAction.values.where( @@ -2278,7 +2455,7 @@ class _SettingsDialogState extends State List _updatesPane() { final updates = widget.updates!; return [ - const SettingsLabel('KAPY NOTES'), + const SettingsLabel('Kapy Notes'), ListenableBuilder( listenable: updates, builder: (context, _) => SettingsGroup( @@ -2300,14 +2477,14 @@ class _SettingsDialogState extends State listenable: updates, builder: (context, _) => SettingsNote(_updatesNote(updates)), ), - const SizedBox(height: 18), + SizedBox(height: SettingsMetrics.groupGap), // Keyed here rather than on the group below it: a search result scrolls // to what it lands on and lights it, and the group is taller than the // window by a dozen releases. ListenableBuilder( listenable: updates, builder: (context, _) => SettingsLabel( - updates.hasUpdate ? "WHAT'S NEW" : 'RELEASE NOTES', + updates.hasUpdate ? "What's new" : 'Release notes', key: const ValueKey('changelog'), ), ), @@ -2549,7 +2726,7 @@ class _PlanUsagePane extends StatelessWidget { return Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - const SettingsLabel('PLAN'), + const SettingsLabel('Plan'), SettingsGroup( children: [ SettingsRow( @@ -2580,8 +2757,8 @@ class _PlanUsagePane extends StatelessWidget { 'Showing last saved totals. Refresh when you are online.', icon: KapyIcons.warningRounded, ), - const SizedBox(height: 18), - SettingsLabel(signedIn ? 'USAGE' : 'FREE PLAN LIMITS'), + SizedBox(height: SettingsMetrics.groupGap), + SettingsLabel(signedIn ? 'Usage' : 'Free plan limits'), SettingsGroup( children: [ _PlanUsageRow( @@ -2891,7 +3068,9 @@ class _ScrollingPane extends StatelessWidget { radius: const Radius.circular(999), child: SingleChildScrollView( controller: controller, - padding: const EdgeInsets.only(right: 7), + padding: AppPlatform.hasPointer + ? const EdgeInsets.fromLTRB(28, 0, 24, 24) + : const EdgeInsets.only(right: 7), child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: children, @@ -2937,26 +3116,17 @@ class _SettingsRail extends StatelessWidget { @override Widget build(BuildContext context) { - final palette = context.palette; - return DecoratedBox( - decoration: BoxDecoration( - color: palette.controlBackground, - borderRadius: BorderRadius.circular(10), - border: Border.all(color: palette.controlBorder, width: 0.5), - ), - child: Padding( - padding: const EdgeInsets.all(6), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - for (final section in sections) - _RailItem( - section: section, - selected: section == selected, - onTap: () => onSelect(section), - ), - ], - ), + return SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + for (final section in sections) + _RailItem( + section: section, + selected: section == selected, + onTap: () => onSelect(section), + ), + ], ), ); } @@ -2976,46 +3146,52 @@ class _RailItem extends StatelessWidget { @override Widget build(BuildContext context) { final palette = context.palette; - final accent = Theme.of(context).colorScheme.primary; + const corners = BorderRadius.all(Radius.circular(AppRadii.control)); return Padding( padding: const EdgeInsets.only(bottom: 2), child: Semantics( selected: selected, button: true, - child: InkWell( - key: ValueKey('settings-section-${section.name}'), - onTap: onTap, - borderRadius: BorderRadius.circular(7), - child: Container( - padding: const EdgeInsets.symmetric(horizontal: 9, vertical: 7), - decoration: BoxDecoration( - color: selected ? palette.selectedBackground : Colors.transparent, - borderRadius: BorderRadius.circular(7), - ), - child: Row( - children: [ - KapyIcon( - section.icon, - size: 15, - color: selected ? accent : palette.textTertiary, - ), - const SizedBox(width: 9), - Expanded( - child: Text( - section.label, - style: TextStyle( - fontSize: 12.5, - fontWeight: selected - ? _settingsSemiboldWeight - : _settingsRegularWeight, - color: selected - ? palette.textPrimary - : palette.textSecondary, + child: Material( + color: selected ? palette.tonalBackground : Colors.transparent, + borderRadius: corners, + child: InkWell( + key: ValueKey('settings-section-${section.name}'), + onTap: onTap, + borderRadius: corners, + hoverColor: palette.hover, + child: Container( + height: 32, + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Row( + children: [ + KapyIcon( + section.railIcon, + size: 16, + strokeWidth: 1.7, + color: selected + ? palette.tonalForeground + : palette.textTertiary, + ), + const SizedBox(width: 10), + Expanded( + child: Text( + section.label, + style: TextStyle( + fontSize: 13.5, + height: 16 / 13.5, + fontWeight: selected + ? FontWeight.w600 + : FontWeight.w500, + color: selected + ? palette.tonalForeground + : palette.textMuted, + ), + overflow: TextOverflow.ellipsis, ), - overflow: TextOverflow.ellipsis, ), - ), - ], + ], + ), ), ), ), @@ -3024,6 +3200,56 @@ class _RailItem extends StatelessWidget { } } +/// The installed version at the foot of the rail, with a dot that says +/// whether there is a newer one. +class _VersionStatus extends StatelessWidget { + const _VersionStatus({required this.updates}); + + final UpdateChecker updates; + + @override + Widget build(BuildContext context) { + final palette = context.palette; + final version = updates.currentVersion; + if (version.isEmpty) return const SizedBox.shrink(); + final shown = version.endsWith('.0') + ? version.substring(0, version.length - 2) + : version; + final pending = updates.hasUpdate; + return Container( + key: const ValueKey('settings-version-status'), + height: 18, + padding: const EdgeInsets.only(left: 10), + child: Row( + children: [ + DecoratedBox( + decoration: BoxDecoration( + color: pending + ? palette.keyword + : Theme.of(context).colorScheme.primary, + shape: BoxShape.circle, + ), + child: const SizedBox.square(dimension: 6), + ), + const SizedBox(width: 7), + Expanded( + child: Text( + 'Version $shown · ${pending ? 'Update available' : 'Up to date'}', + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 11.5, + height: 14 / 11.5, + color: palette.textTertiary, + ), + ), + ), + ], + ), + ); + } +} + /// A full-width, low-emphasis action at the foot of a pane. class _WideButton extends StatelessWidget { const _WideButton({ diff --git a/lib/ui/settings_rows.dart b/lib/ui/settings_rows.dart index cfbe8fb..ea8a1fc 100644 --- a/lib/ui/settings_rows.dart +++ b/lib/ui/settings_rows.dart @@ -24,60 +24,83 @@ class SettingsMetrics { static EdgeInsets get padding => _touch ? const EdgeInsets.fromLTRB(14, 12, 13, 12) - : const EdgeInsets.fromLTRB(11, 8, 10, 8); + : const EdgeInsets.symmetric(horizontal: 14, vertical: 10); /// A radio sits closer to its own edge than a switch does. static EdgeInsets get choicePadding => _touch ? const EdgeInsets.fromLTRB(14, 12, 14, 12) - : const EdgeInsets.fromLTRB(11, 8, 11, 8); - static double get iconSize => _touch ? 19 : 16; - static double get iconSlot => _touch ? 30 : 25; - static double get gap => _touch ? 11 : 9; + : const EdgeInsets.symmetric(horizontal: 14, vertical: 10); + + /// The least a row is tall with a pointer: a title and its line of + /// description, with room around them, so a pane of rows reads as a list + /// of settings rather than a form. + static double get minRowHeight => _touch ? 0 : 54; + static double get iconSize => _touch ? 19 : 17; + static double get iconSlot => _touch ? 30 : 17; + static double get iconStroke => _touch ? 1.5 : 1.7; + static double get gap => _touch ? 11 : 12; static double get titleSize => _touch ? 14.5 : AppPlatform.isWindows ? AppTypeScale.control - : 12.5; + : 13.5; static double get subtitleSize => _touch ? 12.25 : AppPlatform.isWindows - ? AppTypeScale.caption - : 10.75; - static double get sectionLabelSize => - AppPlatform.isWindows ? AppTypeScale.micro : 10.5; + ? 12.5 + : 12; + static double get sectionLabelSize => _touch ? 10.5 : 14; static double get noteSize => AppPlatform.isWindows ? AppTypeScale.caption : 11; - static double get buttonLabelSize => - AppPlatform.isWindows ? AppTypeScale.small : 12; - static FontWeight get titleWeight => - AppPlatform.isWindows ? FontWeight.w500 : _mediumWeight; - static double get chevronSize => _touch ? 21 : 18; + static double get buttonLabelSize => _touch ? 12 : 12.5; + static FontWeight get titleWeight => _touch ? _mediumWeight : FontWeight.w600; + static double get chevronSize => _touch ? 21 : 15; + + /// Between one group and the heading of the next. + static double get groupGap => _touch ? 18 : 20; /// Lines the dividers up under the copy rather than under the icons. - static double get dividerIndent => _touch ? 58 : 48; + static double get dividerIndent => _touch ? 58 : 43; } -/// The small capitals over a group, naming what the rows in it are about. +/// The heading over a group, naming what the rows in it are about: a small +/// handwritten heading with a pointer, small capitals on a phone. class SettingsLabel extends StatelessWidget { const SettingsLabel(this.text, {super.key}); + /// In sentence case. The phone sets it in capitals. final String text; @override - Widget build(BuildContext context) => Padding( - padding: const EdgeInsets.only(left: 3, bottom: 7), - child: Text( - text, - style: TextStyle( - fontSize: SettingsMetrics.sectionLabelSize, - fontWeight: AppPlatform.isWindows ? FontWeight.w600 : _mediumWeight, - letterSpacing: 0.65, - color: AppPlatform.isWindows - ? context.palette.textSecondary - : context.palette.textTertiary, + Widget build(BuildContext context) { + if (AppPlatform.hasPointer) { + return Padding( + padding: const EdgeInsets.only(left: 2, bottom: 8), + child: Text( + text, + style: TextStyle( + fontFamily: 'Shantell Sans', + fontSize: SettingsMetrics.sectionLabelSize, + fontWeight: FontWeight.w600, + height: 18 / 14, + color: context.palette.textSubheading, + ), + ), + ); + } + return Padding( + padding: const EdgeInsets.only(left: 3, bottom: 7), + child: Text( + text.toUpperCase(), + style: TextStyle( + fontSize: SettingsMetrics.sectionLabelSize, + fontWeight: _mediumWeight, + letterSpacing: 0.65, + color: context.palette.textTertiary, + ), ), - ), - ); + ); + } } /// A card of rows with hairlines between them. @@ -89,21 +112,30 @@ class SettingsGroup extends StatelessWidget { @override Widget build(BuildContext context) { final palette = context.palette; - return KapyControlSurface( - child: Column( - children: [ - for (var index = 0; index < children.length; index++) ...[ - if (index > 0) - Divider( - height: 0.5, - thickness: 0.5, - indent: SettingsMetrics.dividerIndent, - color: palette.separator, - ), - children[index], - ], + final pointer = AppPlatform.hasPointer; + final rows = Column( + children: [ + for (var index = 0; index < children.length; index++) ...[ + if (index > 0) + Divider( + height: pointer ? 1 : 0.5, + thickness: pointer ? 1 : 0.5, + indent: SettingsMetrics.dividerIndent, + color: palette.separator, + ), + children[index], ], - ), + ], + ); + if (!pointer) return KapyControlSurface(child: rows); + // The outline is drawn inside the card's box, as the design measures it, + // so the rows sit a hairline in from it. + return KapyControlSurface( + radius: AppRadii.surface, + padding: const EdgeInsets.all(1), + color: palette.cardBackground, + borderColor: palette.controlBorder, + child: rows, ); } } @@ -163,6 +195,7 @@ class SettingsRowCopy extends StatelessWidget { @override Widget build(BuildContext context) { final palette = context.palette; + final pointer = AppPlatform.hasPointer; final subtitle = this.subtitle; return Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -172,6 +205,7 @@ class SettingsRowCopy extends StatelessWidget { style: TextStyle( fontSize: SettingsMetrics.titleSize, fontWeight: SettingsMetrics.titleWeight, + height: pointer ? 18 / SettingsMetrics.titleSize : null, color: titleColor ?? palette.textPrimary, ), ), @@ -184,8 +218,8 @@ class SettingsRowCopy extends StatelessWidget { overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: SettingsMetrics.subtitleSize, - height: AppPlatform.isWindows ? 1.25 : null, - color: palette.textSecondary, + height: pointer ? 16 / SettingsMetrics.subtitleSize : null, + color: pointer ? palette.textDescription : palette.textSecondary, ), ), ], @@ -224,7 +258,8 @@ class SettingsRow extends StatelessWidget { final danger = Theme.of(context).colorScheme.error; final icon = this.icon; final trailing = this.trailing; - final row = Padding( + final row = Container( + constraints: BoxConstraints(minHeight: SettingsMetrics.minRowHeight), padding: SettingsMetrics.padding, child: Row( children: [ @@ -234,6 +269,7 @@ class SettingsRow extends StatelessWidget { child: KapyIcon( icon, size: SettingsMetrics.iconSize, + strokeWidth: SettingsMetrics.iconStroke, color: destructive ? danger : palette.textSecondary, ), ), @@ -283,6 +319,7 @@ class SettingsNavigationRow extends StatelessWidget { trailing: KapyIcon( KapyIcons.chevronRightRounded, size: SettingsMetrics.chevronSize, + strokeWidth: AppPlatform.hasPointer ? 1.8 : 1.5, color: context.palette.textTertiary, ), ); @@ -338,25 +375,35 @@ class SettingsRowButton extends StatelessWidget { Widget build(BuildContext context) { final palette = context.palette; final scheme = Theme.of(context).colorScheme; + final pointer = AppPlatform.hasPointer; return TextButton( onPressed: onPressed, style: TextButton.styleFrom( - minimumSize: const Size(0, 30), - padding: const EdgeInsets.symmetric(horizontal: 12), + minimumSize: Size(0, pointer ? 28 : 30), + padding: EdgeInsets.symmetric(horizontal: pointer ? 11 : 12), tapTargetSize: MaterialTapTargetSize.shrinkWrap, backgroundColor: prominent ? scheme.primary : palette.controlBackground, - foregroundColor: prominent ? scheme.onPrimary : palette.textSecondary, + foregroundColor: prominent + ? scheme.onPrimary + : pointer + ? palette.textSubheading + : palette.textSecondary, disabledForegroundColor: palette.textTertiary, side: prominent ? null + : pointer + ? BorderSide(color: palette.separator) : BorderSide(color: palette.controlBorder, width: 0.5), - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(pointer ? AppRadii.control : 8), + ), ), child: Text( label, style: TextStyle( fontSize: SettingsMetrics.buttonLabelSize, fontWeight: SettingsMetrics.titleWeight, + height: pointer ? 16 / 12.5 : null, ), ), ); @@ -374,20 +421,27 @@ class SettingsSwitch extends StatelessWidget { Widget build(BuildContext context) { final palette = context.palette; final scheme = Theme.of(context).colorScheme; + final pointer = AppPlatform.hasPointer; return AnimatedContainer( key: const ValueKey('compact-switch-indicator'), duration: const Duration(milliseconds: 140), curve: Curves.easeOutCubic, - width: AppPlatform.hasPointer ? 34 : 44, - height: AppPlatform.hasPointer ? 18 : 25, + width: pointer ? 34 : 44, + height: pointer ? 20 : 25, padding: const EdgeInsets.all(2), decoration: BoxDecoration( - color: value ? scheme.primary : palette.controlBackground, + color: value + ? scheme.primary + : pointer + ? palette.switchTrackOff + : palette.controlBackground, borderRadius: BorderRadius.circular(999), - border: Border.all( - color: value ? Colors.transparent : palette.controlBorder, - width: 0.5, - ), + border: pointer + ? null + : Border.all( + color: value ? Colors.transparent : palette.controlBorder, + width: 0.5, + ), ), child: AnimatedAlign( duration: const Duration(milliseconds: 140), @@ -395,10 +449,21 @@ class SettingsSwitch extends StatelessWidget { alignment: value ? Alignment.centerRight : Alignment.centerLeft, child: DecoratedBox( decoration: BoxDecoration( - color: value ? scheme.onPrimary : palette.textTertiary, + color: value + ? (pointer ? palette.textPrimary : scheme.onPrimary) + : palette.textTertiary, shape: BoxShape.circle, + boxShadow: pointer && value + ? const [ + BoxShadow( + color: Color(0x40000000), + offset: Offset(0, 1), + blurRadius: 2, + ), + ] + : null, ), - child: SizedBox.square(dimension: AppPlatform.hasPointer ? 14 : 21), + child: SizedBox.square(dimension: pointer ? 16 : 21), ), ), ); diff --git a/lib/ui/settings_search.dart b/lib/ui/settings_search.dart index 4676593..cb41154 100644 --- a/lib/ui/settings_search.dart +++ b/lib/ui/settings_search.dart @@ -175,67 +175,93 @@ class SettingsSearchField extends StatelessWidget { }, child: ValueListenableBuilder( valueListenable: controller, - builder: (context, value, _) => TextField( - key: const ValueKey('settings-search'), - controller: controller, - focusNode: focusNode, - autofocus: autofocus, - autocorrect: false, - enableSuggestions: false, - textInputAction: TextInputAction.search, - onSubmitted: (_) => onSubmitted(), - style: TextStyle( - fontSize: AppTypeScale.control, - color: palette.textPrimary, - ), - cursorHeight: AppTypeScale.control + 2, - decoration: kapyFieldDecoration( - context, - hintText: 'Search settings', - hintStyle: TextStyle( - fontSize: AppTypeScale.control, - color: palette.textTertiary, + builder: (context, value, _) { + final pointer = AppPlatform.hasPointer; + final size = pointer ? 13.0 : AppTypeScale.control; + final field = TextField( + key: const ValueKey('settings-search'), + controller: controller, + focusNode: focusNode, + autofocus: autofocus, + autocorrect: false, + enableSuggestions: false, + textInputAction: TextInputAction.search, + onSubmitted: (_) => onSubmitted(), + style: TextStyle( + fontSize: size, + height: pointer ? 16 / 13 : null, + color: palette.textPrimary, ), - // InputDecorator gives its prefix the whole adornment slot. Center - // loosens those constraints so the glyph keeps its intended size. - prefixIcon: Center( - widthFactor: 1, - heightFactor: 1, - child: KapyIcon( - KapyIcons.searchRounded, - size: AppControlMetrics.iconSearch, + cursorHeight: size + 2, + decoration: kapyFieldDecoration( + context, + hintText: 'Search settings', + hintStyle: TextStyle( + fontSize: size, + height: pointer ? 16 / 13 : null, color: palette.textTertiary, ), - ), - prefixIconConstraints: BoxConstraints( - minWidth: AppControlMetrics.fieldAdornmentSlot + 2, - minHeight: AppControlMetrics.fieldAdornmentSlot, - ), - suffixIcon: value.text.isEmpty - ? null - : CompactIconButton( - key: const ValueKey('settings-search-clear'), - tooltip: 'Clear search', - extent: AppControlMetrics.fieldAdornmentSlot, - foregroundColor: palette.textTertiary, - onPressed: () { - controller.clear(); - focusNode.requestFocus(); - }, - icon: KapyIcon( - KapyIcons.cancelRounded, - size: AppControlMetrics.iconAdornment, - ), + fillColor: pointer ? palette.surfaceBackground : null, + borderWidth: pointer ? 1.5 : null, + radius: pointer ? 10 : null, + // InputDecorator gives its prefix the whole adornment slot. + // Center loosens those constraints so the glyph keeps its + // intended size. + prefixIcon: Padding( + padding: EdgeInsets.only( + left: pointer ? 9 : 0, + right: pointer ? 8 : 0, + ), + child: Center( + widthFactor: 1, + heightFactor: 1, + child: KapyIcon( + KapyIcons.searchRounded, + size: pointer ? 15 : AppControlMetrics.iconSearch, + strokeWidth: pointer ? 1.8 : 1.5, + color: pointer + ? palette.textSecondary + : palette.textTertiary, ), - suffixIconConstraints: BoxConstraints( - minWidth: AppControlMetrics.fieldAdornmentSlot, - minHeight: AppControlMetrics.fieldAdornmentSlot, - ), - contentPadding: EdgeInsets.symmetric( - vertical: AppControlMetrics.fieldVerticalPadding, + ), + ), + prefixIconConstraints: pointer + ? const BoxConstraints(minHeight: 31) + : BoxConstraints( + minWidth: AppControlMetrics.fieldAdornmentSlot + 2, + minHeight: AppControlMetrics.fieldAdornmentSlot, + ), + suffixIcon: value.text.isEmpty + ? null + : CompactIconButton( + key: const ValueKey('settings-search-clear'), + tooltip: 'Clear search', + extent: pointer + ? 28 + : AppControlMetrics.fieldAdornmentSlot, + foregroundColor: palette.textTertiary, + onPressed: () { + controller.clear(); + focusNode.requestFocus(); + }, + icon: KapyIcon( + KapyIcons.cancelRounded, + size: AppControlMetrics.iconAdornment, + ), + ), + suffixIconConstraints: BoxConstraints( + minWidth: pointer ? 30 : AppControlMetrics.fieldAdornmentSlot, + minHeight: pointer ? 28 : AppControlMetrics.fieldAdornmentSlot, + ), + contentPadding: pointer + ? const EdgeInsets.only(right: 10, top: 8.5, bottom: 8.5) + : EdgeInsets.symmetric( + vertical: AppControlMetrics.fieldVerticalPadding, + ), ), - ), - ), + ); + return pointer ? SizedBox(height: 34, child: field) : field; + }, ), ); } @@ -300,7 +326,7 @@ class SettingsSearchResults extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ SettingsLabel( - results.length == 1 ? '1 SETTING' : '${results.length} SETTINGS', + results.length == 1 ? '1 setting' : '${results.length} settings', ), SettingsGroup( children: [ diff --git a/test/app_test.dart b/test/app_test.dart index ad43a4f..ef137a9 100644 --- a/test/app_test.dart +++ b/test/app_test.dart @@ -37,6 +37,7 @@ import 'package:kapy_notes/ui/hidden_notes_gate.dart'; import 'package:kapy_notes/ui/keycap.dart'; import 'package:kapy_notes/core/window_chrome.dart'; import 'package:kapy_notes/ui/settings_dialog.dart'; +import 'package:kapy_notes/ui/settings_rows.dart'; import 'package:kapy_notes/ui/sidebar.dart'; import 'package:kapy_notes/ui/sidebar_swipe.dart'; import 'package:kapy_notes/ui/spaces_rail.dart'; @@ -838,7 +839,7 @@ void main() { matching: find.byKey(const ValueKey('compact-switch-indicator')), ); expect(prefs.dailySeparatorsEnabled, isTrue); - expect(tester.getSize(compactSwitch), const Size(34, 18)); + expect(tester.getSize(compactSwitch), const Size(34, 20)); final readyToType = find.byKey( const ValueKey('ready-to-type-on-open-toggle'), @@ -900,7 +901,7 @@ void main() { ); }); - testWidgets('settings keeps system labels regular or lighter', ( + testWidgets('settings sets its type at the Riverbank weights', ( tester, ) async { await pumpApp(tester); @@ -909,36 +910,22 @@ void main() { await openSettings(tester); final settings = find.byType(SettingsDialog); - final textWidgets = find.descendant( - of: settings, - matching: find.byType(Text), - ); - for (final element in textWidgets.evaluate()) { - final text = element.widget as Text; - final inherited = DefaultTextStyle.of(element).style; - final weight = text.style?.fontWeight ?? inherited.fontWeight; - expect( - (weight ?? FontWeight.w400).value, - lessThanOrEqualTo(FontWeight.w500.value), - reason: '${text.data ?? text.textSpan?.toPlainText()} is too bold', - ); - } - FontWeight weightOf(String label) { final finder = find.descendant(of: settings, matching: find.text(label)); - final element = tester.element(finder); - final text = tester.widget(finder); + final element = tester.element(finder.first); + final text = tester.widget(finder.first); return text.style?.fontWeight ?? DefaultTextStyle.of(element).style.fontWeight ?? FontWeight.w400; } - expect(weightOf('Settings'), FontWeight.w400); - expect(weightOf('General'), FontWeight.w400); - expect(weightOf('Appearance'), FontWeight.w400); - expect(weightOf('OPENING'), FontWeight.w400); - expect(weightOf('Daily separators'), FontWeight.w400); - expect(weightOf('Done'), FontWeight.w400); + // Headings and the selected section are semibold; the sections not on + // show are medium; a row's description is regular. + expect(weightOf('Settings'), FontWeight.w600); + expect(weightOf('Opening'), FontWeight.w600); + expect(weightOf('Daily separators'), FontWeight.w600); + expect(weightOf('Appearance'), FontWeight.w500); + expect(weightOf('Add a dated line when a new day begins'), FontWeight.w400); }); testWidgets('selects and persists the note time zone from settings', ( @@ -1125,7 +1112,7 @@ void main() { expect(editor().style?.fontFamily, WritingFont.clean.fontFamily); await openSettings(tester, section: SettingsSection.appearance); - expect(find.text('WRITING FONT'), findsOneWidget); + expect(find.text('Writing font'), findsOneWidget); for (final font in WritingFont.values) { expect(find.byKey(ValueKey('writing-font-${font.name}')), findsOneWidget); } @@ -1541,22 +1528,25 @@ void main() { // The shortcuts another app can refuse lead the pane, then the in-app // keys by what they act on: the list, the panes beside it, the window, // what goes into a note, and how it is formatted. + Finder label(String text) => find.byWidgetPredicate( + (widget) => widget is SettingsLabel && widget.text == text, + ); const headings = [ - 'SYSTEM-WIDE', - 'NOTES', - 'SPLIT VIEW', - 'WINDOW', - 'EDITOR', - 'INSERT', - 'FORMATTING', + 'System-wide', + 'Notes', + 'Split view', + 'Window', + 'Editor', + 'Insert', + 'Formatting', ]; for (final heading in headings) { - expect(find.text(heading), findsOneWidget); + expect(label(heading), findsOneWidget); } for (var index = 1; index < headings.length; index++) { expect( - tester.getTopLeft(find.text(headings[index - 1])).dy, - lessThan(tester.getTopLeft(find.text(headings[index])).dy), + tester.getTopLeft(label(headings[index - 1])).dy, + lessThan(tester.getTopLeft(label(headings[index])).dy), ); } // The rail shows one pane at a time, so the general options are gone. @@ -2430,7 +2420,7 @@ void main() { expect( tester.getSize(find.byKey(const ValueKey('settings-dialog-content'))), - const Size(600, 520), + const Size(820, 700), ); }); @@ -3111,12 +3101,8 @@ void main() { await openSettings(tester); final toggle = find.byKey(const ValueKey('hidden-notes-sidebar-toggle')); - final settingsPane = find.descendant( - of: find.byType(AlertDialog), - matching: find.byType(SingleChildScrollView), - ); final settingsScrollable = find.descendant( - of: settingsPane, + of: find.byType(Scrollbar), matching: find.byType(Scrollable), ); expect(settingsScrollable, findsOneWidget); @@ -3138,7 +3124,7 @@ void main() { await tester.pumpAndSettle(); expect(prefs.hiddenFolderVisible, isTrue); - await tester.tap(find.widgetWithText(TextButton, 'Done')); + await tester.tap(find.byKey(const ValueKey('settings-done'))); await tester.pumpAndSettle(); expect(find.byKey(const ValueKey('rail-hidden')), findsOneWidget); }); diff --git a/test/billing/settings_pro_row_test.dart b/test/billing/settings_pro_row_test.dart index 9df0577..8dcb142 100644 --- a/test/billing/settings_pro_row_test.dart +++ b/test/billing/settings_pro_row_test.dart @@ -103,7 +103,8 @@ void main() { final purchases = FakePurchaseStore(); await pumpSettings(tester, purchases: purchases); - expect(find.text('Plan & usage'), findsOneWidget); + // Once in the navigation and once over the pane it opens. + expect(find.text('Plan & usage'), findsNWidgets(2)); expect(find.byKey(const ValueKey('plan-current')), findsOneWidget); expect(find.text('Free plan'), findsOneWidget); expect(find.text('Your plan and included cloud limits'), findsOneWidget); diff --git a/test/goldens/desktop_dark_settings.png b/test/goldens/desktop_dark_settings.png index aee41c9..5462045 100644 Binary files a/test/goldens/desktop_dark_settings.png and b/test/goldens/desktop_dark_settings.png differ diff --git a/test/goldens/desktop_dark_settings_appearance_end.png b/test/goldens/desktop_dark_settings_appearance_end.png index 933bf2b..1544658 100644 Binary files a/test/goldens/desktop_dark_settings_appearance_end.png and b/test/goldens/desktop_dark_settings_appearance_end.png differ diff --git a/test/goldens/desktop_dark_settings_shortcuts.png b/test/goldens/desktop_dark_settings_shortcuts.png index a695a0d..7e6104d 100644 Binary files a/test/goldens/desktop_dark_settings_shortcuts.png and b/test/goldens/desktop_dark_settings_shortcuts.png differ diff --git a/test/goldens/desktop_dark_settings_updates.png b/test/goldens/desktop_dark_settings_updates.png index a5df018..ebc2623 100644 Binary files a/test/goldens/desktop_dark_settings_updates.png and b/test/goldens/desktop_dark_settings_updates.png differ diff --git a/test/goldens/desktop_light_settings_appearance.png b/test/goldens/desktop_light_settings_appearance.png index a1c5949..eb83f33 100644 Binary files a/test/goldens/desktop_light_settings_appearance.png and b/test/goldens/desktop_light_settings_appearance.png differ diff --git a/test/goldens/desktop_windows_dark_settings.png b/test/goldens/desktop_windows_dark_settings.png index 2aeceb0..47d4209 100644 Binary files a/test/goldens/desktop_windows_dark_settings.png and b/test/goldens/desktop_windows_dark_settings.png differ diff --git a/test/goldens/desktop_windows_dark_update.png b/test/goldens/desktop_windows_dark_update.png index 44b423b..57cc099 100644 Binary files a/test/goldens/desktop_windows_dark_update.png and b/test/goldens/desktop_windows_dark_update.png differ diff --git a/test/goldens/phone_settings_general.png b/test/goldens/phone_settings_general.png index 752fc37..3058553 100644 Binary files a/test/goldens/phone_settings_general.png and b/test/goldens/phone_settings_general.png differ diff --git a/test/settings_search_test.dart b/test/settings_search_test.dart index a102a7a..e8cb878 100644 --- a/test/settings_search_test.dart +++ b/test/settings_search_test.dart @@ -119,7 +119,9 @@ List _resultTargets(WidgetTester tester) => [ /// screen, not merely built somewhere below the fold. bool _onScreen(WidgetTester tester, Finder finder) { final rect = tester.getRect(finder); - final dialog = tester.getRect(find.byType(AlertDialog)); + final dialog = tester.getRect( + find.byKey(const ValueKey('settings-dialog-content')), + ); return rect.top >= dialog.top && rect.bottom <= dialog.bottom; } @@ -224,7 +226,7 @@ void main() { widget is KapyIcon && widget.icon == KapyIcons.searchRounded, ), ); - expect(tester.getSize(icon), Size.square(AppControlMetrics.iconSearch)); + expect(tester.getSize(icon), const Size.square(15)); }); testWidgets('is waiting in the field when settings opens, and Return ' @@ -253,7 +255,7 @@ void main() { _onScreen(tester, find.byKey(const ValueKey('theme-setting'))), isTrue, ); - expect(find.text('WRITING FONT'), findsOneWidget); + expect(find.text('Writing font'), findsOneWidget); expect(tester.widget(_field).controller!.text, isEmpty); }); @@ -296,7 +298,10 @@ void main() { await tester.sendKeyEvent(LogicalKeyboardKey.escape); await tester.pumpAndSettle(); expect(tester.widget(_field).controller!.text, isEmpty); - expect(find.byType(AlertDialog), findsOneWidget); + expect( + find.byKey(const ValueKey('settings-dialog-content')), + findsOneWidget, + ); expect( find.byKey(const ValueKey('settings-search-results')), findsNothing, @@ -304,7 +309,10 @@ void main() { await tester.sendKeyEvent(LogicalKeyboardKey.escape); await tester.pumpAndSettle(); - expect(find.byType(AlertDialog), findsNothing); + expect( + find.byKey(const ValueKey('settings-dialog-content')), + findsNothing, + ); }); testWidgets('says so when nothing matches', (tester) async { @@ -328,7 +336,7 @@ void main() { await tester.pumpAndSettle(); expect(tester.widget(_field).controller!.text, isEmpty); - expect(find.text('SYSTEM-WIDE'), findsOneWidget); + expect(find.text('System-wide'), findsOneWidget); }); testWidgets('⌘F goes back to the field from anywhere in settings', ( diff --git a/test/settings_sheet_test.dart b/test/settings_sheet_test.dart index 4afe224..cb28ca3 100644 --- a/test/settings_sheet_test.dart +++ b/test/settings_sheet_test.dart @@ -313,7 +313,10 @@ void main() { 720.0, reason: 'the Windows host is widened before the dialog is shown', ); - expect(find.byType(AlertDialog), findsOneWidget); + expect( + find.byKey(const ValueKey('settings-dialog-content')), + findsOneWidget, + ); final general = find.byKey(const ValueKey('settings-section-general')); expect(general, findsOneWidget); expect(find.text('Daily separators'), findsOneWidget); @@ -324,7 +327,7 @@ void main() { expect(find.text('WRITING FONT'), findsNothing); expect(find.byKey(const ValueKey('settings-sheet-done')), findsNothing); - await tester.tap(find.widgetWithText(TextButton, 'Done')); + await tester.tap(find.byKey(const ValueKey('settings-done'))); await tester.pumpAndSettle(); expect( (nativeCalls.lastWhere((call) => call.method == 'setBounds').arguments diff --git a/test/speech/local_engine_row_test.dart b/test/speech/local_engine_row_test.dart index 09faafe..d832ced 100644 --- a/test/speech/local_engine_row_test.dart +++ b/test/speech/local_engine_row_test.dart @@ -173,7 +173,7 @@ void main() { testWidgets('a build with no models still shows the shelf', (tester) async { await _openVoicePane(tester); - expect(find.text('RECORDINGS & SUMMARIES'), findsOneWidget); + expect(find.text('Recordings & summaries'), findsOneWidget); expect(find.text('ON THIS DEVICE'), findsNothing); expect(find.byKey(const ValueKey('local-transcription-row')), findsOne); expect(find.byKey(const ValueKey('local-summary-row')), findsOne); diff --git a/test/speech/summary_model_test.dart b/test/speech/summary_model_test.dart index 6a3ea0b..12549cc 100644 --- a/test/speech/summary_model_test.dart +++ b/test/speech/summary_model_test.dart @@ -111,7 +111,7 @@ void main() { ); // Local summaries now sit with the recording settings they affect. - expect(find.text('RECORDINGS & SUMMARIES'), findsOneWidget); + expect(find.text('Recordings & summaries'), findsOneWidget); expect(find.text('ON THIS DEVICE'), findsNothing); expect(find.text('Gemma 4 E2B · 2.6 GB'), findsOneWidget); // The licence has to be named and reachable, not merely implied. diff --git a/test/sync/settings_sections_test.dart b/test/sync/settings_sections_test.dart index 70a7ccc..42b68cf 100644 --- a/test/sync/settings_sections_test.dart +++ b/test/sync/settings_sections_test.dart @@ -195,7 +195,7 @@ void main() { ); // Both panes are in there, controls and all — not just the heading. - expect(find.text('SHARING'), findsOneWidget); + expect(find.text('Sharing'), findsOneWidget); expect(find.byKey(const ValueKey('join-code')), findsOneWidget); expect(find.text('Sync now'), findsOneWidget); diff --git a/test/sync/sharing_pane_test.dart b/test/sync/sharing_pane_test.dart index ee71078..564c3ff 100644 --- a/test/sync/sharing_pane_test.dart +++ b/test/sync/sharing_pane_test.dart @@ -67,7 +67,7 @@ void main() { await tester.pumpWidget(harness(app.account)); await tester.pumpAndSettle(); - expect(find.text('SHARING'), findsOneWidget); + expect(find.text('Sharing'), findsOneWidget); expect(find.textContaining('Sign in'), findsOneWidget); expect(find.byKey(const ValueKey('join-code')), findsNothing); app.account.dispose(); diff --git a/test/update_ui_test.dart b/test/update_ui_test.dart index 71282ef..5a73627 100644 --- a/test/update_ui_test.dart +++ b/test/update_ui_test.dart @@ -16,6 +16,7 @@ import 'package:kapy_notes/data/release_history.dart'; import 'package:kapy_notes/data/shortcut_prefs.dart'; import 'package:kapy_notes/data/update_checker.dart'; import 'package:kapy_notes/data/update_installer.dart'; +import 'package:kapy_notes/ui/settings_dialog.dart'; import 'package:material_ui/material_ui.dart'; import 'package:package_info_plus/package_info_plus.dart'; @@ -574,7 +575,13 @@ void main() { find.byKey(const ValueKey('settings-section-updates')), findsNothing, ); - expect(find.text('KAPY NOTES'), findsNothing); + expect( + find.descendant( + of: find.byType(SettingsDialog), + matching: find.text('Kapy Notes'), + ), + findsNothing, + ); expect(find.widgetWithText(TextButton, 'Check'), findsNothing); }); @@ -646,7 +653,7 @@ void main() { ); await _openUpdates(tester); - expect(find.text("WHAT'S NEW"), findsOneWidget); + expect(find.text("What's new"), findsOneWidget); expect(find.byKey(const ValueKey('release-1.0.1')), findsOneWidget); expect( find.text('The update waiting to be installed.'), @@ -686,7 +693,7 @@ void main() { ); await _openUpdates(tester); - expect(find.text('RELEASE NOTES'), findsOneWidget); + expect(find.text('Release notes'), findsOneWidget); expect(find.byKey(const ValueKey('release-1.0.0')), findsOneWidget); expect(find.byKey(const ValueKey('release-0.9.0')), findsOneWidget); expect(find.text('2 Sep 2026'), findsOneWidget);