Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'main' into custom_fontfeature_superscript
# Conflicts:
#	packages/flutter_markdown/CHANGELOG.md
#	packages/flutter_markdown/lib/src/style_sheet.dart
#	packages/flutter_markdown/pubspec.yaml
  • Loading branch information
dawidope committed Apr 10, 2024
commit 223bd423ac7d7e9e84f39fca9356b5ec9321821b
39 changes: 37 additions & 2 deletions packages/flutter_markdown/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@
## 0.6.18+4
## 0.6.23

* Allow for choosing custom font feature to create superscript in footnotes when the font does not support `supr` font feature. Use `superscriptFontFeatureTag` property in `MarkdownStyleSheet`. For example for `Roboto` font you can set `numr`.
* Allows for choosing a custom font feature to create superscript in footnotes when the font does not support the `supr` font feature.
* Use the `superscriptFontFeatureTag` property in `MarkdownStyleSheet`.
* For example, for the `Roboto` font which doesn't support `supr`, you can set `numr`.

## 0.6.22+1

* Removes `_ambiguate` methods from code.

## 0.6.22

* Introduces a new `MarkdownElementBuilder.isBlockElement()` method to specify if custom element
is a block.

## 0.6.21+1

* Adds `onSelectionChanged` to the constructors of `Markdown` and `MarkdownBody`.

## 0.6.21

* Fixes support for `WidgetSpan` in `Text.rich` elements inside `MarkdownElementBuilder`.

## 0.6.20+1

* Updates minimum supported SDK version to Flutter 3.19.

## 0.6.20

* Adds `textScaler` to `MarkdownStyleSheet`, and deprecates `textScaleFactor`.
* Clients using `textScaleFactor: someFactor` should replace it with
`TextScaler.linear(someFactor)` to preserve behavior.
* Removes use of deprecated Flutter framework `textScaleFactor` methods.
* Updates minimum supported SDK version to Flutter 3.16.

## 0.6.19

* Replaces `RichText` with `Text.rich` so the widget can work with `SelectionArea` when `selectable` is set to false.

## 0.6.18+3

Expand Down
47 changes: 28 additions & 19 deletions packages/flutter_markdown/lib/src/style_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,18 @@ class MarkdownStyleSheet {
this.orderedListAlign = WrapAlignment.start,
this.blockquoteAlign = WrapAlignment.start,
this.codeblockAlign = WrapAlignment.start,
this.textScaleFactor,
this.superscriptFontFeatureTag,
}) : _styles = <String, TextStyle?>{
@Deprecated('Use textScaler instead.') this.textScaleFactor,
TextScaler? textScaler,
}) : assert(
textScaler == null || textScaleFactor == null,
'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
),
textScaler = textScaler ??
// Internally, only textScaler is used, so convert the scale factor
// to a linear scaler.
(textScaleFactor == null ? null : TextScaler.linear(textScaleFactor)),
_styles = <String, TextStyle?>{
'a': a,
'p': p,
'li': p,
Expand Down Expand Up @@ -155,9 +164,7 @@ 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 @@ -381,19 +388,18 @@ class MarkdownStyleSheet {
WrapAlignment? orderedListAlign,
WrapAlignment? blockquoteAlign,
WrapAlignment? codeblockAlign,
double? textScaleFactor,
String? superscriptFontFeatureTag,
@Deprecated('Use textScaler instead.') double? textScaleFactor,
TextScaler? textScaler,
}) {
assert(
textScaler == null || textScaleFactor == null,
'textScaleFactor is deprecated and cannot be specified when textScaler is specified.',
);
// 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 @@ -428,14 +434,12 @@ 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 @@ -447,9 +451,9 @@ class MarkdownStyleSheet {
orderedListAlign: orderedListAlign ?? this.orderedListAlign,
blockquoteAlign: blockquoteAlign ?? this.blockquoteAlign,
codeblockAlign: codeblockAlign ?? this.codeblockAlign,
textScaleFactor: textScaleFactor ?? this.textScaleFactor,
superscriptFontFeatureTag:
superscriptFontFeatureTag ?? this.superscriptFontFeatureTag,
superscriptFontFeatureTag: superscriptFontFeatureTag ?? this.superscriptFontFeatureTag,
textScaler: newTextScaler,
textScaleFactor: nextTextScaleFactor,
);
}

Expand Down Expand Up @@ -512,6 +516,11 @@ class MarkdownStyleSheet {
codeblockAlign: other.codeblockAlign,
textScaleFactor: other.textScaleFactor,
superscriptFontFeatureTag: other.superscriptFontFeatureTag,
// Only one of textScaler and textScaleFactor can be passed. If
// other.textScaleFactor is non-null, then the sheet was created with a
// textScaleFactor and the textScaler was derived from that, so should be
// ignored so that the textScaleFactor continues to be set.
textScaler: other.textScaleFactor == null ? other.textScaler : null,
);
}

Expand Down Expand Up @@ -743,8 +752,8 @@ class MarkdownStyleSheet {
other.orderedListAlign == orderedListAlign &&
other.blockquoteAlign == blockquoteAlign &&
other.codeblockAlign == codeblockAlign &&
other.textScaleFactor == textScaleFactor &&
other.superscriptFontFeatureTag == superscriptFontFeatureTag;
other.superscriptFontFeatureTag == superscriptFontFeatureTag &&
other.textScaler == textScaler;
}

@override
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_markdown/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Markdown renderer for Flutter. Create rich text output,
formatted with simple Markdown tags.
repository: https://github.com/flutter/packages/tree/main/packages/flutter_markdown
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+flutter_markdown%22
version: 0.6.18+4
version: 0.6.23

environment:
sdk: ^3.3.0
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.