feat: allow passing null options to ThermionWidget
This commit is contained in:
@@ -95,7 +95,7 @@ class _ThermionWidgetState extends State<ThermionWidget> {
|
|||||||
return ResizeObserver(
|
return ResizeObserver(
|
||||||
onResized: _resizeTexture,
|
onResized: _resizeTexture,
|
||||||
child: ThermionWidgetWeb(
|
child: ThermionWidgetWeb(
|
||||||
options: widget.options! as ThermionFlutterWebOptions));
|
options: widget.options as ThermionFlutterWebOptions?));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_texture?.usesBackingWindow == true) {
|
if (_texture?.usesBackingWindow == true) {
|
||||||
|
|||||||
@@ -6,13 +6,16 @@ import 'package:web/web.dart';
|
|||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
class ThermionWidgetWeb extends StatelessWidget {
|
class ThermionWidgetWeb extends StatelessWidget {
|
||||||
final ThermionFlutterWebOptions options;
|
|
||||||
|
late final ThermionFlutterWebOptions options;
|
||||||
|
|
||||||
const ThermionWidgetWeb({super.key, required this.options});
|
const ThermionWidgetWeb({super.key, ThermionFlutterWebOptions? options}) {
|
||||||
|
this.options = options ?? ThermionFlutterWebOptions();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (options.importCanvasAsWidget) {
|
if (options?.importCanvasAsWidget == true) {
|
||||||
return _ImageCopyingWidget();
|
return _ImageCopyingWidget();
|
||||||
}
|
}
|
||||||
return Container(color: const Color(0x00000000));
|
return Container(color: const Color(0x00000000));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import 'package:thermion_flutter_ffi/thermion_flutter_ffi.dart';
|
|||||||
import 'package:thermion_flutter_web/thermion_flutter_web_options.dart';
|
import 'package:thermion_flutter_web/thermion_flutter_web_options.dart';
|
||||||
|
|
||||||
class ThermionWidgetWeb extends StatefulWidget {
|
class ThermionWidgetWeb extends StatefulWidget {
|
||||||
final ThermionFlutterWebOptions options;
|
final ThermionFlutterWebOptions? options;
|
||||||
|
|
||||||
const ThermionWidgetWeb({super.key, required this.options});
|
const ThermionWidgetWeb({super.key, required this.options});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user