Files
pipelines/app/lib/features/chat/conversation/chat_bar_control_style.dart
T
alan 123c864397 Evenly space chat action bar controls
Add a uniform desktop gap between header control groups and remove duplicated horizontal padding from model and mode controls. Preserve compact-layout touch targets and add Material/Cupertino regression coverage.
2026-11-10 16:38:55 +00:00

37 lines
1.2 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'chat_bar_tint.dart';
/// The conversation bar's model and mode controls read as the bar's other
/// actions do: neutral, not tinted like a primary call to action. In a
/// coloured chat's bar they take its foreground ([ChatBarTintScope]) instead.
///
/// Material: a [TextButton] style in the role the bar's icon buttons use
/// (`onSurfaceVariant`).
ButtonStyle chatBarTextButtonStyle(
BuildContext context, {
bool compact = false,
}) => TextButton.styleFrom(
foregroundColor:
ChatBarTintScope.foregroundOf(context) ??
Theme.of(context).colorScheme.onSurfaceVariant,
padding: compact ? null : EdgeInsets.zero,
minimumSize: compact ? null : const Size.square(kMinInteractiveDimension),
);
/// Cupertino: [content] (a [CupertinoButton]'s child) in the label colour
/// instead of the button's tint.
Widget chatBarCupertinoContent(BuildContext context, Widget content) {
final color =
ChatBarTintScope.foregroundOf(context) ??
CupertinoColors.label.resolveFrom(context);
return IconTheme.merge(
data: IconThemeData(color: color),
child: DefaultTextStyle.merge(
style: TextStyle(color: color),
child: content,
),
);
}