Skip to content
Prev Previous commit
Next Next commit
[flutter_markdown] format syntax
  • Loading branch information
dawidope committed Apr 10, 2024
commit 6de425e6b66a4b4fdd1ef3066621b726ba99512c
23 changes: 16 additions & 7 deletions packages/flutter_markdown/lib/src/style_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ class MarkdownStyleSheet {
textScaler = textScaler ??
// Internally, only textScaler is used, so convert the scale factor
// to a linear scaler.
(textScaleFactor == null ? null : TextScaler.linear(textScaleFactor)),
(textScaleFactor == null
? null
: TextScaler.linear(textScaleFactor)),
_styles = <String, TextStyle?>{
'a': a,
'p': p,
Expand Down Expand Up @@ -164,7 +166,9 @@ class MarkdownStyleSheet {
assert(theme.textTheme.textStyle.fontSize != null);
return MarkdownStyleSheet(
a: theme.textTheme.textStyle.copyWith(
color: theme.brightness == Brightness.dark ? CupertinoColors.link.darkColor : CupertinoColors.link.color,
color: theme.brightness == Brightness.dark
? CupertinoColors.link.darkColor
: CupertinoColors.link.color,
),
p: theme.textTheme.textStyle,
pPadding: EdgeInsets.zero,
Expand Down Expand Up @@ -398,8 +402,10 @@ class MarkdownStyleSheet {
);
// If either of textScaler or textScaleFactor is non-null, pass null for the
// other instead of the previous value, since only one is allowed.
final TextScaler? newTextScaler = textScaler ?? (textScaleFactor == null ? this.textScaler : null);
final double? nextTextScaleFactor = textScaleFactor ?? (textScaler == null ? this.textScaleFactor : null);
final TextScaler? newTextScaler =
textScaler ?? (textScaleFactor == null ? this.textScaler : null);
final double? nextTextScaleFactor =
textScaleFactor ?? (textScaler == null ? this.textScaleFactor : null);
return MarkdownStyleSheet(
a: a ?? this.a,
p: p ?? this.p,
Expand Down Expand Up @@ -434,12 +440,14 @@ class MarkdownStyleSheet {
tableColumnWidth: tableColumnWidth ?? this.tableColumnWidth,
tableCellsPadding: tableCellsPadding ?? this.tableCellsPadding,
tableCellsDecoration: tableCellsDecoration ?? this.tableCellsDecoration,
tableVerticalAlignment: tableVerticalAlignment ?? this.tableVerticalAlignment,
tableVerticalAlignment:
tableVerticalAlignment ?? this.tableVerticalAlignment,
blockquotePadding: blockquotePadding ?? this.blockquotePadding,
blockquoteDecoration: blockquoteDecoration ?? this.blockquoteDecoration,
codeblockPadding: codeblockPadding ?? this.codeblockPadding,
codeblockDecoration: codeblockDecoration ?? this.codeblockDecoration,
horizontalRuleDecoration: horizontalRuleDecoration ?? this.horizontalRuleDecoration,
horizontalRuleDecoration:
horizontalRuleDecoration ?? this.horizontalRuleDecoration,
textAlign: textAlign ?? this.textAlign,
h1Align: h1Align ?? this.h1Align,
h2Align: h2Align ?? this.h2Align,
Expand All @@ -451,7 +459,8 @@ class MarkdownStyleSheet {
orderedListAlign: orderedListAlign ?? this.orderedListAlign,
blockquoteAlign: blockquoteAlign ?? this.blockquoteAlign,
codeblockAlign: codeblockAlign ?? this.codeblockAlign,
superscriptFontFeatureTag: superscriptFontFeatureTag ?? this.superscriptFontFeatureTag,
superscriptFontFeatureTag:
superscriptFontFeatureTag ?? this.superscriptFontFeatureTag,
textScaler: newTextScaler,
textScaleFactor: nextTextScaleFactor,
);
Expand Down