Skip to content

Commit

Permalink
onHtmlDataLoaded Callback Function Added
Browse files Browse the repository at this point in the history
  • Loading branch information
samarthsinghpundir committed Jan 8, 2025
1 parent 83c67e7 commit f39ecbc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/core/lib/src/core_html_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class HtmlWidget extends StatefulWidget {
/// The custom [WidgetFactory] builder.
final WidgetFactory Function()? factoryBuilder;

/// The Callback Function to be called when the html data is loaded
final void Function()? onHtmlDataLoaded;

/// The custom error builder.
final OnErrorBuilder? onErrorBuilder;

Expand Down Expand Up @@ -101,6 +104,7 @@ class HtmlWidget extends StatefulWidget {
this.customWidgetBuilder,
this.enableCaching,
this.factoryBuilder,
this.onHtmlDataLoaded,
super.key,
this.onErrorBuilder,
this.onLoadingBuilder,
Expand Down Expand Up @@ -190,6 +194,9 @@ class HtmlWidgetState extends State<HtmlWidget> {
return FutureBuilder<Widget>(
builder: (context, snapshot) {
if (snapshot.hasData) {
if(widget.onHtmlDataLoaded != null) {
widget.onHtmlDataLoaded!();
}
return snapshot.requireData;
} else if (snapshot.hasError) {
return _sliverToBoxAdapterIfNeeded(
Expand Down

0 comments on commit f39ecbc

Please sign in to comment.