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); /// Puts [content] (a button's child) in the bar's foreground colour: the /// chat's tint if it has one, else `onSurfaceVariant`. Kept for existing /// callers; the Material path colours buttons with [chatBarTextButtonStyle]. Widget chatBarCupertinoContent(BuildContext context, Widget content) { final color = ChatBarTintScope.foregroundOf(context) ?? Theme.of(context).colorScheme.onSurfaceVariant; return IconTheme.merge( data: IconThemeData(color: color), child: DefaultTextStyle.merge( style: TextStyle(color: color), child: content, ), ); }