mirror of
https://github.com/flutter/packages.git
synced 2025-07-03 00:49:32 +08:00
@ -1,3 +1,7 @@
|
||||
## 0.6.20+1
|
||||
|
||||
* Updates minimum supported SDK version to Flutter 3.19.
|
||||
|
||||
## 0.6.20
|
||||
|
||||
* Adds `textScaler` to `MarkdownStyleSheet`, and deprecates `textScaleFactor`.
|
||||
|
@ -2,7 +2,7 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:html'; // ignore: avoid_web_libraries_in_flutter
|
||||
import 'dart:js_interop';
|
||||
|
||||
import 'package:flutter/cupertino.dart' show CupertinoTheme;
|
||||
import 'package:flutter/material.dart' show Theme;
|
||||
@ -50,20 +50,14 @@ final MarkdownStyleSheet Function(BuildContext, MarkdownStyleSheetBaseTheme?)
|
||||
BuildContext context,
|
||||
MarkdownStyleSheetBaseTheme? baseTheme,
|
||||
) {
|
||||
MarkdownStyleSheet result;
|
||||
switch (baseTheme) {
|
||||
case MarkdownStyleSheetBaseTheme.platform:
|
||||
final String userAgent = window.navigator.userAgent;
|
||||
result = userAgent.contains('Mac OS X')
|
||||
? MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context))
|
||||
: MarkdownStyleSheet.fromTheme(Theme.of(context));
|
||||
case MarkdownStyleSheetBaseTheme.cupertino:
|
||||
result =
|
||||
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context));
|
||||
case MarkdownStyleSheetBaseTheme.material:
|
||||
default: // ignore: no_default_cases
|
||||
result = MarkdownStyleSheet.fromTheme(Theme.of(context));
|
||||
}
|
||||
final MarkdownStyleSheet result = switch (baseTheme) {
|
||||
MarkdownStyleSheetBaseTheme.platform
|
||||
when _userAgent.toDart.contains('Mac OS X') =>
|
||||
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context)),
|
||||
MarkdownStyleSheetBaseTheme.cupertino =>
|
||||
MarkdownStyleSheet.fromCupertinoTheme(CupertinoTheme.of(context)),
|
||||
_ => MarkdownStyleSheet.fromTheme(Theme.of(context)),
|
||||
};
|
||||
|
||||
return result.copyWith(
|
||||
textScaler: MediaQuery.textScalerOf(context),
|
||||
@ -84,3 +78,6 @@ Widget _handleDataSchemeUri(
|
||||
}
|
||||
return const SizedBox();
|
||||
}
|
||||
|
||||
@JS('window.navigator.userAgent')
|
||||
external JSString get _userAgent;
|
||||
|
@ -2,14 +2,11 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// ignore: unnecessary_import, see https://github.com/flutter/flutter/pull/138881
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:markdown/markdown.dart' as md;
|
||||
|
||||
import '_functions_io.dart' if (dart.library.html) '_functions_web.dart';
|
||||
import '_functions_io.dart' if (dart.library.js_interop) '_functions_web.dart';
|
||||
import 'style_sheet.dart';
|
||||
import 'widget.dart';
|
||||
|
||||
|
@ -4,11 +4,11 @@ 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.20
|
||||
version: 0.6.20+1
|
||||
|
||||
environment:
|
||||
sdk: ^3.2.0
|
||||
flutter: ">=3.16.0"
|
||||
sdk: ^3.3.0
|
||||
flutter: ">=3.19.0"
|
||||
|
||||
dependencies:
|
||||
flutter:
|
||||
|
Reference in New Issue
Block a user