File tree Expand file tree Collapse file tree 2 files changed +28
-6
lines changed
example/android/app/src/main/java
com/idlefish/flutterboost/example
io/flutter/embedding/android Expand file tree Collapse file tree 2 files changed +28
-6
lines changed Original file line number Diff line number Diff line change 11package com .idlefish .flutterboost .example ;
22
3- import io .flutter .plugin .common .PluginRegistry ;
3+ import androidx .annotation .NonNull ;
4+ import io .flutter .embedding .engine .plugins .FlutterPlugin ;
45import io .flutter .plugin .common .StandardMessageCodec ;
56
6- public class TextPlatformViewPlugin {
7- public static void register (PluginRegistry .Registrar registrar ) {
8- registrar .platformViewRegistry ().registerViewFactory ("plugins.test/view" ,
7+ public class TextPlatformViewPlugin implements FlutterPlugin {
8+ @ Override
9+ public void onAttachedToEngine (@ NonNull FlutterPluginBinding binding ) {
10+ binding .getPlatformViewRegistry ().registerViewFactory ("plugins.test/view" ,
911 new TextPlatformViewFactory (StandardMessageCodec .INSTANCE ));
1012 }
13+
14+ @ Override
15+ public void onDetachedFromEngine (@ NonNull FlutterPluginBinding binding ) {
16+ // No cleanup needed
17+ }
1118}
Original file line number Diff line number Diff line change 1616
1717import io .flutter .embedding .engine .FlutterEngine ;
1818import io .flutter .embedding .engine .FlutterShellArgs ;
19+ import io .flutter .embedding .engine .loader .FlutterLoader ;
1920import io .flutter .plugin .platform .PlatformPlugin ;
20- import io .flutter .view .FlutterMain ;
2121import java .util .List ;
2222
2323public class LifecycleView extends FrameLayout implements LifecycleOwner , FlutterActivityAndFragmentDelegate .Host {
24+
25+ @ NonNull
26+ @ Override
27+ public OnBackInvokedDispatcher getBackCallbackState () {
28+ // Return the activity's back callback state
29+ if (android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .TIRAMISU ) {
30+ return mActivty .getOnBackInvokedDispatcher ();
31+ }
32+ return null ;
33+ }
2434 protected static final String ARG_DART_ENTRYPOINT = "dart_entrypoint" ;
2535 protected static final String ARG_INITIAL_ROUTE = "initial_route" ;
2636 protected static final String ARG_APP_BUNDLE_PATH = "app_bundle_path" ;
@@ -150,7 +160,12 @@ public String getDartEntrypointFunctionName() {
150160
151161 @ NonNull
152162 public String getAppBundlePath () {
153- return getArguments ().getString (ARG_APP_BUNDLE_PATH , FlutterMain .findAppBundlePath ());
163+ String bundlePath = getArguments ().getString (ARG_APP_BUNDLE_PATH , null );
164+ if (bundlePath == null ) {
165+ FlutterLoader loader = FlutterLoader .getInstance ();
166+ bundlePath = loader .findAppBundlePath ();
167+ }
168+ return bundlePath ;
154169 }
155170
156171 @ Nullable
You can’t perform that action at this time.
0 commit comments