add android integration & make iOS API consistent
add pubspec android plugin update android CMakeLists add filament android libs for linking
This commit is contained in:
@@ -17,32 +17,14 @@ class FilamentView extends FilamentViewPlatform {
|
||||
) {
|
||||
switch (defaultTargetPlatform) {
|
||||
case TargetPlatform.android:
|
||||
return PlatformViewLink(
|
||||
viewType: FILAMENT_VIEW_ID,
|
||||
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: FILAMENT_VIEW_ID,
|
||||
layoutDirection: TextDirection.ltr,
|
||||
creationParams: {},
|
||||
creationParamsCodec: StandardMessageCodec(),
|
||||
)
|
||||
..addOnPlatformViewCreatedListener((int id) {
|
||||
onFilamentViewCreated(id);
|
||||
params.onPlatformViewCreated(id);
|
||||
})
|
||||
..create();
|
||||
},
|
||||
);
|
||||
return AndroidView(
|
||||
viewType: FILAMENT_VIEW_ID,
|
||||
gestureRecognizers: <Factory<OneSequenceGestureRecognizer>>{},
|
||||
hitTestBehavior: PlatformViewHitTestBehavior.opaque,
|
||||
onPlatformViewCreated: (id) {
|
||||
print("onplatformview created $id");
|
||||
onFilamentViewCreated(id);
|
||||
});
|
||||
case TargetPlatform.iOS:
|
||||
return UiKitView(
|
||||
viewType: FILAMENT_VIEW_ID,
|
||||
@@ -51,8 +33,7 @@ class FilamentView extends FilamentViewPlatform {
|
||||
},
|
||||
);
|
||||
case TargetPlatform.windows:
|
||||
return Text(
|
||||
"Flutter doesn't support platform view on Windows yet.");
|
||||
return Text("Flutter doesn't support platform view on Windows yet.");
|
||||
default:
|
||||
return Text(
|
||||
'$defaultTargetPlatform is not yet implemented by Filament plugin.');
|
||||
|
||||
@@ -2,13 +2,13 @@ import 'package:flutter/widgets.dart';
|
||||
import 'package:polyvox_filament/view/filament_view.dart';
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
typedef void FilamentViewCreatedCallback(int id);
|
||||
typedef FilamentViewCreatedCallback = void Function(int id);
|
||||
|
||||
abstract class FilamentViewPlatform extends PlatformInterface {
|
||||
FilamentViewPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
static FilamentViewPlatform _instance = FilamentView();
|
||||
static final FilamentViewPlatform _instance = FilamentView();
|
||||
|
||||
static FilamentViewPlatform get instance => _instance;
|
||||
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:polyvox_filament/view/filament_view.dart';
|
||||
|
||||
import '../filament_controller.dart';
|
||||
import 'filament_view_platform.dart';
|
||||
|
||||
Reference in New Issue
Block a user