mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-05-20 22:36:34 +08:00
test
This commit is contained in:
25
lib/model/responseData.dart
Normal file
25
lib/model/responseData.dart
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
class ResponseData{
|
||||||
|
int status;
|
||||||
|
bool success;
|
||||||
|
String message;
|
||||||
|
|
||||||
|
ResponseData(this.status, this.success,this.message);
|
||||||
|
|
||||||
|
ResponseData.fromJson(Map<String, dynamic> json)
|
||||||
|
: status = json['status'],
|
||||||
|
success = json['success'],
|
||||||
|
message=json['message'];
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() =>
|
||||||
|
{
|
||||||
|
'status': status,
|
||||||
|
'success': success,
|
||||||
|
'messsage': message
|
||||||
|
};
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'status: $status ,success: $success,message: ${message.toString()}';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,6 +2,7 @@ import 'dart:async' show Future;
|
|||||||
|
|
||||||
import 'package:flutter_go/model/version.dart';
|
import 'package:flutter_go/model/version.dart';
|
||||||
import 'package:package_info/package_info.dart';
|
import 'package:package_info/package_info.dart';
|
||||||
|
import 'package:flutter_go/model/responseData.dart';
|
||||||
|
|
||||||
import './net_utils.dart';
|
import './net_utils.dart';
|
||||||
import '../model/user_info.dart';
|
import '../model/user_info.dart';
|
||||||
@ -48,8 +49,14 @@ class DataUtils {
|
|||||||
// 一键反馈
|
// 一键反馈
|
||||||
static Future feedback(Map<String, String> params) async {
|
static Future feedback(Map<String, String> params) async {
|
||||||
var response = await NetUtils.post(Api.FEEDBACK, params);
|
var response = await NetUtils.post(Api.FEEDBACK, params);
|
||||||
print(response);
|
ResponseData responseData=ResponseData.fromJson(response);
|
||||||
return response;
|
print("responseData:$responseData");
|
||||||
|
var status= responseData.status;
|
||||||
|
if(status==200){
|
||||||
|
return '成功';
|
||||||
|
}else{
|
||||||
|
return responseData.message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 退出登陆
|
// 退出登陆
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:zefyr/zefyr.dart';
|
import 'package:zefyr/zefyr.dart';
|
||||||
import 'package:flutter_go/utils/data_utils.dart';
|
import 'package:flutter_go/utils/data_utils.dart';
|
||||||
@ -43,20 +45,25 @@ class _issuesMessagePageState extends State<issuesMessagePage> {
|
|||||||
_submit() {
|
_submit() {
|
||||||
String mk = notusMarkdown.encode(_delta);
|
String mk = notusMarkdown.encode(_delta);
|
||||||
if (_title.trim().isEmpty) {
|
if (_title.trim().isEmpty) {
|
||||||
Fluttertoast.showToast(msg: '标题不能为空',
|
_show('标题不能为空');
|
||||||
toastLength: Toast.LENGTH_SHORT,
|
|
||||||
gravity: ToastGravity.CENTER,
|
|
||||||
timeInSecForIos: 1,
|
|
||||||
backgroundColor: Theme.of(context).primaryColor,
|
|
||||||
textColor: Colors.white,
|
|
||||||
fontSize: 16.0);
|
|
||||||
} else {
|
} else {
|
||||||
DataUtils.feedback({'title': _title, "body": mk}).then((result) {
|
DataUtils.feedback({'title': _title, "body": mk}).then((result) {
|
||||||
print(result);
|
_show(result);
|
||||||
|
Navigator.maybePop(context);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_show(String msgs){
|
||||||
|
Fluttertoast.showToast(
|
||||||
|
msg: msgs,
|
||||||
|
toastLength: Toast.LENGTH_SHORT,
|
||||||
|
gravity: ToastGravity.CENTER,
|
||||||
|
timeInSecForIos: 1,
|
||||||
|
backgroundColor: Theme.of(context).primaryColor,
|
||||||
|
textColor: Colors.white,
|
||||||
|
fontSize: 16.0);
|
||||||
|
}
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
Reference in New Issue
Block a user