You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/pangea/utils/bot_style.dart

37 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:fluffychat/config/app_config.dart';
import 'package:fluffychat/pangea/utils/error_handler.dart';
class BotStyle {
static TextStyle text(
BuildContext context, {
TextStyle? existingStyle,
bool setColor = true,
bool big = false,
bool italics = false,
bool bold = true,
}) {
try {
final TextStyle botStyle = TextStyle(
fontFamily: 'Inconsolata',
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).brightness == Brightness.dark
? AppConfig.primaryColorLight
: AppConfig.primaryColor
: null,
);
return existingStyle?.merge(botStyle) ?? botStyle;
} catch (err, stack) {
ErrorHandler.logError(m: "error getting styles", s: stack);
return existingStyle ?? const TextStyle();
}
}
}