add Phosphor Icons font and wire into icon rails
Phosphor Icons v2.0.8 (MIT) — regular, bold, and fill weights bundled under assets/fonts/phosphor/. PhosphorIconPainter bridges the font glyphs into the existing ClideIconPainter interface via Paragraph API so icon rails, pane headers, and any widget using ClideIcon can consume them. Sidebar and context panel icon rails now use Phosphor glyphs instead of hand-painted CustomPaint icons. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
+11
-8
@@ -305,11 +305,13 @@ class _SidebarSlot extends StatelessWidget {
|
||||
static ClideIconPainter _iconFor(TabContribution t) {
|
||||
if (t.icon is ClideIconPainter) return t.icon as ClideIconPainter;
|
||||
return switch (t.id) {
|
||||
'files.tree' => const FolderIcon(),
|
||||
'git.panel' => const GitBranchIcon(),
|
||||
'pql.panel' => const SearchIcon(),
|
||||
'problems.panel' => const WarningIcon(),
|
||||
_ => const DotIcon(),
|
||||
'files.tree' => PhosphorIcons.folder,
|
||||
'git.panel' => PhosphorIcons.gitBranch,
|
||||
'pql.panel' => PhosphorIcons.magnifyingGlass,
|
||||
'problems.panel' => PhosphorIcons.warningCircle,
|
||||
'decisions.panel' => PhosphorIcons.lightbulb,
|
||||
'tickets.panel' => PhosphorIcons.ticket,
|
||||
_ => PhosphorIcons.circlesFour,
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -445,9 +447,10 @@ class _ContextSlot extends StatelessWidget {
|
||||
static ClideIconPainter _iconFor(TabContribution t) {
|
||||
if (t.icon is ClideIconPainter) return t.icon as ClideIconPainter;
|
||||
return switch (t.id) {
|
||||
'markdown.viewer' => const DotIcon(),
|
||||
'graph.view' => const SearchIcon(),
|
||||
_ => const DotIcon(),
|
||||
'markdown.viewer' => PhosphorIcons.eye,
|
||||
'graph.view' => PhosphorIcons.graph,
|
||||
'pql.backlinks' => PhosphorIcons.link,
|
||||
_ => PhosphorIcons.circlesFour,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'package:clide_app/widgets/src/clide_icon.dart';
|
||||
|
||||
class PhosphorIconPainter extends ClideIconPainter {
|
||||
const PhosphorIconPainter(this.codePoint, {this.family = 'Phosphor'});
|
||||
|
||||
final int codePoint;
|
||||
final String family;
|
||||
|
||||
@override
|
||||
void paint(ui.Canvas canvas, ui.Color color) {
|
||||
final builder = ui.ParagraphBuilder(ui.ParagraphStyle(fontFamily: family, fontSize: 0.88, height: 1.0))
|
||||
..pushStyle(ui.TextStyle(color: color, fontFamily: family))
|
||||
..addText(String.fromCharCode(codePoint));
|
||||
final paragraph = builder.build()..layout(const ui.ParagraphConstraints(width: 1.0));
|
||||
final dx = (1.0 - paragraph.maxIntrinsicWidth) / 2;
|
||||
final dy = (1.0 - paragraph.height) / 2;
|
||||
canvas.drawParagraph(paragraph, ui.Offset(dx, dy));
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => other is PhosphorIconPainter && other.codePoint == codePoint && other.family == family;
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(codePoint, family);
|
||||
}
|
||||
|
||||
abstract class PhosphorIcons {
|
||||
static const folder = PhosphorIconPainter(0xe24a);
|
||||
static const fileText = PhosphorIconPainter(0xe23a);
|
||||
static const gitBranch = PhosphorIconPainter(0xe278);
|
||||
static const gitCommit = PhosphorIconPainter(0xe27a);
|
||||
static const gitDiff = PhosphorIconPainter(0xe27c);
|
||||
static const gitPullRequest = PhosphorIconPainter(0xe282);
|
||||
static const magnifyingGlass = PhosphorIconPainter(0xe30c);
|
||||
static const terminal = PhosphorIconPainter(0xe47e);
|
||||
static const terminalWindow = PhosphorIconPainter(0xeae8);
|
||||
static const code = PhosphorIconPainter(0xe1bc);
|
||||
static const codeBlock = PhosphorIconPainter(0xeafe);
|
||||
static const pencilSimple = PhosphorIconPainter(0xe3b4);
|
||||
static const eye = PhosphorIconPainter(0xe220);
|
||||
static const eyeSlash = PhosphorIconPainter(0xe224);
|
||||
static const arrowsOutSimple = PhosphorIconPainter(0xe0a6);
|
||||
static const arrowsInSimple = PhosphorIconPainter(0xe09e);
|
||||
static const list = PhosphorIconPainter(0xe2f0);
|
||||
static const listChecks = PhosphorIconPainter(0xeadc);
|
||||
static const gear = PhosphorIconPainter(0xe270);
|
||||
static const puzzlePiece = PhosphorIconPainter(0xe596);
|
||||
static const keyboard = PhosphorIconPainter(0xe2d8);
|
||||
static const palette = PhosphorIconPainter(0xe6c8);
|
||||
static const warning = PhosphorIconPainter(0xe4e0);
|
||||
static const warningCircle = PhosphorIconPainter(0xe4e2);
|
||||
static const check = PhosphorIconPainter(0xe182);
|
||||
static const checkCircle = PhosphorIconPainter(0xe184);
|
||||
static const caretLeft = PhosphorIconPainter(0xe138);
|
||||
static const caretRight = PhosphorIconPainter(0xe13a);
|
||||
static const caretDown = PhosphorIconPainter(0xe136);
|
||||
static const caretUp = PhosphorIconPainter(0xe13c);
|
||||
static const graph = PhosphorIconPainter(0xeb58);
|
||||
static const treeStructure = PhosphorIconPainter(0xe67c);
|
||||
static const image = PhosphorIconPainter(0xe2ca);
|
||||
static const link = PhosphorIconPainter(0xe2e2);
|
||||
static const chatCircle = PhosphorIconPainter(0xe168);
|
||||
static const robot = PhosphorIconPainter(0xe762);
|
||||
static const ticket = PhosphorIconPainter(0xe490);
|
||||
static const lightbulb = PhosphorIconPainter(0xe2dc);
|
||||
static const notepad = PhosphorIconPainter(0xe63e);
|
||||
static const bookOpen = PhosphorIconPainter(0xe0e6);
|
||||
static const circlesFour = PhosphorIconPainter(0xe190);
|
||||
}
|
||||
@@ -30,3 +30,4 @@ export 'src/icons/search.dart';
|
||||
export 'src/icons/terminal_icon.dart';
|
||||
export 'src/icons/warning.dart';
|
||||
export 'src/icons/x.dart';
|
||||
export 'src/icons/phosphor.dart';
|
||||
|
||||
Reference in New Issue
Block a user