Skip to content

Commit d13ca75

Browse files
authored
Merge pull request Sub6Resources#967 from vrtdev/feature/release-300-alpha2
Modularization alphas.2 release
2 parents 63d3ee7 + fbef3b6 commit d13ca75

File tree

110 files changed

+3705
-1500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+3705
-1500
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [3.0.0-alpha.2] - January 5, 2022:
2+
* **BREAKING** Full modularization using split packages; see our upgrade guide or use flutter_html_all
3+
14
## [3.0.0-alpha.1] - December 21, 2021:
25
* **BREAKING** Reworked custom renders pending full modularation in 3.0.0
36
* Extended support custom render when using SelectableHtml

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 Matthew Whitaker
3+
Copyright (c) 2019-2022 The flutter_html developers
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 154 additions & 283 deletions
Large diffs are not rendered by default.

example/analysis_options.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file configures the analyzer, which statically analyzes Dart code to
2+
# check for errors, warnings, and lints.
3+
#
4+
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5+
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6+
# invoked from the command line by running `flutter analyze`.
7+
8+
# The following line activates a set of recommended lints for Flutter apps,
9+
# packages, and plugins designed to encourage good coding practices.
10+
include: package:flutter_lints/flutter.yaml
11+
12+
linter:
13+
# The lint rules applied to this project can be customized in the
14+
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
15+
# included above or to enable additional rules. A list of all available lints
16+
# and their documentation is published at
17+
# https://dart-lang.github.io/linter/lints/index.html.
18+
#
19+
# Instead of disabling a lint rule for the entire project in the
20+
# section below, it can also be suppressed for a single line of code
21+
# or a specific dart file by using the `// ignore: name_of_lint` and
22+
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
23+
# producing the lint.
24+
rules:
25+
# avoid_print: false # Uncomment to disable the `avoid_print` rule
26+
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27+
28+
# Additional information about this file can be found at
29+
# https://dart.dev/guides/language/analysis-options

example/android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ apply plugin: 'com.android.application'
2525
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
2626

