fix(app): polish glass diff and pipeline controls

This commit is contained in:
2026-10-31 03:22:52 +00:00
parent 3641083bcc
commit 5bed73e658
9 changed files with 76 additions and 71 deletions
@@ -6,8 +6,9 @@ import 'diff_form_control.dart';
export 'diff_form_control.dart';
/// Patch text inherits the host's typography without a diff-specific font.
TextStyle nativeDiffText(TextStyle base) => base;
/// Patch columns use the bundled fixed-width face so gutters and markers align.
TextStyle nativeDiffText(TextStyle base) =>
base.copyWith(fontFamily: 'RobotoMono');
/// Keep Material-derived metadata roles readable inside a Cupertino host.
ThemeData hostTextTheme(BuildContext context) => ThemeData(
@@ -18,24 +18,15 @@ class PatchView extends StatelessWidget {
Widget build(BuildContext context) {
final parsed = file.parsedPatch;
final base = nativeDiffText(DefaultTextStyle.of(context).style);
final stat = changeStat(parsed.added, parsed.removed);
return Semantics(
container: true,
label: 'Rendered diff for ${file.path}',
value: stat.isEmpty ? noLineChangesMessage : stat,
value: changeStat(parsed.added, parsed.removed).isEmpty
? noLineChangesMessage
: changeStat(parsed.added, parsed.removed),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
child: ExcludeSemantics(
child: _StatLine(
added: parsed.added,
removed: parsed.removed,
base: base,
),
),
),
if (file.truncated)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
@@ -54,51 +45,6 @@ class PatchView extends StatelessWidget {
}
}
/// `+N` in the add colour and `-M` in the remove colour, or the honest note when
/// the patch records no changed line.
class _StatLine extends StatelessWidget {
const _StatLine({
required this.added,
required this.removed,
required this.base,
});
final int added;
final int removed;
final TextStyle base;
@override
Widget build(BuildContext context) {
if (added == 0 && removed == 0) {
return Text(
noLineChangesMessage,
style: base.copyWith(color: mutedColor(context)),
);
}
return Text.rich(
TextSpan(
children: [
if (added > 0)
TextSpan(
text: '+$added',
style: base.copyWith(
color: diffLineColors(context, ChangeLineKind.add).text,
),
),
if (added > 0 && removed > 0) TextSpan(text: ' ', style: base),
if (removed > 0)
TextSpan(
text: '-$removed',
style: base.copyWith(
color: diffLineColors(context, ChangeLineKind.remove).text,
),
),
],
),
);
}
}
class _HunkView extends StatelessWidget {
const _HunkView({required this.hunk});