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
63449b28
Commit
63449b28
authored
Jan 18, 2019
by
Zac Chan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using Result instead of callback
parent
9e385713
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
19 deletions
+16
-19
ios/Classes/FluttertoastPlugin.m
+4
-7
lib/fluttertoast.dart
+12
-12
No files found.
ios/Classes/FluttertoastPlugin.m
View file @
63449b28
...
...
@@ -55,7 +55,6 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
if
(
time
>
10
)
time
=
10
;
else
if
(
time
<
1
)
time
=
1
;
NSLog
(
@"The code runs through here!"
);
CSToastStyle
*
style
=
[[
CSToastStyle
alloc
]
initWithDefaultStyle
];
...
...
@@ -73,11 +72,10 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
position
:
CSToastPositionCenter
style
:
style
completion
:^
(
BOOL
didTap
){
NSNumber
*
boolNumber
=
[
NSNumber
numberWithBool
:
didTap
];
NSLog
(
@"The code runs through here! 2"
);
[
self
.
channel
invokeMethod
:
@"onTap"
arguments
:@{
@"didTap"
:
boolNumber
}];
NSNumber
*
boolNumber
=
[
NSNumber
numberWithBool
:
didTap
];
result
(
boolNumber
)
}];
...
...
@@ -88,7 +86,6 @@ static NSString *const CHANNEL_NAME = @"PonnamKarthik/fluttertoast";
style
:
style
];
}
result
(
@"done"
);
}
else
{
result
(
FlutterMethodNotImplemented
);
}
...
...
lib/fluttertoast.dart
View file @
63449b28
...
...
@@ -29,18 +29,18 @@ class Fluttertoast {
}
Function
(
bool
)
didTap
;
//
Function(bool) didTap;
Future
<
String
>
showToast
({
Future
<
bool
>
showToast
({
@required
String
msg
,
Toast
toastLength
,
int
timeInSecForIos
=
1
,
ToastGravity
gravity
,
Color
backgroundColor
,
Color
textColor
,
Function
(
bool
)
didTap
,
//
Function(bool) didTap,
})
async
{
this
.
didTap
=
didTap
;
//
this.didTap = didTap;
String
toast
=
"short"
;
if
(
toastLength
==
Toast
.
LENGTH_LONG
)
{
toast
=
"long"
;
...
...
@@ -70,17 +70,17 @@ class Fluttertoast {
'textcolor'
:
textColor
!=
null
?
textColor
.
value
:
null
,
};
String
res
=
await
_channel
.
invokeMethod
(
'showToast'
,
params
);
bool
res
=
await
_channel
.
invokeMethod
(
'showToast'
,
params
);
return
res
;
}
Future
<
dynamic
>
_handleMethod
(
MethodCall
call
)
async
{
switch
(
call
.
method
)
{
case
"onTap"
:
//
Future<dynamic> _handleMethod(MethodCall call) async {
//
switch(call.method) {
//
case "onTap":
didTap
(
true
);
//
didTap(true);
return
new
Future
.
value
(
""
);
}
}
//
return new Future.value("");
//
}
//
}
}
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