Skip to content

Commit c39a7f1

Browse files
committed
Merge branch 'master' of https://github.com/Sub6Resources/flutter_html into feature/modularization
� Conflicts: � lib/flutter_html.dart � lib/html_parser.dart � lib/src/replaced_element.dart � lib/src/utils.dart
2 parents f1decee + db41f46 commit c39a7f1

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ A Flutter widget for rendering HTML and CSS as Flutter widgets.
3939

4040
- [Parameters Table](#parameters)
4141

42+
- [Methods](#methods)
43+
4244
- [Getters](#getters)
4345

4446
- [Data](#data)
@@ -174,12 +176,26 @@ Once the above issue is resolved, the aforementioned compromises will go away. C
174176
| `style` | A powerful API that allows you to customize the style that should be used when rendering a specific HTMl tag. |
175177
| `selectionControls` | A custom text selection controls that allow you to override default toolbar and build toolbar with custom text selection options. See an [example](https://github.com/justinmc/flutter-text-selection-menu-examples/blob/master/lib/custom_menu_page.dart). |
176178

179+
### Methods:
180+
181+
| Methods | Description |
182+
|--------------|-----------------|
183+
| `disposeAll()` | Disposes all `ChewieController`s, `ChewieAudioController`s, and `VideoPlayerController`s being used by every `Html` widget. (Note: `Html` widgets automatically dispose their controllers, this method is only provided in case you need other behavior) |
184+
177185
### Getters:
178186

179187
1. `Html.tags`. This provides a list of all the tags the package renders. The main use case is to assist in excluding elements using `tagsList`. See an [example](#example-usage---tagslist---excluding-tags) below.
180188

181189
2. `SelectableHtml.tags`. This provides a list of all the tags that can be rendered in selectable mode.
182190

191+
3. `Html.chewieAudioControllers`. This provides a list of all `ChewieAudioController`s being used by `Html` widgets.
192+
193+
4. `Html.chewieControllers`. This provides a list of all `ChewieController`s being used by `Html` widgets.
194+
195+
5. `Html.videoPlayerControllers`. This provides a list of all `VideoPlayerController`s being used for video widgets by `Html` widgets.
196+
197+
6. `Html.audioPlayerControllers`. This provides a list of all `VideoPlayerController`s being used for audio widgets by `Html` widgets.
198+
183199
### Data:
184200

185201
The HTML data passed to the `Html` widget as a `String`. This is required and cannot be null when using `Html`.

lib/src/styled_element.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import 'package:flutter_html/src/css_parser.dart';
33
import 'package:flutter_html/style.dart';
44
import 'package:html/dom.dart' as dom;
55
//TODO(Sub6Resources): don't use the internal code of the html package as it may change unexpectedly.
6+
//ignore: implementation_imports
67
import 'package:html/src/query_selector.dart';
78

89
/// A [StyledElement] applies a style to all of its children.
@@ -12,7 +13,7 @@ class StyledElement {
1213
final List<String> elementClasses;
1314
List<StyledElement> children;
1415
Style style;
15-
final dom.Node? _node;
16+
final dom.Element? _node;
1617

1718
StyledElement({
1819
this.name = "[[No name]]",
@@ -24,15 +25,15 @@ class StyledElement {
2425
}) : this._node = node;
2526

2627
bool matchesSelector(String selector) =>
27-
(_node != null && matches(_node as dom.Element, selector)) || name == selector;
28+
(_node != null && matches(_node!, selector)) || name == selector;
2829

2930
Map<String, String> get attributes =>
3031
_node?.attributes.map((key, value) {
3132
return MapEntry(key.toString(), value);
3233
}) ??
3334
Map<String, String>();
3435

35-
dom.Element? get element => _node as dom.Element?;
36+
dom.Element? get element => _node;
3637

3738
@override
3839
String toString() {

0 commit comments

Comments
 (0)