Terminal theme: flat lists, compact settings, one-line reply quote
build / build (push) Successful in 17m24s
build / build (push) Successful in 17m24s
In the terminal theme only: - MeshCard becomes a flat row with a rule underneath: no margin, no corners, 8/4 padding. Channel and contact lists, settings groups and every other card shrink to about half their height. - AvatarCircle is just the glyph (icon or initials, at most 20 px), the contact emoji avatar likewise. - MeshNavTile and SectionHeader: smaller icons, padding and type. - Text line height 1.2 instead of Material's 1.4-1.5. - A reply in a channel is one dim line above the message, "↳ <nick> quoted text…", instead of the boxed preview; the "replying to" banner above the composer loses its padding. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
55386df69f
commit
e939932cef
5 files changed
+145
-29
No files matched your search
@@ -1906,7 +1906,9 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
final replyRegion = message.region;
|
final replyRegion = message.region;
|
||||||
return Container(
|
return Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
padding: MeshStyle.of(context).terminal
|
||||||
|
? const EdgeInsets.symmetric(horizontal: 6, vertical: 0)
|
||||||
|
: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: scheme.surfaceContainerHigh,
|
color: scheme.surfaceContainerHigh,
|
||||||
border: Border(
|
border: Border(
|
||||||
@@ -2390,6 +2392,41 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
return region.startsWith('#') ? region.substring(1) : region;
|
return region.startsWith('#') ? region.substring(1) : region;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// tth fork, terminal theme: the quoted message as one dim line,
|
||||||
|
/// `↳ <nick> text…`; tap jumps to it like the bubble preview does.
|
||||||
|
Widget _buildTerminalReplyQuote(ChannelMessage message, double textScale) {
|
||||||
|
final scheme = Theme.of(context).colorScheme;
|
||||||
|
final nick = message.replyToSenderName ?? '';
|
||||||
|
final quoted = (message.replyToText ?? '').replaceAll('\n', ' ');
|
||||||
|
final style = MeshTheme.mono(
|
||||||
|
fontSize: 12 * textScale,
|
||||||
|
color: scheme.onSurfaceVariant,
|
||||||
|
letterSpacing: 0,
|
||||||
|
);
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => _scrollToMessage(message.replyToMessageId!),
|
||||||
|
child: Text.rich(
|
||||||
|
TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(text: '↳ ', style: style),
|
||||||
|
TextSpan(
|
||||||
|
text: '<$nick> ',
|
||||||
|
style: style.copyWith(color: senderNameColor(nick)),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: GifHelper.parseGif(quoted) != null
|
||||||
|
? context.l10n.chat_receivedGif
|
||||||
|
: quoted,
|
||||||
|
style: style,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/// tth fork, terminal theme: the message as an IRC line across the whole
|
/// tth fork, terminal theme: the message as an IRC line across the whole
|
||||||
/// width — no avatar, no bubble, own messages on the left as well.
|
/// width — no avatar, no bubble, own messages on the left as well.
|
||||||
Widget _buildTerminalMessage(
|
Widget _buildTerminalMessage(
|
||||||
@@ -2475,7 +2512,7 @@ class _ChannelChatScreenState extends State<ChannelChatScreen> {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
if (message.replyToMessageId != null)
|
if (message.replyToMessageId != null)
|
||||||
_buildReplyPreview(message, textScale),
|
_buildTerminalReplyQuote(message, textScale),
|
||||||
TerminalMessageLine(
|
TerminalMessageLine(
|
||||||
time: formatChatTime(context, message.timestamp),
|
time: formatChatTime(context, message.timestamp),
|
||||||
nick: nick,
|
nick: nick,
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ import '../l10n/contact_localization.dart';
|
|||||||
import '../models/contact_group.dart';
|
import '../models/contact_group.dart';
|
||||||
import '../services/ui_view_state_service.dart';
|
import '../services/ui_view_state_service.dart';
|
||||||
import '../theme/mesh_theme.dart';
|
import '../theme/mesh_theme.dart';
|
||||||
|
import '../theme/terminal_theme.dart';
|
||||||
import '../utils/contact_search.dart';
|
import '../utils/contact_search.dart';
|
||||||
import '../storage/contact_group_store.dart';
|
import '../storage/contact_group_store.dart';
|
||||||
import '../utils/dialog_utils.dart';
|
import '../utils/dialog_utils.dart';
|
||||||
@@ -1826,7 +1827,12 @@ class _ContactTile extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// Avatar
|
// Avatar
|
||||||
if (emoji != null)
|
if (emoji != null && MeshStyle.of(context).terminal)
|
||||||
|
SizedBox(
|
||||||
|
width: 20,
|
||||||
|
child: Text(emoji, style: const TextStyle(fontSize: 14)),
|
||||||
|
)
|
||||||
|
else if (emoji != null)
|
||||||
Container(
|
Container(
|
||||||
width: 42,
|
width: 42,
|
||||||
height: 42,
|
height: 42,
|
||||||
|
|||||||
@@ -105,9 +105,11 @@ ThemeData terminalTheme() {
|
|||||||
visualDensity: VisualDensity.compact,
|
visualDensity: VisualDensity.compact,
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
||||||
splashFactory: NoSplash.splashFactory,
|
splashFactory: NoSplash.splashFactory,
|
||||||
textTheme: base.textTheme.apply(
|
textTheme: _tightLines(
|
||||||
fontFamily: MeshFonts.mono,
|
base.textTheme.apply(
|
||||||
fontFamilyFallback: MeshFonts.monoFallback,
|
fontFamily: MeshFonts.mono,
|
||||||
|
fontFamilyFallback: MeshFonts.monoFallback,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
appBarTheme: base.appBarTheme.copyWith(
|
appBarTheme: base.appBarTheme.copyWith(
|
||||||
toolbarHeight: 48,
|
toolbarHeight: 48,
|
||||||
@@ -227,3 +229,26 @@ ThemeData terminalTheme() {
|
|||||||
extensions: const [MeshStyle(terminal: true)],
|
extensions: const [MeshStyle(terminal: true)],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Material's 1.4-1.5 line height is what makes list rows tall; a terminal
|
||||||
|
/// runs at ~1.2.
|
||||||
|
TextTheme _tightLines(TextTheme t) {
|
||||||
|
TextStyle? tight(TextStyle? s) => s?.copyWith(height: 1.2);
|
||||||
|
return t.copyWith(
|
||||||
|
displayLarge: tight(t.displayLarge),
|
||||||
|
displayMedium: tight(t.displayMedium),
|
||||||
|
displaySmall: tight(t.displaySmall),
|
||||||
|
headlineLarge: tight(t.headlineLarge),
|
||||||
|
headlineMedium: tight(t.headlineMedium),
|
||||||
|
headlineSmall: tight(t.headlineSmall),
|
||||||
|
titleLarge: tight(t.titleLarge),
|
||||||
|
titleMedium: tight(t.titleMedium),
|
||||||
|
titleSmall: tight(t.titleSmall),
|
||||||
|
bodyLarge: tight(t.bodyLarge),
|
||||||
|
bodyMedium: tight(t.bodyMedium),
|
||||||
|
bodySmall: tight(t.bodySmall),
|
||||||
|
labelLarge: tight(t.labelLarge),
|
||||||
|
labelMedium: tight(t.labelMedium),
|
||||||
|
labelSmall: tight(t.labelSmall),
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../theme/terminal_theme.dart';
|
||||||
|
|
||||||
/// Settings-style navigation row: leading icon, bold title, secondary
|
/// Settings-style navigation row: leading icon, bold title, secondary
|
||||||
/// subtitle and an optional trailing chevron.
|
/// subtitle and an optional trailing chevron.
|
||||||
///
|
///
|
||||||
@@ -40,21 +42,21 @@ class MeshNavTile extends StatelessWidget {
|
|||||||
final textTheme = theme.textTheme;
|
final textTheme = theme.textTheme;
|
||||||
final enabled = onTap != null;
|
final enabled = onTap != null;
|
||||||
final effectiveIconColor = iconColor ?? scheme.onSurfaceVariant;
|
final effectiveIconColor = iconColor ?? scheme.onSurfaceVariant;
|
||||||
|
final terminal = MeshStyle.of(context).terminal;
|
||||||
|
final iconSize = terminal ? 18.0 : 24.0;
|
||||||
|
|
||||||
final row = Row(
|
final row = Row(
|
||||||
children: [
|
children: [
|
||||||
Icon(icon, size: 24, color: effectiveIconColor),
|
Icon(icon, size: iconSize, color: effectiveIconColor),
|
||||||
const SizedBox(width: 16),
|
SizedBox(width: terminal ? 10 : 16),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
title,
|
title,
|
||||||
style: textTheme.bodyLarge?.copyWith(
|
style: (terminal ? textTheme.bodyMedium : textTheme.bodyLarge)
|
||||||
fontWeight: FontWeight.w600,
|
?.copyWith(fontWeight: FontWeight.w600, color: titleColor),
|
||||||
color: titleColor,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (subtitle != null) ...[
|
if (subtitle != null) ...[
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
@@ -64,11 +66,12 @@ class MeshNavTile extends StatelessWidget {
|
|||||||
overflow: subtitleMaxLines == null
|
overflow: subtitleMaxLines == null
|
||||||
? null
|
? null
|
||||||
: TextOverflow.ellipsis,
|
: TextOverflow.ellipsis,
|
||||||
style: textTheme.bodyMedium?.copyWith(
|
style: (terminal ? textTheme.bodySmall : textTheme.bodyMedium)
|
||||||
color: titleColor != null
|
?.copyWith(
|
||||||
? titleColor!.withValues(alpha: 0.8)
|
color: titleColor != null
|
||||||
: scheme.onSurfaceVariant,
|
? titleColor!.withValues(alpha: 0.8)
|
||||||
),
|
: scheme.onSurfaceVariant,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
@@ -76,7 +79,11 @@ class MeshNavTile extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
?trailing,
|
?trailing,
|
||||||
if (showChevron && trailing == null)
|
if (showChevron && trailing == null)
|
||||||
Icon(Icons.chevron_right, color: scheme.onSurfaceVariant, size: 24),
|
Icon(
|
||||||
|
Icons.chevron_right,
|
||||||
|
color: scheme.onSurfaceVariant,
|
||||||
|
size: iconSize,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -87,7 +94,9 @@ class MeshNavTile extends StatelessWidget {
|
|||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: onTap,
|
onTap: onTap,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: padding,
|
padding: terminal
|
||||||
|
? const EdgeInsets.symmetric(horizontal: 8, vertical: 5)
|
||||||
|
: padding,
|
||||||
// Dimmed rather than recoloured so warn/alert tints still read as
|
// Dimmed rather than recoloured so warn/alert tints still read as
|
||||||
// such while clearly unavailable.
|
// such while clearly unavailable.
|
||||||
child: Opacity(opacity: enabled ? 1 : 0.5, child: row),
|
child: Opacity(opacity: enabled ? 1 : 0.5, child: row),
|
||||||
|
|||||||
+49
-10
@@ -5,6 +5,7 @@ import 'package:flutter/services.dart';
|
|||||||
|
|
||||||
import '../l10n/l10n.dart';
|
import '../l10n/l10n.dart';
|
||||||
import '../theme/mesh_theme.dart';
|
import '../theme/mesh_theme.dart';
|
||||||
|
import '../theme/terminal_theme.dart';
|
||||||
|
|
||||||
/// MeshCore shared design kit.
|
/// MeshCore shared design kit.
|
||||||
///
|
///
|
||||||
@@ -30,16 +31,24 @@ class SectionHeader extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final scheme = Theme.of(context).colorScheme;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: padding,
|
padding: MeshStyle.of(context).terminal
|
||||||
|
? const EdgeInsets.fromLTRB(8, 10, 8, 2)
|
||||||
|
: padding,
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
label.toUpperCase(),
|
label.toUpperCase(),
|
||||||
style: MeshTheme.accentLabel(
|
style: MeshStyle.of(context).terminal
|
||||||
color: scheme.onSurfaceVariant,
|
? MeshTheme.mono(
|
||||||
fontSize: 13,
|
color: scheme.onSurfaceVariant,
|
||||||
),
|
fontSize: 12,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
)
|
||||||
|
: MeshTheme.accentLabel(
|
||||||
|
color: scheme.onSurfaceVariant,
|
||||||
|
fontSize: 13,
|
||||||
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -79,12 +88,21 @@ class MeshCard extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final scheme = Theme.of(context).colorScheme;
|
final scheme = Theme.of(context).colorScheme;
|
||||||
final shape = RoundedRectangleBorder(
|
// Terminal theme: a flat list row with a rule underneath, no gaps.
|
||||||
borderRadius: BorderRadius.circular(radius),
|
final terminal = MeshStyle.of(context).terminal;
|
||||||
side: BorderSide(color: borderColor ?? scheme.outlineVariant),
|
final ShapeBorder shape = terminal
|
||||||
);
|
? Border(
|
||||||
|
bottom: BorderSide(color: borderColor ?? scheme.outlineVariant),
|
||||||
|
)
|
||||||
|
: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(radius),
|
||||||
|
side: BorderSide(color: borderColor ?? scheme.outlineVariant),
|
||||||
|
);
|
||||||
|
final padding = terminal && this.padding != EdgeInsets.zero
|
||||||
|
? const EdgeInsets.symmetric(horizontal: 8, vertical: 4)
|
||||||
|
: this.padding;
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: margin,
|
padding: terminal ? EdgeInsets.zero : margin,
|
||||||
child: Material(
|
child: Material(
|
||||||
color: color ?? scheme.surfaceContainerLow,
|
color: color ?? scheme.surfaceContainerLow,
|
||||||
shape: shape,
|
shape: shape,
|
||||||
@@ -274,6 +292,27 @@ class AvatarCircle extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final accent = color ?? _colorFor(name);
|
final accent = color ?? _colorFor(name);
|
||||||
final initials = _initials(name);
|
final initials = _initials(name);
|
||||||
|
if (MeshStyle.of(context).terminal) {
|
||||||
|
// Terminal theme: just the glyph, small enough for a one-line row.
|
||||||
|
final s = math.min(size, 20.0);
|
||||||
|
return SizedBox(
|
||||||
|
width: s,
|
||||||
|
height: s,
|
||||||
|
child: Center(
|
||||||
|
child: icon != null
|
||||||
|
? Icon(icon, size: s * 0.85, color: accent)
|
||||||
|
: Text(
|
||||||
|
initials,
|
||||||
|
style: MeshTheme.mono(
|
||||||
|
fontSize: s * 0.55,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: accent,
|
||||||
|
letterSpacing: 0,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
return Container(
|
return Container(
|
||||||
width: size,
|
width: size,
|
||||||
height: size,
|
height: size,
|
||||||
|
|||||||
Reference in new issue
Block a user