Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flutter 3.10 support ! #33

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion honey/lib/src/expression/expr.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
16 changes: 13 additions & 3 deletions honey/lib/src/honey_widgets_binding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class HoneyWidgetsBinding extends BindingBase
Map<String, HoneyFunction> customFunctions = const {},
}) {
if (_instance == null) {
final instance = HoneyWidgetsBinding();
_instance = HoneyWidgetsBinding();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it never been initialised before , should I move it back to final instance tho?

instance.pipelineOwner.ensureSemantics();

switch (mode) {
Expand All @@ -85,9 +85,19 @@ 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 = rootWidget.child;
}

Widget widget = KeyedSubtree(key: _key, child: rootWidget);
Widget widget = KeyedSubtree(key: _key, child: _rootWidget!);
if (!_testing) {
widget = HoneyOverlay(child: widget);
}
Expand Down
2 changes: 1 addition & 1 deletion honey/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ 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:
Expand Down