diff --git a/honey/CHANGELOG.md b/honey/CHANGELOG.md index 7005302..d7ea025 100644 --- a/honey/CHANGELOG.md +++ b/honey/CHANGELOG.md @@ -1,3 +1,9 @@ +## 0.2.1 + +### Enahncements + +- Flutter 3.10 support + ## 0.1.2 ### Enahncements diff --git a/honey/lib/src/expression/expr.dart b/honey/lib/src/expression/expr.dart index 1c6b547..510a5c9 100644 --- a/honey/lib/src/expression/expr.dart +++ b/honey/lib/src/expression/expr.dart @@ -12,7 +12,7 @@ abstract class Expr {} /// A honey expression that has been evaluated to either a value, list or /// widget. @immutable -abstract class EvaluatedExpr implements Expr { +abstract mixin class EvaluatedExpr implements Expr { /// Should this expression be re-evaluated if something goes wrong? bool get retry; diff --git a/honey/lib/src/honey_widgets_binding.dart b/honey/lib/src/honey_widgets_binding.dart index dac44e6..2a19f67 100644 --- a/honey/lib/src/honey_widgets_binding.dart +++ b/honey/lib/src/honey_widgets_binding.dart @@ -68,7 +68,7 @@ class HoneyWidgetsBinding extends BindingBase Map customFunctions = const {}, }) { if (_instance == null) { - final instance = HoneyWidgetsBinding(); + _instance = HoneyWidgetsBinding(); instance.pipelineOwner.ensureSemantics(); switch (mode) { @@ -85,9 +85,21 @@ class HoneyWidgetsBinding extends BindingBase @override void scheduleAttachRootWidget(Widget rootWidget) { - _rootWidget = rootWidget; + /// In old flutter versions, when we passed MyApp to a 'runApp' method, it + /// was being passed here. Then when we called runApp again in [reset] + /// method, it was being passed here again constantly. + /// Now after flutter upgrade to 3.10 after calling runApp in [reset] + /// method, the rootWidget is being passed wrapped with View widget + /// so we need to unwrap it here. + /// Otherwise it causes an error with accessing the inactive element. + if (_rootWidget?.key != rootWidget.key) { + _rootWidget = rootWidget; + } else if (_rootWidget != rootWidget) { + final view = rootWidget as View; + _rootWidget = view.child; + } - Widget widget = KeyedSubtree(key: _key, child: rootWidget); + Widget widget = KeyedSubtree(key: _key, child: _rootWidget!); if (!_testing) { widget = HoneyOverlay(child: widget); } diff --git a/honey/pubspec.yaml b/honey/pubspec.yaml index 68b9293..e7c3a86 100644 --- a/honey/pubspec.yaml +++ b/honey/pubspec.yaml @@ -1,11 +1,11 @@ name: honey description: The sweet side of testing. An end to end testing framework for Flutter. -version: 0.1.2 +version: 0.2.1 homepage: https://honey.dev repository: https://github.com/clickup/honey environment: - sdk: ">=2.18.0 <3.0.0" + sdk: ">=3.0.0 <4.0.0" flutter: ">=3.0.0" dependencies: