diff --git a/.gitignore b/.gitignore index fbb867d..992fa7d 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,5 @@ .packages build/ pubspec.lock +.flutter-plugins +.flutter-plugins-dependencies \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b2ea24e..9e53fcf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.3] - 2022-03-14 + +### Changed + +- `ModelViewer`'s default `backgroundColor` from `Colors.white` to `Colors.transparent`, due to [#12](https://github.com/omchiii/model_viewer_plus.dart/issues/12) +- `proxy`'s null check fix and `setState() {}` for it, due to [#10](https://github.com/omchiii/model_viewer_plus.dart/issues/10) + ## [1.1.2] - 2022-02-17 ### Added diff --git a/lib/src/html_builder.dart b/lib/src/html_builder.dart index 78c009f..0115db9 100644 --- a/lib/src/html_builder.dart +++ b/lib/src/html_builder.dart @@ -10,7 +10,7 @@ abstract class HTMLBuilder { static String build( {final String htmlTemplate = '', required final String src, - final Color backgroundColor = const Color(0xFFFFFF), + final Color backgroundColor = Colors.transparent, final String? alt, final bool? ar, final List? arModes, @@ -24,7 +24,7 @@ abstract class HTMLBuilder { html.write(' { @override Widget build(final BuildContext context) { if (_proxy == null) { + return Center( + child: CircularProgressIndicator( + semanticsLabel: 'Loading Model Viewer...', + ), + ); + } else { return WebView( + backgroundColor: Colors.transparent, initialUrl: null, javascriptMode: JavascriptMode.unrestricted, initialMediaPlaybackPolicy: AutoMediaPlaybackPolicy.always_allow, @@ -97,11 +104,6 @@ class ModelViewerState extends State { '>>>> ModelViewer failed to load: ${error.description} (${error.errorType} ${error.errorCode})'); // DEBUG }, ); - } else { - return Center( - child: CircularProgressIndicator( - semanticsLabel: 'Loading Model Viewer...', - )); } } @@ -125,6 +127,11 @@ class ModelViewerState extends State { Future _initProxy() async { final url = Uri.parse(widget.src); _proxy = await HttpServer.bind(InternetAddress.loopbackIPv4, 0); + + setState(() { + _proxy; + }); + _proxy!.listen((final HttpRequest request) async { //print("${request.method} ${request.uri}"); // DEBUG //print(request.headers); // DEBUG diff --git a/pubspec.yaml b/pubspec.yaml index c0700d5..3778a76 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ # See: https://dart.dev/tools/pub/pubspec name: model_viewer_plus -version: 1.1.2 +version: 1.1.3 description: >- A Flutter widget for rendering interactive 3D models in the glTF and GLB formats.