Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fluttertoast
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
songyanzhi
fluttertoast
Commits
00a03044
Unverified
Commit
00a03044
authored
Jul 12, 2023
by
Pavel Mazhnik
Committed by
GitHub
Jul 12, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(web): get css & js urls using flutter utility (#453)
parent
ab0537b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
2 deletions
+11
-2
lib/fluttertoast_web.dart
+11
-2
No files found.
lib/fluttertoast_web.dart
View file @
00a03044
import
'dart:async'
;
import
'dart:html'
as
html
;
import
'dart:ui'
as
ui
;
import
'package:flutter/services.dart'
;
import
'package:flutter_web_plugins/flutter_web_plugins.dart'
;
...
...
@@ -70,16 +71,24 @@ class FluttertoastWebPlugin {
final
List
<
Future
<
void
>>
loading
=
<
Future
<
void
>>[];
final
List
<
html
.
HtmlElement
>
tags
=
<
html
.
HtmlElement
>[];
// ignore: undefined_prefixed_name
final
cssUrl
=
ui
.
webOnlyAssetManager
.
getAssetUrl
(
'packages/fluttertoast/assets/toastify.css'
,
);
final
html
.
LinkElement
css
=
html
.
LinkElement
()
..
id
=
'toast-css'
..
attributes
=
{
"rel"
:
"stylesheet"
}
..
href
=
'assets/packages/fluttertoast/assets/toastify.css'
;
..
href
=
cssUrl
;
tags
.
add
(
css
);
// ignore: undefined_prefixed_name
final
jsUrl
=
ui
.
webOnlyAssetManager
.
getAssetUrl
(
'packages/fluttertoast/assets/toastify.js'
,
);
final
html
.
ScriptElement
script
=
html
.
ScriptElement
()
..
async
=
true
// ..defer = true
..
src
=
"assets/packages/fluttertoast/assets/toastify.js"
;
..
src
=
jsUrl
;
loading
.
add
(
script
.
onLoad
.
first
);
tags
.
add
(
script
);
html
.
querySelector
(
'head'
)!.
children
.
addAll
(
tags
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment