182fd9bb62
Model, mode and thinking buttons carry 12 px horizontal padding, replacing
the pill inset from 440995e3. Alt+Y (Option+Y by key position) toggles the
floating chats, like Alt+T for the terminal.
42 lines
1.5 KiB
Dart
42 lines
1.5 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,
|
|
// The same 12 px each side as an icon button's glyph inside its 48 px
|
|
// target, so text sits off its hover/press shape as it does top and bottom.
|
|
padding: compact ? null : chatBarButtonPadding,
|
|
minimumSize: compact ? null : const Size.square(kMinInteractiveDimension),
|
|
);
|
|
|
|
/// Horizontal padding inside the bar's text buttons (model, mode).
|
|
const EdgeInsets chatBarButtonPadding = EdgeInsets.symmetric(horizontal: 12);
|
|
|
|
/// 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,
|
|
),
|
|
);
|
|
}
|