fix(app): polish glass diff and pipeline controls
This commit is contained in:
@@ -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});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user