fluffychat/lib/pangea/utils/bot_style.dart
ggurdin 34c6511387
1053 making font in the tool pop up the same size as message (#1075)
* give text in toolbar the same size / style as message text

* fix scrolling in overlay message and message translation, also fix overflow on mobile
2024-11-20 14:03:31 -05:00

32 lines
976 B
Dart

import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
import 'package:flutter/material.dart';
class BotStyle {
static TextStyle text(
BuildContext context, {
TextStyle? existingStyle,
bool setColor = true,
bool big = false,
bool italics = false,
bool bold = false,
}) {
try {
final TextStyle botStyle = TextStyle(
fontWeight: bold ? FontWeight.w700 : null,
fontSize: AppConfig.messageFontSize *
AppConfig.fontSizeFactor *
(big == true ? 1.2 : 1),
fontStyle: italics ? FontStyle.italic : null,
color: setColor ? Theme.of(context).colorScheme.primary : null,
inherit: true,
height: 1.3,
);
return existingStyle?.merge(botStyle) ?? botStyle;
} catch (err, stack) {
ErrorHandler.logError(m: "error getting styles", s: stack);
return existingStyle ?? const TextStyle();
}
}
}