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
73322a24
Unverified
Commit
73322a24
authored
Aug 03, 2019
by
Karthik Ponnam
Committed by
GitHub
Aug 03, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #107 from AngryLi/master
fix the toast show in key window problem
parents
5bf033a5
1521fba4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
15 deletions
+20
-15
ios/Classes/FluttertoastPlugin.m
+20
-15
No files found.
ios/Classes/FluttertoastPlugin.m
View file @
73322a24
...
...
@@ -72,23 +72,17 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
}
if
([
gravity
isEqualToString
:
@"top"
])
{
[[[
UIApplication
sharedApplication
].
windows
lastObject
]
makeToast
:
msg
duration
:
time
position
:
CSToastPositionTop
style
:
style
];
[[
self
_readKeyWindow
]
makeToast
:
msg
duration
:
time
position
:
CSToastPositionTop
style
:
style
];
}
else
if
([
gravity
isEqualToString
:
@"center"
])
{
[[[
UIApplication
sharedApplication
].
windows
lastObject
]
makeToast
:
msg
duration
:
time
position
:
CSToastPositionCenter
style
:
style
];
[[
self
_readKeyWindow
]
makeToast
:
msg
duration
:
time
position
:
CSToastPositionCenter
style
:
style
];
}
else
{
[[[
UIApplication
sharedApplication
].
windows
lastObject
]
makeToast
:
msg
duration
:
time
position
:
CSToastPositionBottom
style
:
style
];
[[
self
_readKeyWindow
]
makeToast
:
msg
duration
:
time
position
:
CSToastPositionBottom
style
:
style
];
}
result
([
NSNumber
numberWithBool
:
true
]);
...
...
@@ -97,4 +91,15 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
}
}
#pragma mark - read the key window
-
(
UIWindow
*
)
_readKeyWindow
{
for
(
UIWindow
*
window
in
UIApplication
.
sharedApplication
.
windows
)
{
if
([
window
isKindOfClass
:
UIWindow
.
class
]
&&
window
.
isKeyWindow
&&
window
.
windowLevel
==
UIWindowLevelNormal
)
{
return
window
;
}
}
return
nil
;
}
@end
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