From af92c2612484bd467bf79b40dda080990bcaf0dc Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 11 Sep 2024 18:03:29 +0800 Subject: [PATCH] (flutter) add const FlutterWebOptions --- .../widgets/thermion_widget_web_impl.dart | 10 +++++----- .../lib/thermion_flutter_web_options.dart | 19 +++++++++++++++---- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/thermion_flutter/thermion_flutter/lib/thermion/widgets/thermion_widget_web_impl.dart b/thermion_flutter/thermion_flutter/lib/thermion/widgets/thermion_widget_web_impl.dart index e1302aba..41de0593 100644 --- a/thermion_flutter/thermion_flutter/lib/thermion/widgets/thermion_widget_web_impl.dart +++ b/thermion_flutter/thermion_flutter/lib/thermion/widgets/thermion_widget_web_impl.dart @@ -6,12 +6,12 @@ import 'package:web/web.dart'; import 'package:flutter/widgets.dart'; class ThermionWidgetWeb extends StatelessWidget { - - late final ThermionFlutterWebOptions options; + final ThermionFlutterWebOptions options; - const ThermionWidgetWeb({super.key, ThermionFlutterWebOptions? options}) { - this.options = options ?? ThermionFlutterWebOptions(); - } + const ThermionWidgetWeb( + {super.key, + this.options = + const ThermionFlutterWebOptions.empty()}); @override Widget build(BuildContext context) { diff --git a/thermion_flutter/thermion_flutter_web/lib/thermion_flutter_web_options.dart b/thermion_flutter/thermion_flutter_web/lib/thermion_flutter_web_options.dart index e453233d..ade9f7d0 100644 --- a/thermion_flutter/thermion_flutter_web/lib/thermion_flutter_web_options.dart +++ b/thermion_flutter/thermion_flutter_web/lib/thermion_flutter_web_options.dart @@ -1,8 +1,19 @@ import 'package:thermion_flutter_platform_interface/thermion_flutter_platform_interface.dart'; class ThermionFlutterWebOptions extends ThermionFlutterOptions { - bool createCanvas; - bool importCanvasAsWidget; - - ThermionFlutterWebOptions({this.importCanvasAsWidget = false, this.createCanvas = true, String? uberarchivePath}) : super(uberarchivePath:uberarchivePath); + + final bool createCanvas; + final bool importCanvasAsWidget; + + ThermionFlutterWebOptions( + {this.importCanvasAsWidget = false, + this.createCanvas = true, + String? uberarchivePath}) + : super(uberarchivePath: uberarchivePath); + + const ThermionFlutterWebOptions.empty( + {this.importCanvasAsWidget = false, + this.createCanvas = true, + String? uberarchivePath}) + : super.empty(); }