ThemeData.withFont constructor

ThemeData.withFont({
  1. Font? base,
  2. Font? bold,
  3. Font? italic,
  4. Font? boldItalic,
  5. Font? icons,
  6. List<Font>? fontFallback,
})

Implementation

factory ThemeData.withFont({
  Font? base,
  Font? bold,
  Font? italic,
  Font? boldItalic,
  Font? icons,
  List<Font>? fontFallback,
}) {
  final defaultStyle = TextStyle.defaultStyle().copyWith(
    font: base,
    fontNormal: base,
    fontBold: bold,
    fontItalic: italic,
    fontBoldItalic: boldItalic,
    fontFallback: fontFallback,
  );
  final fontSize = defaultStyle.fontSize!;

  return ThemeData._(
    defaultTextStyle: defaultStyle,
    paragraphStyle: defaultStyle.copyWith(lineSpacing: 5),
    bulletStyle: defaultStyle.copyWith(lineSpacing: 5),
    header0: defaultStyle.copyWith(fontSize: fontSize * 2.0),
    header1: defaultStyle.copyWith(fontSize: fontSize * 1.5),
    header2: defaultStyle.copyWith(fontSize: fontSize * 1.4),
    header3: defaultStyle.copyWith(fontSize: fontSize * 1.3),
    header4: defaultStyle.copyWith(fontSize: fontSize * 1.2),
    header5: defaultStyle.copyWith(fontSize: fontSize * 1.1),
    tableHeader: defaultStyle.copyWith(
        fontSize: fontSize * 0.8, fontWeight: FontWeight.bold),
    tableCell: defaultStyle.copyWith(fontSize: fontSize * 0.8),
    softWrap: true,
    overflow: TextOverflow.visible,
    iconTheme: IconThemeData.fallback(icons),
  );
}