2727
android {
28-
compileSdkVersion 28
28+
compileSdkVersion 31
2929

3030
lintOptions {
3131
disable 'InvalidPackage'
@@ -34,7 +34,7 @@ android {
3434
defaultConfig {
3535
applicationId "com.example.example"
3636
minSdkVersion 19
37-
targetSdkVersion 28
37+
targetSdkVersion 31
3838
versionCode flutterVersionCode.toInteger()
3939
versionName flutterVersionName
4040
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

example/android/app/src/main/AndroidManifest.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
android:theme="@style/LaunchTheme"
1313
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
1414
android:hardwareAccelerated="true"
15-
android:windowSoftInputMode="adjustResize">
15+
android:windowSoftInputMode="adjustResize"
16+
android:exported="true">
1617
<intent-filter>
1718
<action android:name="android.intent.action.MAIN"/>
1819
<category android:name="android.intent.category.LAUNCHER"/>

example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 46;
6+
objectVersion = 50;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -167,7 +167,7 @@
167167
97C146E61CF9000F007C117D /* Project object */ = {
168168
isa = PBXProject;
169169
attributes = {
170-
LastUpgradeCheck = 1020;
170+
LastUpgradeCheck = 1300;
171171
ORGANIZATIONNAME = "The Chromium Authors";
172172
TargetAttributes = {
173173
97C146ED1CF9000F007C117D = {

example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Scheme
3-
LastUpgradeVersion = "1020"
3+
LastUpgradeVersion = "1300"
44
version = "1.3">
55
<BuildAction
66
parallelizeBuildables = "YES"

example/lib/main.dart

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 'package:flutter/material.dart';
22
import 'package:flutter_html/flutter_html.dart';
3+
import 'package:flutter_html_all/flutter_html_all.dart';
34
import 'package:flutter_math_fork/flutter_math.dart';
45

56
void main() => runApp(new MyApp());
@@ -268,18 +269,14 @@ class _MyHomePageState extends State<MyHomePage> {
268269
),
269270
'h5': Style(maxLines: 2, textOverflow: TextOverflow.ellipsis),
270271
},
271-
tagsList: Html.tags..addAll(["tex", "bird", "flutter"]),
272+
tagsList: Html.tags..addAll(['tex', 'bird', 'flutter']),
272273
customRenders: {
273274
tagMatcher("tex"): CustomRender.widget(widget: (context, buildChildren) => Math.tex(
274275
context.tree.element?.innerHtml ?? '',
275276
mathStyle: MathStyle.display,
276277
textStyle: context.style.generateTextStyle(),
277278
onErrorFallback: (FlutterMathException e) {
278-
if (context.parser.onMathError != null) {
279-
return context.parser.onMathError!.call(context.tree.element?.innerHtml ?? '', e.message, e.messageWithType);
280-
} else {
281-
return Text(e.message);
282-
}
279+
return Text(e.message);
283280
},
284281
)),
285282
tagMatcher("bird"): CustomRender.inlineSpan(inlineSpan: (context, buildChildren) => TextSpan(text: "🐦")),
@@ -292,28 +289,34 @@ class _MyHomePageState extends State<MyHomePage> {
292289
)),
293290
tagMatcher("table"): CustomRender.widget(widget: (context, buildChildren) => SingleChildScrollView(
294291
scrollDirection: Axis.horizontal,
295-
child: (context.tree as TableLayoutElement).toWidget(context),
292+
child: tableRender.call().widget!.call(context, buildChildren),
296293
)),
297-
},
298-
customImageRenders: {
299-
networkSourceMatcher(domains: ["flutter.dev"]):
300-
(context, attributes, element) {
301-
return FlutterLogo(size: 36);
302-
},
303-
networkSourceMatcher(domains: ["mydomain.com"]):
304-
networkImageRender(
294+
audioMatcher(): audioRender(),
295+
iframeMatcher(): iframeRender(),
296+
mathMatcher(): mathRender(onMathError: (error, exception, exceptionWithType) {
297+
print(exception);
298+
return Text(exception);
299+
}),
300+
svgTagMatcher(): svgTagRender(),
301+
svgDataUriMatcher(): svgDataImageRender(),
302+
svgAssetUriMatcher(): svgAssetImageRender(),
303+
svgNetworkSourceMatcher(): svgNetworkImageRender(),
304+
networkSourceMatcher(domains: ["flutter.dev"]): CustomRender.widget(
305+
widget: (context, buildChildren) {
306+
return FlutterLogo(size: 36);
307+
}),
308+
networkSourceMatcher(domains: ["mydomain.com"]): networkImageRender(
305309
headers: {"Custom-Header": "some-value"},
306310
altWidget: (alt) => Text(alt ?? ""),
307311
loadingWidget: () => Text("Loading..."),
308312
),
309313
// On relative paths starting with /wiki, prefix with a base url
310-
(attr, _) =>
311-
attr["src"] != null && attr["src"]!.startsWith("/wiki"):
312-
networkImageRender(
313-
mapUrl: (url) => "https://upload.wikimedia.org" + url!),
314+
(context) => context.tree.element?.attributes["src"] != null
315+
&& context.tree.element!.attributes["src"]!.startsWith("/wiki"):
316+
networkImageRender(mapUrl: (url) => "https://upload.wikimedia.org" + url!),
314317
// Custom placeholder image for broken links
315-
networkSourceMatcher():
316-
networkImageRender(altWidget: (_) => FlutterLogo()),
318+
networkSourceMatcher(): networkImageRender(altWidget: (_) => FlutterLogo()),
319+
videoMatcher(): videoRender(),
317320
},
318321
onLinkTap: (url, _, __, ___) {
319322
print("Opening $url...");
@@ -336,3 +339,9 @@ class _MyHomePageState extends State<MyHomePage> {
336339
);
337340
}
338341
}
342+
343+
CustomRenderMatcher texMatcher() => (context) => context.tree.element?.localName == 'tex';
344+
345+
CustomRenderMatcher birdMatcher() => (context) => context.tree.element?.localName == 'bird';
346+
347+
CustomRenderMatcher flutterMatcher() => (context) => context.tree.element?.localName == 'flutter';

example/macos/.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Flutter-related
2+
**/Flutter/ephemeral/
3+
**/Pods/
4+
5+
# Xcode-related
6+
**/dgph
7+
**/xcuserdata/
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include? "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
2+
#include "ephemeral/Flutter-Generated.xcconfig"
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// Generated file. Do not edit.
3+
//
4+
5+
import FlutterMacOS
6+
import Foundation
7+
8+
import wakelock_macos
9+
10+
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
11+
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
12+
}

example/macos/Podfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
platform :osx, '10.11'
2+
3+
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4+
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5+
6+
project 'Runner', {
7+
'Debug' => :debug,
8+
'Profile' => :release,
9+
'Release' => :release,
10+
}
11+
12+
def flutter_root
13+
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14+
unless File.exist?(generated_xcode_build_settings_path)
15+
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16+
end
17+
18+
File.foreach(generated_xcode_build_settings_path) do |line|
19+
matches = line.match(/FLUTTER_ROOT\=(.*)/)
20+
return matches[1].strip if matches
21+
end
22+
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23+
end
24+
25+
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26+
27+
flutter_macos_podfile_setup
28+
29+
target 'Runner' do
30+
use_frameworks!
31+
use_modular_headers!
32+
33+
flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34+
end
35+
36+
post_install do |installer|
37+
installer.pods_project.targets.each do |target|
38+
flutter_additional_macos_build_settings(target)
39+
end
40+
end

example/macos/Podfile.lock

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
PODS:
2+
- FlutterMacOS (1.0.0)
3+
- wakelock_macos (0.0.1):
4+
- FlutterMacOS
5+
6+
DEPENDENCIES:
7+
- FlutterMacOS (from `Flutter/ephemeral`)
8+
- wakelock_macos (from `Flutter/ephemeral/.symlinks/plugins/wakelock_macos/macos`)
9+
10+
EXTERNAL SOURCES:
11+
FlutterMacOS:
12+
:path: Flutter/ephemeral
13+
wakelock_macos:
14+
:path: Flutter/ephemeral/.symlinks/plugins/wakelock_macos/macos
15+
16+
SPEC CHECKSUMS:
17+
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
18+
wakelock_macos: bc3f2a9bd8d2e6c89fee1e1822e7ddac3bd004a9
19+
20+
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
21+
22+
COCOAPODS: 1.11.2

0 commit comments

Comments
 (0)