Skip to content

Commit

Permalink
Support to Flutter web WASM
Browse files Browse the repository at this point in the history
  • Loading branch information
jayeshpansheriya committed May 19, 2024
1 parent 5a360ea commit 621b56a
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 5 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## [2.0.16] - 2024-05-19
* Support to Flutter web WASM

## [2.0.15] - 2024-05-19
* Update with flutter 3.22.0

Expand Down
10 changes: 9 additions & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.14"
version: "2.0.15"
boolean_selector:
dependency: transitive
description:
Expand Down Expand Up @@ -204,6 +204,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.1"
web:
dependency: transitive
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
1 change: 1 addition & 0 deletions lib/awesome_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,4 @@ part 'widget_extensions/padding_extension.dart';
part 'widget_extensions/positioned_extension.dart';
part 'widget_extensions/shimmer_extension.dart';
part 'widget_extensions/tooltip_extension.dart';
part 'widget_extensions/sliver_extension.dart';
5 changes: 2 additions & 3 deletions lib/src/platform/platform_web.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
// ignore: avoid_web_libraries_in_flutter
import 'dart:html' as html;
import 'package:web/web.dart' as html;

html.Navigator _navigator = html.window.navigator;

Expand All @@ -15,7 +14,7 @@ class GeneralPlatform {
static bool get isIOS {
// maxTouchPoints is needed to separate iPad iOS13 vs new MacOS
return hasMatch(_navigator.platform, r'/iPad|iPhone|iPod/') ||
(_navigator.platform == 'MacIntel' && _navigator.maxTouchPoints! > 1);
(_navigator.platform == 'MacIntel' && _navigator.maxTouchPoints > 1);
}

static bool get isLinux =>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter/widgets.dart';
part of '../awesome_extensions.dart';

extension WidgetSliver on Widget {
Widget get sliver {
Expand Down
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "14.2.1"
web:
dependency: "direct main"
description:
name: web
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
url: "https://pub.dev"
source: hosted
version: "0.5.1"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ dependencies:
sdk: flutter
flutter_web_plugins:
sdk: flutter
web: ^0.5.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 621b56a

Please sign in to comment.