diff --git a/README.md b/README.md index 78ceea4..46ee23e 100644 --- a/README.md +++ b/README.md @@ -119,18 +119,17 @@ Remember that the application lifecycle events won't have any special context se ```html - - [...] - - - - - + + + example + + + + + ``` diff --git a/example/lib/main.dart b/example/lib/main.dart index 9d64da1..1cb9b84 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -101,17 +101,6 @@ class MyApp extends StatelessWidget { ), ), Spacer(), - Platform.isIOS - ? Center( - child: TextButton( - child: Text('Debug mode'), - onPressed: () { - Posthog().debug(true); - }, - ), - ) - : Container(), - Spacer(), ], ), ), diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 01fa9e8..db35624 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -5,7 +5,7 @@ publish_to: "none" version: 0.0.1+1 environment: - sdk: ">=2.1.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: @@ -15,7 +15,7 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^0.1.2 + cupertino_icons: ^1.0.3 dev_dependencies: flutter_test: diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart index 04362ec..6283f1c 100644 --- a/example/test/widget_test.dart +++ b/example/test/widget_test.dart @@ -19,7 +19,7 @@ void main() { expect( find.byWidgetPredicate( (Widget widget) => - widget is Text && widget.data.startsWith('Running on:'), + widget is Text && widget.data!.startsWith('Running on:'), ), findsOneWidget, ); diff --git a/example/web/favicon.png b/example/web/favicon.png new file mode 100644 index 0000000..8aaa46a Binary files /dev/null and b/example/web/favicon.png differ diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png new file mode 100644 index 0000000..b749bfe Binary files /dev/null and b/example/web/icons/Icon-192.png differ diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png new file mode 100644 index 0000000..88cfd48 Binary files /dev/null and b/example/web/icons/Icon-512.png differ diff --git a/example/web/index.html b/example/web/index.html index dc6c217..24b5696 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -1,22 +1,14 @@ - example - - - + + - \ No newline at end of file diff --git a/example/web/manifest.json b/example/web/manifest.json new file mode 100644 index 0000000..a688126 --- /dev/null +++ b/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "myapp", + "short_name": "myapp", + "start_url": ".", + "display": "standalone", + "background_color": "#0175C2", + "theme_color": "#0175C2", + "description": "A new Flutter project.", + "orientation": "portrait-primary", + "prefer_related_applications": false, + "icons": [ + { + "src": "icons/Icon-192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "icons/Icon-512.png", + "sizes": "512x512", + "type": "image/png" + } + ] +} diff --git a/lib/src/posthog_web.dart b/lib/src/posthog_web.dart index 91044f4..05b2ef7 100644 --- a/lib/src/posthog_web.dart +++ b/lib/src/posthog_web.dart @@ -3,11 +3,13 @@ import 'dart:js'; import 'package:flutter/services.dart'; import 'package:flutter_web_plugins/flutter_web_plugins.dart' show Registrar; + class PosthogWeb { static void registerWith(Registrar registrar) { final MethodChannel channel = MethodChannel( - 'posthog_flutter', + 'posthogflutter', const StandardMethodCodec(), + registrar.messenger, ); final PosthogWeb instance = PosthogWeb(); channel.setMethodCallHandler(instance.handleMethodCall); @@ -29,7 +31,7 @@ class PosthogWeb { ]); break; case 'screen': - analytics.callMethod('page', [ + analytics.callMethod('capture', [ call.arguments['screenName'], JsObject.jsify(call.arguments['properties']), ]);