Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gmalpha_flutter
Project
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile
gmalpha_flutter
Commits
7b53a2b4
Commit
7b53a2b4
authored
Feb 23, 2019
by
艾娇平
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加获取Native 的user_id
parent
2ded43cd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
29 deletions
+28
-29
hybrid_stack_manager.dart
lib/hybrid_stack/hybrid_stack_manager.dart
+8
-9
opinion.dart
lib/opinion.dart
+20
-20
No files found.
lib/hybrid_stack/hybrid_stack_manager.dart
View file @
7b53a2b4
...
...
@@ -42,22 +42,21 @@ class HybridStackManagerPlugin {
}
// method 0: GET 1:POST
// Native 网络请求
Future
<
Map
>
callNativeNetWorking
({
String
url
,
HttpMethod
method
,
Map
parameters
})
async
{
dynamic
info
=
await
_channel
.
invokeMethod
(
'callNativeNetWorking'
,
{
"url"
:
url
??
""
,
"method"
:
1
??
0
,
"parameters"
:
(
parameters
??
{}),
});
// Uint8List response = info;
// Map streetsList = new Map.from(info);
return
new
Future
.
sync
(()
=>
info
as
Map
);
// print('callNativeNetWorking-----${streetsList}');
// return new Future.sync(() => streetsList as Map);
}
// print('callNativeNetWorking-----${info.toString()}');
//
// return new Future.sync(() => jsonDecode(info.toString()) as Map);
// Native 网络加载视图
callNativeLoading
({
bool
show
=
true
,
String
message
=
''
})
{
_channel
.
invokeMethod
(
"callNativeLoading"
,
{
'show'
:
show
,
'message'
:
message
});
}
}
lib/opinion.dart
View file @
7b53a2b4
...
...
@@ -17,7 +17,6 @@ class Opinion extends StatelessWidget {
Opinion
(
RouterOption
option
,
{
Key
key
})
:
super
(
key:
key
)
{
routeOption
=
option
;
}
String
title
;
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
...
...
@@ -26,16 +25,18 @@ class Opinion extends StatelessWidget {
theme:
ThemeData
(
splashColor:
Colors
.
white10
,
//水波纹的颜色
),
home:
OpinionPage
(
title:
'意见和建议'
),
home:
OpinionPage
(
title:
'意见和建议'
,
userId:
routeOption
.
params
[
'user_id'
].
toString
(),
),
);
}
}
class
OpinionPage
extends
StatefulWidget
{
OpinionPage
({
Key
key
,
this
.
title
,
this
.
userId
})
:
super
(
key:
key
);
OpinionPage
({
Key
key
,
this
.
title
,
this
.
userId
,
this
.
content
,
this
.
tel
})
:
super
(
key:
key
);
final
String
title
;
final
String
userId
;
final
String
content
;
final
String
tel
;
@override
_OpinionPageState
createState
()
=>
_OpinionPageState
();
}
...
...
@@ -143,24 +144,23 @@ class _OpinionPageState extends State<OpinionPage> {
),
));
}
}
void
confirmClick
()
{
void
confirmClick
(
)
{
// 提交信息 && 回到上一级页面
// MethodHandler hdler = MethodHandler(MethodCall('hj',{'d':'d'}));
// HybridStackManagerPlugin.hybridStackManagerPlugin.setMethodCallHandler(hdler);
// HybridStackManagerPlugin.hybridStackManagerPlugin.openUrlFromNative(url: '');
confimSuggestInfo
();
print
(
'confirmClick'
);
}
confimSuggestInfo
();
print
(
'confirmClick'
);
}
void
confimSuggestInfo
(
)
{
void
confimSuggestInfo
()
{
HybridStackManagerPlugin
.
hybridStackManagerPlugin
.
callNativeLoading
();
Map
<
String
,
String
>
parameters
=
{
'phone'
:
'dsdsdsd'
,
'content'
:
'我是一个建议Flutter提交的'
,
'user_id'
:
widget
.
userId
};
HybridStackManagerPlugin
.
hybridStackManagerPlugin
.
callNativeNetWorking
(
url:
ALServers
.
API_ACCOUNT_SUGGESTION
,
method:
HttpMethod
.
HTTPMethodPOTS
,
parameters:
parameters
).
then
((
val
){
HybridStackManagerPlugin
.
hybridStackManagerPlugin
.
callNativeLoading
(
message:
'提交成功'
);
});
}
Map
<
String
,
String
>
parameters
=
{
'phone'
:
'dsdsdsd'
,
'content'
:
'我是一个建议Flutter提交的'
,
'user_id'
:
'123456'
};
HybridStackManagerPlugin
.
hybridStackManagerPlugin
.
callNativeNetWorking
(
url:
ALServers
.
API_ACCOUNT_SUGGESTION
,
method:
HttpMethod
.
HTTPMethodPOTS
,
parameters:
parameters
).
then
((
val
){
print
(
'confimSuggestInfo---
${val}
'
);
});
}
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