From b2a78e6d8c6bc59900caaa321573e3a5f3c8cb85 Mon Sep 17 00:00:00 2001 From: ishaqhassan Date: Fri, 19 Jul 2024 14:20:55 +0500 Subject: [PATCH] Added web 1.0.0 support with some code fixes --- .idea/caches/deviceStreaming.xml | 263 +++++++++++++++++++++++++++++++ .idea/libraries/Dart_SDK.xml | 40 ++--- .idea/misc.xml | 1 - example/pubspec.lock | 24 ++- example/web/index.html | 26 +-- lib/fluttertoast_web.dart | 4 +- pubspec.lock | 46 +++++- pubspec.yaml | 3 +- 8 files changed, 355 insertions(+), 52 deletions(-) create mode 100644 .idea/caches/deviceStreaming.xml diff --git a/.idea/caches/deviceStreaming.xml b/.idea/caches/deviceStreaming.xml new file mode 100644 index 00000000..0d94a80a --- /dev/null +++ b/.idea/caches/deviceStreaming.xml @@ -0,0 +1,263 @@ + + + + + + \ No newline at end of file diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml index 6ae284fc..cb77cc1c 100644 --- a/.idea/libraries/Dart_SDK.xml +++ b/.idea/libraries/Dart_SDK.xml @@ -1,25 +1,27 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/.idea/misc.xml b/.idea/misc.xml index c333ca1e..d002923b 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,4 +1,3 @@ - diff --git a/example/pubspec.lock b/example/pubspec.lock index 30402e3e..1486b788 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" cupertino_icons: dependency: "direct main" description: @@ -78,7 +86,15 @@ packages: path: ".." relative: true source: path - version: "8.2.5" + version: "8.2.6" + html: + dependency: transitive + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" leak_tracker: dependency: transitive description: @@ -208,10 +224,10 @@ packages: dependency: transitive description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.0.0" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/example/web/index.html b/example/web/index.html index 41b3bc33..9443fb7f 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -23,36 +23,16 @@ - + - example + test_web_1 - - - - - + diff --git a/lib/fluttertoast_web.dart b/lib/fluttertoast_web.dart index 9ebaeb2b..fd011699 100644 --- a/lib/fluttertoast_web.dart +++ b/lib/fluttertoast_web.dart @@ -1,4 +1,6 @@ import 'dart:async'; +import 'dart:js_interop'; +import 'package:html/parser.dart'; import 'package:web/web.dart' as web; import 'dart:ui_web' as ui; import 'package:flutter/services.dart'; @@ -124,7 +126,7 @@ class FluttertoastWebPlugin { } final web.HTMLScriptElement scriptText = web.HTMLScriptElement() ..id = "toast-content" - ..innerHTML = content; + ..innerHTML = content.toJS; web.document.body!.append(scriptText); if (textColor != null) { web.Element toast = web.document.querySelector('.toastify')!; diff --git a/pubspec.lock b/pubspec.lock index 1d0b24cb..7886e028 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -17,6 +17,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + csslib: + dependency: transitive + description: + name: csslib + sha256: "706b5707578e0c1b4b7550f64078f0a0f19dec3f50a178ffae7006b0a9ca58fb" + url: "https://pub.dev" + source: hosted + version: "1.0.0" flutter: dependency: "direct main" description: flutter @@ -27,6 +35,14 @@ packages: description: flutter source: sdk version: "0.0.0" + html: + dependency: "direct main" + description: + name: html + sha256: "3a7812d5bcd2894edf53dfaf8cd640876cf6cef50a8f238745c8b8120ea74d3a" + url: "https://pub.dev" + source: hosted + version: "0.15.4" material_color_utilities: dependency: transitive description: @@ -43,11 +59,35 @@ packages: url: "https://pub.dev" source: hosted version: "1.12.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" sky_engine: dependency: transitive description: flutter source: sdk version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" vector_math: dependency: transitive description: @@ -60,10 +100,10 @@ packages: dependency: "direct main" description: name: web - sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" + sha256: d43c1d6b787bf0afad444700ae7f4db8827f701bc61c255ac8d328c6f4d52062 url: "https://pub.dev" source: hosted - version: "0.5.1" + version: "1.0.0" sdks: - dart: ">=3.3.0 <4.0.0" + dart: ">=3.4.0 <4.0.0" flutter: ">=1.10.0" diff --git a/pubspec.yaml b/pubspec.yaml index f7eae51e..81333409 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -13,7 +13,8 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - web: ^0.5.1 + web: ^1.0.0 + html: ^0.15.4 flutter: plugin: