1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*
* @author lsy
* @date 2020/5/14
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/toast/toast.dart';
import 'package:gm_flutter/MainRouter/service/remote/api/MainApi.serv.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/base/BaseState.dart';
import 'package:gm_flutter/commonModel/net/DioUtil.dart';
class NetProxyPage extends StatefulWidget {
@override
State<StatefulWidget> createState() => NetProxyState();
}
class NetProxyState extends BaseState<NetProxyPage> {
TextEditingController _editingController = TextEditingController();
@override
Widget buildItem(BuildContext context) {
return Scaffold(
appBar: baseAppBar(
centerTitle: true,
backClick: () {
Navigator.pop(context);
},
title: "设置代理页面"),
body: Column(
children: <Widget>[
Container(
height: 30,
),
Container(
height: 30,
child: baseTextField(_editingController, TextInputType.text,
"请您输入代理网址 例如:172.9.30.10"),
),
Expanded(
child: Container(),
),
InkWell(
onTap: () {
MainApiImpl.getInstance()
.isOk(DioUtil.getInstance().getDio())
.listen((event) {}).onError((error){
print("LSYQQ ${error.toString()}");
});
},
child: Container(
margin: EdgeInsets.only(bottom: 30, left: 15, right: 15),
height: 30,
color: Colors.blue,
width: double.maxFinite,
alignment: Alignment.center,
child: baseText("测试代理调用接口", 15, Colors.white),
)),
InkWell(
onTap: () {
if (_editingController.text == null) {
Toast.show(context, "请输入代理");
return;
}
DioUtil().setProxy(_editingController.text);
Toast.show(context, "设置成功");
},
child: Container(
margin: EdgeInsets.only(bottom: 30, left: 15, right: 15),
height: 30,
color: Colors.blue,
alignment: Alignment.center,
width: double.maxFinite,
child: baseText("设置代理", 15, Colors.white),
))
],
),
);
}
@override
void dispose() {
_editingController.dispose();
super.dispose();
}
}