diff --git a/packages/share_plus/example/web/favicon.png b/packages/share_plus/example/web/favicon.png new file mode 100644 index 0000000000..8aaa46ac1a Binary files /dev/null and b/packages/share_plus/example/web/favicon.png differ diff --git a/packages/share_plus/example/web/icons/Icon-192.png b/packages/share_plus/example/web/icons/Icon-192.png new file mode 100644 index 0000000000..b749bfef07 Binary files /dev/null and b/packages/share_plus/example/web/icons/Icon-192.png differ diff --git a/packages/share_plus/example/web/icons/Icon-512.png b/packages/share_plus/example/web/icons/Icon-512.png new file mode 100644 index 0000000000..88cfd48dff Binary files /dev/null and b/packages/share_plus/example/web/icons/Icon-512.png differ diff --git a/packages/share_plus/example/web/index.html b/packages/share_plus/example/web/index.html new file mode 100644 index 0000000000..1460b5e9ba --- /dev/null +++ b/packages/share_plus/example/web/index.html @@ -0,0 +1,45 @@ + + + + + + + + + + + + + + + + + + + + example + + + + + + + + diff --git a/packages/share_plus/example/web/manifest.json b/packages/share_plus/example/web/manifest.json new file mode 100644 index 0000000000..8c012917da --- /dev/null +++ b/packages/share_plus/example/web/manifest.json @@ -0,0 +1,23 @@ +{ + "name": "example", + "short_name": "example", + "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/packages/share_plus/lib/share_plus.dart b/packages/share_plus/lib/share_plus.dart index f4ea048f61..2cfcffdbdf 100644 --- a/packages/share_plus/lib/share_plus.dart +++ b/packages/share_plus/lib/share_plus.dart @@ -29,8 +29,8 @@ class Share { // See https://github.com/flutter/flutter/issues/52267 for more details. static SharePlatform get _platform { if (__platform == null) { - if (!_disablePlatformOverride) { - if (!kIsWeb && Platform.isLinux) { + if (!_disablePlatformOverride && !kIsWeb) { + if (Platform.isLinux) { __platform = ShareLinux(); } else if (Platform.isWindows) { __platform = ShareWindows(); diff --git a/packages/share_plus/pubspec.yaml b/packages/share_plus/pubspec.yaml index d2debbdcc3..b491b54126 100644 --- a/packages/share_plus/pubspec.yaml +++ b/packages/share_plus/pubspec.yaml @@ -14,6 +14,8 @@ flutter: pluginClass: FLTSharePlugin linux: default_package: share_plus_linux + web: + default_package: share_plus_web windows: default_package: share_plus_windows @@ -25,6 +27,7 @@ dependencies: share_plus_platform_interface: ^1.1.0 share_plus_linux: ^1.1.0 share_plus_windows: ^0.1.0 + share_plus_web: ^0.1.0 dev_dependencies: test: ^1.3.0 diff --git a/packages/share_plus_web/lib/share_plus_web.dart b/packages/share_plus_web/lib/share_plus_web.dart index 92d767bb68..ffe4623e3e 100644 --- a/packages/share_plus_web/lib/share_plus_web.dart +++ b/packages/share_plus_web/lib/share_plus_web.dart @@ -10,7 +10,7 @@ import 'package:url_launcher/url_launcher.dart'; class SharePlugin extends SharePlatform { /// Registers this class as the default instance of [SharePlatform]. static void registerWith(Registrar registrar) { - SharePlatform.instance = SharePlatform(); + SharePlatform.instance = SharePlugin(); } final _navigator;