Commit 7b53a2b4 authored by 艾娇平's avatar 艾娇平

添加获取Native 的user_id

parent 2ded43cd
......@@ -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
});
}
}
......@@ -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}');
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment