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