From 8b083d4ba1e70bd467b94bda69903dbde563bd99 Mon Sep 17 00:00:00 2001 From: erlage Date: Fri, 5 Aug 2022 12:07:09 +0530 Subject: [PATCH] Patch HTML widgets generator --- tool/pkg-gen-html-widgets/assets/pubspec.yaml | 2 +- tool/pkg-gen-html-widgets/gen.py | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/tool/pkg-gen-html-widgets/assets/pubspec.yaml b/tool/pkg-gen-html-widgets/assets/pubspec.yaml index df1d78b0..d9bbf18c 100644 --- a/tool/pkg-gen-html-widgets/assets/pubspec.yaml +++ b/tool/pkg-gen-html-widgets/assets/pubspec.yaml @@ -15,7 +15,7 @@ platforms: dependencies: meta: ^1.8.0 - rad: '>=1.0.1 <2.0.0' + rad: '>=1.2.0 <2.0.0' dev_dependencies: build: ^2.3.0 diff --git a/tool/pkg-gen-html-widgets/gen.py b/tool/pkg-gen-html-widgets/gen.py index d8752ccf..88d09818 100644 --- a/tool/pkg-gen-html-widgets/gen.py +++ b/tool/pkg-gen-html-widgets/gen.py @@ -417,6 +417,17 @@ def apply_commons(file_name, contents): ''' + # ======================================================================= + # patch (1) | Can be removed when NullableElementCallback is available. + + if 'NullableElementCallback?' in contents: + contents = contents.replace('NullableElementCallback?', 'void Function(Element? element)?') + + if "import 'dart:html';" not in contents: + contents = contents.replace("import 'package:rad/rad.dart';", "import 'dart:html';import 'package:rad/rad.dart';") + + # ======================================================================= + return contents # =======================================================================