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
079d3247
Commit
079d3247
authored
May 17, 2019
by
Q14
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
00841322
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
38 additions
and
151 deletions
+38
-151
comment_suggest.dart
lib/comment_suggest.dart
+13
-26
ALNetWork.dart
lib/netWork/ALNetWork.dart
+1
-1
DioUtil.dart
lib/netWork/DioUtil.dart
+0
-100
pubspec.lock
pubspec.lock
+24
-24
No files found.
lib/comment_suggest.dart
View file @
079d3247
...
...
@@ -9,8 +9,7 @@
import
'package:flutter/material.dart'
;
import
'macros/ALColors.dart'
;
import
'macros/ALDevice.dart'
;
// import 'netWork/ALNetWork.dart';
import
'netWork/DioUtil.dart'
;
import
'netWork/ALNetWork.dart'
;
// import 'services/ALNetClient.dart';
// import 'hybrid_stack/hybrid_stack_manager_plugin.dart';
...
...
@@ -153,33 +152,21 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
}
void
confimSuggestInfo
()
{
//
ALNetwork(
//
success: (NetworkSuccess success){
//
setState(() {
ALNetwork
(
success:
(
NetworkSuccess
success
){
setState
(()
{
//
});
//
},
//
error: (NetworkError error){
//
setState(() {
});
},
error:
(
NetworkError
error
){
setState
(()
{
// });
// },
// api: '/api/v1/suggestion',
// params: {'content': 'aaa', 'phone': 'bbb'}
// );
});
},
api:
'/api/v1/suggestion'
,
params:
{
'content'
:
'aaa'
,
'phone'
:
'bbb'
}
);
DioUtil
().
get
(
'/api/v1/suggestion'
,
data:
{
'content'
:
'aaa'
,
'phone'
:
'18601965003'
},
errorCallback:
(
statusCode
)
{
print
(
'Http error code :
$statusCode
'
);
}
).
then
((
data
)
{
print
(
'Http response:
$data
'
);
});
}
}
...
...
lib/netWork/ALNetWork.dart
View file @
079d3247
...
...
@@ -25,7 +25,7 @@ class NetworkError {
class
ALURL
{
ALURL
({
this
.
api
})
:
assert
(
api
!=
null
);
final
String
api
;
static
final
baseUrl
=
'http
s://earth.iyanzh
i.com'
;
static
final
baseUrl
=
'http
://earth.igengme
i.com'
;
String
get
originUrl
=>
(
baseUrl
+
api
);
}
...
...
lib/netWork/DioUtil.dart
deleted
100644 → 0
View file @
00841322
import
'dart:convert'
;
import
'dart:io'
;
import
'package:dio/dio.dart'
;
class
Method
{
static
final
String
get
=
"GET"
;
static
final
String
post
=
"POST"
;
static
final
String
put
=
"PUT"
;
static
final
String
head
=
"HEAD"
;
static
final
String
delete
=
"DELETE"
;
static
final
String
patch
=
"PATCH"
;
}
class
DioUtil
{
static
final
DioUtil
_instance
=
DioUtil
.
_init
();
static
Dio
_dio
;
static
BaseOptions
_options
=
getDefOptions
();
factory
DioUtil
()
{
return
_instance
;
}
DioUtil
.
_init
()
{
_dio
=
new
Dio
();
}
static
BaseOptions
getDefOptions
()
{
BaseOptions
options
=
BaseOptions
();
options
.
connectTimeout
=
10
*
1000
;
options
.
receiveTimeout
=
20
*
1000
;
options
.
contentType
=
ContentType
.
parse
(
'application/x-www-form-urlencoded'
);
Map
<
String
,
dynamic
>
headers
=
Map
<
String
,
dynamic
>();
headers
[
'Accept'
]
=
'application/json'
;
String
platform
;
if
(
Platform
.
isAndroid
)
{
platform
=
"Android"
;
}
else
if
(
Platform
.
isIOS
)
{
platform
=
"IOS"
;
}
headers
[
'OS'
]
=
platform
;
options
.
headers
=
headers
;
return
options
;
}
setOptions
(
BaseOptions
options
)
{
_options
=
options
;
_dio
.
options
=
_options
;
}
Future
<
Map
<
String
,
dynamic
>>
get
(
String
path
,
{
pathParams
,
data
,
Function
errorCallback
})
{
return
request
(
path
,
method:
Method
.
get
,
pathParams:
pathParams
,
data:
data
,
errorCallback:
errorCallback
);
}
Future
<
Map
<
String
,
dynamic
>>
post
(
String
path
,
{
pathParams
,
data
,
Function
errorCallback
})
{
return
request
(
path
,
method:
Method
.
post
,
pathParams:
pathParams
,
data:
data
,
errorCallback:
errorCallback
);
}
Future
<
Map
<
String
,
dynamic
>>
request
(
String
path
,{
String
method
,
Map
pathParams
,
data
,
Function
errorCallback
})
async
{
///restful请求处理
if
(
pathParams
!=
null
)
{
pathParams
.
forEach
((
key
,
value
)
{
if
(
path
.
indexOf
(
key
)
!=
-
1
)
{
path
=
path
.
replaceAll
(
":
$key
"
,
value
.
toString
());
}
});
}
Response
response
=
await
_dio
.
request
(
path
,
data:
data
,
options:
Options
(
method:
method
));
if
(
response
.
statusCode
==
HttpStatus
.
ok
||
response
.
statusCode
==
HttpStatus
.
created
)
{
try
{
if
(
response
.
data
is
Map
)
{
return
response
.
data
;
}
else
{
return
json
.
decode
(
response
.
data
.
toString
());
}
}
catch
(
e
)
{
return
null
;
}
}
else
{
_handleHttpError
(
response
.
statusCode
);
if
(
errorCallback
!=
null
)
{
errorCallback
(
response
.
statusCode
);
}
return
null
;
}
}
///处理Http错误码
void
_handleHttpError
(
int
errorCode
)
{
}
}
\ No newline at end of file
pubspec.lock
View file @
079d3247
...
...
@@ -5,49 +5,49 @@ packages:
dependency: transitive
description:
name: async
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.
1
.0"
version: "2.
2
.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.14.11"
cookie_jar:
dependency: transitive
description:
name: cookie_jar
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.0"
cupertino_icons:
dependency: "direct main"
description:
name: cupertino_icons
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.1.2"
dio:
dependency: "direct main"
description:
name: dio
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.1.3"
flutter:
...
...
@@ -73,37 +73,37 @@ packages:
dependency: transitive
description:
name: matcher
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.5.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.
2
"
version: "2.0.
3
"
sky_engine:
dependency: transitive
description: flutter
...
...
@@ -113,63 +113,63 @@ packages:
dependency: transitive
description:
name: source_span
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.2.
4
"
version: "0.2.
5
"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "2.0.8"
xservice_kit:
dependency: transitive
description:
name: xservice_kit
url: "https://pub.
dartlang.org
"
url: "https://pub.
flutter-io.cn
"
source: hosted
version: "0.0.29"
sdks:
...
...
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