Skip to content

Commit

Permalink
Use TextDirectio from context for layoutDirection when creating a sur…
Browse files Browse the repository at this point in the history
…face view
  • Loading branch information
FirentisTFW committed Dec 17, 2024
1 parent 53b35dc commit 7b246ad
Showing 1 changed file with 30 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,32 +167,36 @@ class AndroidVideoPlayer extends VideoPlayerPlatform {

// FIXME Check if this setup is complete

return IgnorePointer(
// IgnorePointer so that GestureDetector can be used above the platform view.
child: PlatformViewLink(
viewType: viewType,
surfaceFactory: (
BuildContext context,
PlatformViewController controller,
) {
return AndroidViewSurface(
controller: controller as AndroidViewController,
gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
);
},
onCreatePlatformView: (PlatformViewCreationParams params) {
return PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: viewType,
layoutDirection: TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: AndroidVideoPlayerApi.pigeonChannelCodec,
onFocus: () => params.onFocusChanged(true),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
return Builder(
builder: (BuildContext context) => IgnorePointer(
// IgnorePointer so that GestureDetector can be used above the platform view.
child: PlatformViewLink(
viewType: viewType,
surfaceFactory: (
BuildContext context,
PlatformViewController controller,
) {
return AndroidViewSurface(
controller: controller as AndroidViewController,
gestureRecognizers: const <Factory<
OneSequenceGestureRecognizer>>{},
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
);
},
onCreatePlatformView: (PlatformViewCreationParams params) {
return PlatformViewsService.initSurfaceAndroidView(
id: params.id,
viewType: viewType,
layoutDirection:
Directionality.maybeOf(context) ?? TextDirection.ltr,
creationParams: creationParams,
creationParamsCodec: AndroidVideoPlayerApi.pigeonChannelCodec,
onFocus: () => params.onFocusChanged(true),
)
..addOnPlatformViewCreatedListener(params.onPlatformViewCreated)
..create();
},
),
),
);
}
Expand Down

0 comments on commit 7b246ad

Please sign in to comment.