mirror of
https://github.com/Dasemu/Synapse.git
synced 2026-11-26 15:26:17 +00:00
feat(app): show the type emoji before page names
Page header, All pages, quick switcher, recents, tabs, hub members, tag view, linked references, related pages, type pill and the tree view; not the network graph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a5bee50190
commit
00a64401e0
10 files changed
+430
-46
No files matched your search
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import '../backend/graph_backend.dart';
|
||||
import '../state/app_state.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widgets/type_icon.dart';
|
||||
import '../widgets/common.dart';
|
||||
import '../widgets/dates.dart';
|
||||
import '../widgets/pickers.dart' show errorText;
|
||||
@@ -303,6 +304,7 @@ class _AllPagesViewState extends State<AllPagesView> {
|
||||
: colors.faint,
|
||||
),
|
||||
),
|
||||
TypeIcon(p.pageType, size: 14, gap: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
p.title,
|
||||
|
||||
@@ -442,6 +442,7 @@ class _GraphViewState extends State<GraphView> {
|
||||
model: m,
|
||||
onTap: _open,
|
||||
name: AppScope.read(context).backend.graphName,
|
||||
typeIcon: AppScope.read(context).typeIcon,
|
||||
);
|
||||
}
|
||||
final sub = _sub;
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import '../backend/graph_backend.dart';
|
||||
import '../state/app_state.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widgets/type_icon.dart';
|
||||
import '../widgets/common.dart';
|
||||
import '../widgets/dates.dart';
|
||||
import '../widgets/pickers.dart';
|
||||
@@ -296,6 +297,7 @@ class _MemberRowState extends State<_MemberRow> {
|
||||
color: colors.accent.withAlpha(0xCC),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
TypeIcon(m.pageType, size: 14, gap: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
m.title,
|
||||
|
||||
@@ -5,6 +5,7 @@ import '../editor/outline_view.dart';
|
||||
import '../state/app_state.dart';
|
||||
import '../state/outline_controller.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widgets/type_icon.dart';
|
||||
import '../widgets/common.dart';
|
||||
import '../widgets/dates.dart';
|
||||
import '../widgets/pickers.dart';
|
||||
@@ -239,6 +240,10 @@ class _Header extends StatelessWidget {
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 4),
|
||||
child: TypeIcon(page.pageType, size: 26, gap: 10),
|
||||
),
|
||||
Expanded(child: TitleField(page: page)),
|
||||
IconButton(
|
||||
key: const ValueKey('page-sidebar-toggle'),
|
||||
@@ -471,16 +476,24 @@ class _LinkedReferences extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextLink(
|
||||
group.isJournal
|
||||
? longDate(group.pageTitle)
|
||||
: group.pageTitle,
|
||||
onTap: () => app.openId(group.pageId),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colors.ink,
|
||||
),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TypeIcon(group.pageType),
|
||||
Flexible(
|
||||
child: TextLink(
|
||||
group.isJournal
|
||||
? longDate(group.pageTitle)
|
||||
: group.pageTitle,
|
||||
onTap: () => app.openId(group.pageId),
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colors.ink,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
for (final b in group.blocks)
|
||||
@@ -544,13 +557,25 @@ class RelatedPanel extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
TextLink(
|
||||
x.page.isJournal ? longDate(x.page.title) : x.page.title,
|
||||
icon: x.page.isJournal
|
||||
? Icons.calendar_today_outlined
|
||||
: Icons.description_outlined,
|
||||
onTap: () => app.openId(x.page.id),
|
||||
style: TextStyle(fontSize: 13.5, color: colors.ink),
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
TypeIcon(x.page.pageType),
|
||||
Flexible(
|
||||
child: TextLink(
|
||||
x.page.isJournal
|
||||
? longDate(x.page.title)
|
||||
: x.page.title,
|
||||
icon: app.typeIcon(x.page.pageType) != null
|
||||
? null
|
||||
: x.page.isJournal
|
||||
? Icons.calendar_today_outlined
|
||||
: Icons.description_outlined,
|
||||
onTap: () => app.openId(x.page.id),
|
||||
style: TextStyle(fontSize: 13.5, color: colors.ink),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ClipRRect(
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:flutter/services.dart';
|
||||
import '../backend/graph_backend.dart';
|
||||
import '../state/app_state.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widgets/type_icon.dart';
|
||||
|
||||
/// Ctrl+K: jump to a page by title or alias, to a page whose blocks contain the text, or
|
||||
/// create it.
|
||||
@@ -168,6 +169,7 @@ class _QuickSwitcherState extends State<QuickSwitcher> {
|
||||
onMiddle: () => _open(i, newTab: true),
|
||||
icon: Icons.description_outlined,
|
||||
title: _hits[i].title,
|
||||
pageType: _hits[i].pageType,
|
||||
detail: _hits[i].isAlias ? 'alias' : null,
|
||||
),
|
||||
if (_blocks.isNotEmpty)
|
||||
@@ -217,6 +219,7 @@ class _Item extends StatelessWidget {
|
||||
required this.onMiddle,
|
||||
this.detail,
|
||||
this.snippet,
|
||||
this.pageType,
|
||||
});
|
||||
final bool selected;
|
||||
final VoidCallback onTap;
|
||||
@@ -225,6 +228,9 @@ class _Item extends StatelessWidget {
|
||||
final String title;
|
||||
final String? detail;
|
||||
|
||||
/// Type of the page hit (its emoji goes before the title).
|
||||
final String? pageType;
|
||||
|
||||
/// Matching text shown under the title (content results).
|
||||
final Widget? snippet;
|
||||
|
||||
@@ -254,11 +260,18 @@ class _Item extends StatelessWidget {
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 14, color: colors.ink),
|
||||
Row(
|
||||
children: [
|
||||
TypeIcon(pageType),
|
||||
Expanded(
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 14, color: colors.ink),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (snippet != null) ...[
|
||||
const SizedBox(height: 2),
|
||||
|
||||
@@ -115,11 +115,18 @@ class _TabItemState extends State<_TabItem> {
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
widget.tab.icon,
|
||||
size: 13,
|
||||
color: active ? colors.accent : colors.faint,
|
||||
),
|
||||
if (app.tabTypeIcon(widget.tab) case final emoji?)
|
||||
Text(
|
||||
emoji,
|
||||
key: const ValueKey('type-icon'),
|
||||
style: const TextStyle(fontSize: 12.5, height: 1.15),
|
||||
)
|
||||
else
|
||||
Icon(
|
||||
widget.tab.icon,
|
||||
size: 13,
|
||||
color: active ? colors.accent : colors.faint,
|
||||
),
|
||||
const SizedBox(width: 7),
|
||||
Expanded(
|
||||
child: Text(
|
||||
@@ -215,7 +222,13 @@ Future<void> showTabsSheet(BuildContext context) {
|
||||
dense: true,
|
||||
selected: i == app.activeTab,
|
||||
selectedColor: colors.accent,
|
||||
leading: Icon(tabs[i].icon, size: 18),
|
||||
leading: switch (app.tabTypeIcon(tabs[i])) {
|
||||
final String emoji => Text(
|
||||
emoji,
|
||||
style: const TextStyle(fontSize: 16),
|
||||
),
|
||||
null => Icon(tabs[i].icon, size: 18),
|
||||
},
|
||||
title: Text(
|
||||
tabs[i].title,
|
||||
maxLines: 1,
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import '../backend/graph_backend.dart';
|
||||
import '../state/app_state.dart';
|
||||
import '../theme/theme.dart';
|
||||
import '../widgets/type_icon.dart';
|
||||
import '../widgets/common.dart';
|
||||
import '../widgets/pickers.dart';
|
||||
|
||||
@@ -81,10 +82,17 @@ class TagView extends StatelessWidget {
|
||||
80,
|
||||
),
|
||||
children: [
|
||||
Text(
|
||||
'#$name',
|
||||
key: const ValueKey('tag-title'),
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
Row(
|
||||
children: [
|
||||
TypeIcon(name, size: 26, gap: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
'#$name',
|
||||
key: const ValueKey('tag-title'),
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Wrap(
|
||||
@@ -137,6 +145,7 @@ class TagView extends StatelessWidget {
|
||||
color: colors.faint,
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
TypeIcon(p.pageType, size: 14, gap: 6),
|
||||
Expanded(
|
||||
child: Text(
|
||||
p.title,
|
||||
|
||||
Reference in new issue
Block a user