fluffychat/lib/pangea/utils/bot_style.dart
Kelrap dc79b98ea6
More thorough error logging (#1297)
* Data is required for .logError

* Edit data for readability

* remove commented out breadcrumbs

---------

Co-authored-by: ggurdin <ggurdin@gmail.com>
Co-authored-by: ggurdin <46800240+ggurdin@users.noreply.github.com>
2024-12-23 15:05:17 -05:00

36 lines
1,019 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,
data: {},
);
return existingStyle ?? const TextStyle();
}
}
}