diff --git a/analysis_options.yaml b/analysis_options.yaml index f065cf1ea4..ed639159ef 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,29 +1,7 @@ -# This file configures the analyzer, which statically analyzes Dart code to -# check for errors, warnings, and lints. -# -# The issues identified by the analyzer are surfaced in the UI of Dart-enabled -# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be -# invoked from the command line by running `flutter analyze`. - -# The following line activates a set of recommended lints for Flutter apps, -# packages, and plugins designed to encourage good coding practices. include: package:flutter_lints/flutter.yaml -linter: - # The lint rules applied to this project can be customized in the - # section below to disable rules from the `package:flutter_lints/flutter.yaml` - # included above or to enable additional rules. A list of all available lints - # and their documentation is published at - # https://dart-lang.github.io/linter/lints/index.html. - # - # Instead of disabling a lint rule for the entire project in the - # section below, it can also be suppressed for a single line of code - # or a specific dart file by using the `// ignore: name_of_lint` and - # `// ignore_for_file: name_of_lint` syntax on the line or in the file - # producing the lint. - rules: - # avoid_print: false # Uncomment to disable the `avoid_print` rule - # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule - -# Additional information about this file can be found at -# https://dart.dev/guides/language/analysis-options \ No newline at end of file +analyzer: + exclude: + # Example is a separate package (see example/pubspec.yaml); analyzing it + # from the root package duplicates work and lacks example-only deps. + - example/** diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index cccf817a52..2671e8141a 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,6 +5,14 @@ import FlutterMacOS import Foundation +import package_info_plus +import video_player_avfoundation +import wakelock_plus +import webview_flutter_wkwebview func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { + FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin")) + FVPVideoPlayerPlugin.register(with: registry.registrar(forPlugin: "FVPVideoPlayerPlugin")) + WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin")) + WebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "WebViewFlutterPlugin")) } diff --git a/example/pubspec.yaml b/example/pubspec.yaml index b5821958bf..d9079eedc9 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -9,6 +9,8 @@ environment: dependencies: flutter_html: path: ../ + flutter_html_all: + path: ../packages/flutter_html_all flutter: sdk: flutter diff --git a/lib/flutter_html.dart b/lib/flutter_html.dart index 0247d4c94b..867b5f09c2 100644 --- a/lib/flutter_html.dart +++ b/lib/flutter_html.dart @@ -66,7 +66,7 @@ class Html extends StatefulWidget { Html.fromDom({ Key? key, GlobalKey? anchorKey, - @required dom.Document? document, + required dom.Document? document, this.onLinkTap, this.onAnchorTap, this.extensions = const [], @@ -84,7 +84,7 @@ class Html extends StatefulWidget { Html.fromElement({ Key? key, GlobalKey? anchorKey, - @required this.documentElement, + required this.documentElement, this.onLinkTap, this.onAnchorTap, this.extensions = const [], diff --git a/lib/src/css_box_widget.dart b/lib/src/css_box_widget.dart index 85679ea4b7..1b807ed0e5 100644 --- a/lib/src/css_box_widget.dart +++ b/lib/src/css_box_widget.dart @@ -81,7 +81,8 @@ class CssBoxWidget extends StatelessWidget { child: top ? child : MediaQuery( - data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), + data: MediaQuery.of(context) + .copyWith(textScaler: TextScaler.noScaling), child: child, ), ), @@ -179,6 +180,7 @@ class CssBoxWidget extends StatelessWidget { } class _CSSBoxRenderer extends MultiChildRenderObjectWidget { + // ignore: prefer_const_constructors_in_immutables _CSSBoxRenderer({ Key? key, required super.children, @@ -769,7 +771,7 @@ extension Normalize on Dimension { double _calculateEmValue(Style style, BuildContext buildContext) { return (style.fontSize?.emValue ?? 16) * - MediaQuery.textScaleFactorOf(buildContext) * + MediaQuery.textScalerOf(buildContext).scale(1.0) * MediaQuery.of(buildContext).devicePixelRatio; } diff --git a/lib/src/css_parser.dart b/lib/src/css_parser.dart index c0fcf02f8b..57169787bc 100644 --- a/lib/src/css_parser.dart +++ b/lib/src/css_parser.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:collection/collection.dart'; import 'package:csslib/visitor.dart' as css; import 'package:csslib/parser.dart' as cssparser; diff --git a/lib/src/style.dart b/lib/src/style.dart index 4a7956d43b..914f8b8739 100644 --- a/lib/src/style.dart +++ b/lib/src/style.dart @@ -1,5 +1,3 @@ -import 'dart:ui'; - import 'package:flutter/material.dart'; import 'package:flutter_html/flutter_html.dart'; import 'package:flutter_html/src/css_parser.dart'; diff --git a/packages/flutter_html_audio/lib/flutter_html_audio.dart b/packages/flutter_html_audio/lib/flutter_html_audio.dart index ecd781d337..238cd52520 100644 --- a/packages/flutter_html_audio/lib/flutter_html_audio.dart +++ b/packages/flutter_html_audio/lib/flutter_html_audio.dart @@ -60,8 +60,8 @@ class _AudioWidgetState extends State { ]; if (sources.isNotEmpty && sources.first != null) { - audioController = VideoPlayerController.network( - sources.first ?? "", + audioController = VideoPlayerController.networkUrl( + Uri.parse(sources.first!), ); chewieAudioController = ChewieAudioController( videoPlayerController: audioController!, diff --git a/packages/flutter_html_iframe/lib/iframe_mobile.dart b/packages/flutter_html_iframe/lib/iframe_mobile.dart index c40a72ac7e..3578a29143 100644 --- a/packages/flutter_html_iframe/lib/iframe_mobile.dart +++ b/packages/flutter_html_iframe/lib/iframe_mobile.dart @@ -36,7 +36,7 @@ class IframeWidget extends StatelessWidget { final givenHeight = double.tryParse(extensionContext.attributes['height'] ?? ""); - Uri? srcUri; + final Uri srcUri; if (extensionContext.attributes['srcdoc'] != null) { srcUri = Uri.dataFromString( extensionContext.attributes['srcdoc'] ?? '', @@ -54,10 +54,7 @@ class IframeWidget extends StatelessWidget { style: extensionContext.styledElement!.style, childIsReplaced: true, child: WebViewWidget( - controller: controller - ..loadRequest( - Uri.tryParse(extensionContext.attributes['src'] ?? "") ?? - Uri()), + controller: controller..loadRequest(srcUri), key: key, gestureRecognizers: {Factory(() => VerticalDragGestureRecognizer())}, ), diff --git a/packages/flutter_html_video/lib/flutter_html_video.dart b/packages/flutter_html_video/lib/flutter_html_video.dart index 3675b173a0..ef317a95ce 100644 --- a/packages/flutter_html_video/lib/flutter_html_video.dart +++ b/packages/flutter_html_video/lib/flutter_html_video.dart @@ -83,8 +83,7 @@ class _VideoWidgetState extends State { VideoPlayerController.file(File.fromUri(sourceUri)); break; default: - _videoController = - VideoPlayerController.network(sourceUri.toString()); + _videoController = VideoPlayerController.networkUrl(sourceUri); break; } _chewieController = ChewieController(