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
34109a02
Commit
34109a02
authored
Sep 17, 2019
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
396c9647
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
189 additions
and
286 deletions
+189
-286
ReputationsModel.dart
lib/PrestigeModel/page/reputation/ReputationsModel.dart
+1
-1
ReputationsPage.dart
lib/PrestigeModel/page/reputation/ReputationsPage.dart
+104
-50
comment_suggest.dart
lib/comment_suggest.dart
+17
-17
DioUtil.dart
lib/commonModel/net/DioUtil.dart
+18
-169
message_home.dart
lib/messageModel/home/message_home.dart
+39
-39
notification_list.dart
lib/messageModel/notification/notification_list.dart
+10
-10
No files found.
lib/PrestigeModel/page/reputation/ReputationsModel.dart
View file @
34109a02
...
@@ -21,7 +21,7 @@ class ReputationsModel extends BaseModel {
...
@@ -21,7 +21,7 @@ class ReputationsModel extends BaseModel {
init
(
BuildContext
context
)
{
init
(
BuildContext
context
)
{
Map
<
String
,
dynamic
>
headMap
=
new
Map
();
Map
<
String
,
dynamic
>
headMap
=
new
Map
();
headMap
.
putIfAbsent
(
"Cookie"
,
()
=>
cookie
);
headMap
.
putIfAbsent
(
"Cookie"
,
()
=>
cookie
);
DioUtil
().
addHead
=
headMap
;
DioUtil
.
addHeadMap
=
headMap
;
PrestigeRepository
.
getInstance
().
getReputations
().
listen
((
value
)
{
PrestigeRepository
.
getInstance
().
getReputations
().
listen
((
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
prestigeLive
.
notifyView
(
value
);
prestigeLive
.
notifyView
(
value
);
...
...
lib/PrestigeModel/page/reputation/ReputationsPage.dart
View file @
34109a02
...
@@ -24,21 +24,23 @@ class ReputationsState extends State<ReputationsPage> {
...
@@ -24,21 +24,23 @@ class ReputationsState extends State<ReputationsPage> {
ReputationsState
(
this
.
_model
);
ReputationsState
(
this
.
_model
);
@override
void
initState
()
{
super
.
initState
();
_model
.
init
(
context
);
}
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
title:
MyText
(
16
,
'我的专家声望'
,
0xff323232
),
'我的专家声望'
,
style:
TextStyle
(
fontSize:
16
),
),
centerTitle:
true
,
centerTitle:
true
,
leading:
IconButton
(
leading:
IconButton
(
// alignment: Alignment.centerLeft,
onPressed:
()
=>
Navigator
.
pop
(
context
),
onPressed:
()
=>
Navigator
.
pop
(
context
),
// padding: EdgeInsets.fromLTRB(22, 0, 0, 0),
icon:
Icon
(
icon:
Icon
(
Icons
.
keyboard_arrow_left
,
Icons
.
keyboard_arrow_left
,
size:
30
,
),
),
)),
)),
body:
StreamBuilder
<
PrestigeEntity
>(
body:
StreamBuilder
<
PrestigeEntity
>(
...
@@ -51,23 +53,33 @@ class ReputationsState extends State<ReputationsPage> {
...
@@ -51,23 +53,33 @@ class ReputationsState extends State<ReputationsPage> {
if
(
data
.
data
.
error
!=
0
||
data
.
data
.
data
==
null
)
{
if
(
data
.
data
.
error
!=
0
||
data
.
data
.
data
==
null
)
{
return
errorItem
(
data
.
data
.
message
);
return
errorItem
(
data
.
data
.
message
);
}
}
return
Column
(
return
CustomScrollView
(
children:
<
Widget
>[
slivers:
<
Widget
>[
Container
(
SliverList
(
margin:
EdgeInsets
.
fromLTRB
(
17
,
24
,
0
,
0
),
delegate:
SliverChildBuilderDelegate
(
child:
MyText
(
(
BuildContext
context
,
int
index
)
{
16.0
,
data
.
data
.
data
.
introduce
[
0
].
question
,
0xff323232
),
if
(
index
==
0
)
{
),
return
Container
(
Container
(
margin:
EdgeInsets
.
fromLTRB
(
17
,
24
,
17
,
0
),
margin:
EdgeInsets
.
fromLTRB
(
19
,
16
,
0
,
0
),
child:
MyText
(
16.0
,
data
.
data
.
data
.
introduce
[
0
].
question
,
child:
MyText
(
0xff323232
),
13.0
,
data
.
data
.
data
.
introduce
[
0
].
answer
,
0xff8E8E8E
),
);
),
}
ListView
.
builder
(
if
(
index
==
1
)
{
itemCount:
data
.
data
.
data
.
reputations
.
length
,
return
Container
(
itemBuilder:
(
context
,
index
)
{
margin:
EdgeInsets
.
fromLTRB
(
19
,
16
,
19
,
32
),
return
listItem
(
data
,
index
);
child:
MyText
(
}),
13.0
,
data
.
data
.
data
.
introduce
[
0
].
answer
,
0xff8E8E8E
),
);
}
if
(
index
==
data
.
data
.
data
.
reputations
.
length
+
2
)
{
//bottom margin
return
Container
(
height:
20
,
);
}
return
listItem
(
data
,
index
-
2
);
},
childCount:
data
.
data
.
data
.
reputations
.
length
+
3
)),
],
],
);
);
},
},
...
@@ -75,25 +87,40 @@ class ReputationsState extends State<ReputationsPage> {
...
@@ -75,25 +87,40 @@ class ReputationsState extends State<ReputationsPage> {
}
}
Widget
listItem
(
AsyncSnapshot
<
PrestigeEntity
>
data
,
int
index
)
{
Widget
listItem
(
AsyncSnapshot
<
PrestigeEntity
>
data
,
int
index
)
{
int
allSize
=
data
.
data
.
data
.
reputations
[
index
].
expertTags
.
length
;
var
item
=
data
.
data
.
data
.
reputations
[
index
];
int
allSize
;
int
bringSize
=
0
;
int
bringSize
=
0
;
for
(
var
item
in
data
.
data
.
data
.
reputations
[
index
].
expertTags
)
{
if
(
item
.
expertTags
==
null
)
{
if
(
item
.
level
>
0
)
{
allSize
=
0
;
bringSize
++;
bringSize
=
0
;
}
else
{
allSize
=
item
.
expertTags
.
length
;
for
(
var
item
in
item
.
expertTags
)
{
if
(
item
.
level
>
0
)
{
bringSize
=
bringSize
+
1
;
}
}
}
}
}
double
itemHeight
=
154.0
;
// int col = (allSize / 3).ceil();
// print("size $col");
// double allHeight;
// if (col == 0) {
// allHeight = 30;
// } else {
// allHeight = itemHeight * col;
// }
return
Column
(
return
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
Container
(
margin:
EdgeInsets
.
fromLTRB
(
0
,
32
,
0
,
0
),
color:
Color
(
0xffDADADA
),
width:
double
.
maxFinite
,
width:
double
.
maxFinite
,
height:
30
,
height:
30
,
child:
Row
(
child:
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
Container
(
margin:
EdgeInsets
.
fromLTRB
(
16
,
0
,
0
,
0
),
margin:
EdgeInsets
.
fromLTRB
(
16
,
0
,
0
,
0
),
child:
MyText
(
14.0
,
data
.
data
.
data
.
reputations
[
index
].
category
,
child:
MyText
(
14.0
,
item
.
category
,
0xffffffff
),
0xffffffff
),
),
),
Expanded
(
Expanded
(
child:
Container
(),
child:
Container
(),
...
@@ -106,26 +133,51 @@ class ReputationsState extends State<ReputationsPage> {
...
@@ -106,26 +133,51 @@ class ReputationsState extends State<ReputationsPage> {
),
),
),
),
GridView
.
builder
(
GridView
.
builder
(
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
physics:
new
NeverScrollableScrollPhysics
(),
crossAxisCount:
3
,
mainAxisSpacing:
4
,
crossAxisSpacing:
10.0
),
shrinkWrap:
true
,
itemBuilder:
(
context
,
gridIndex
)
{
itemCount:
allSize
,
var
item
=
gridDelegate:
SliverGridDelegateWithFixedCrossAxisCount
(
data
.
data
.
data
.
reputations
[
index
].
expertTags
[
gridIndex
];
crossAxisCount:
3
,
bool
isBright
=
item
.
level
>
0
;
),
return
Column
(
itemBuilder:
(
context
,
gridIndex
)
{
children:
<
Widget
>[
if
(
item
.
expertTags
==
null
)
{
isBright
return
Container
();
?
CachedNetworkImage
(
imageUrl:
item
.
lightBadge
)
}
:
CachedNetworkImage
(
imageUrl:
item
.
grayBadge
),
bool
isBright
=
item
.
expertTags
[
gridIndex
].
level
>
0
;
Container
(
return
Container
(
margin:
EdgeInsets
.
fromLTRB
(
0
,
5
,
0
,
0
),
height:
itemHeight
,
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
Container
(),
),
Container
(
height:
80
,
width:
80
,
child:
isBright
child:
isBright
?
MyText
(
13.0
,
"Lv
${item.level}
${item.tagName}
"
,
?
CachedNetworkImage
(
0xff8E8E8E
)
imageUrl:
item
.
expertTags
[
gridIndex
].
lightBadge
)
:
MyText
(
13.0
,
"
${item.tagName}
"
,
0xffC4C4C4
))
:
CachedNetworkImage
(
],
imageUrl:
item
.
expertTags
[
gridIndex
].
grayBadge
),
);
),
})
Container
(
margin:
EdgeInsets
.
fromLTRB
(
0
,
5
,
0
,
0
),
child:
isBright
?
MyText
(
13.0
,
"Lv
${item.expertTags[gridIndex].level}
${item.expertTags[gridIndex].tagName}
"
,
0xff8E8E8E
)
:
MyText
(
13.0
,
"
${item.expertTags[gridIndex].tagName}
"
,
0xffC4C4C4
)),
Expanded
(
child:
Container
(),
)
],
));
},
)
],
],
);
);
}
}
...
@@ -137,7 +189,9 @@ class ReputationsState extends State<ReputationsPage> {
...
@@ -137,7 +189,9 @@ class ReputationsState extends State<ReputationsPage> {
}
}
Widget
loadingItem
()
{
Widget
loadingItem
()
{
return
CircularProgressIndicator
();
return
Center
(
child:
CircularProgressIndicator
(),
);
}
}
Text
MyText
(
double
size
,
String
text
,
int
color
)
{
Text
MyText
(
double
size
,
String
text
,
int
color
)
{
...
...
lib/comment_suggest.dart
View file @
34109a02
...
@@ -177,23 +177,23 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
...
@@ -177,23 +177,23 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
DioUtil
().
setConfig
(
config
);
DioUtil
().
setConfig
(
config
);
String
content
=
(
this
.
opinionCtrl
.
text
.
length
>
0
)?
this
.
opinionCtrl
.
text
:
''
;
String
content
=
(
this
.
opinionCtrl
.
text
.
length
>
0
)?
this
.
opinionCtrl
.
text
:
''
;
String
phone
=
(
this
.
telCtrl
.
text
.
length
>
0
)?
this
.
telCtrl
.
text
:
''
;
String
phone
=
(
this
.
telCtrl
.
text
.
length
>
0
)?
this
.
telCtrl
.
text
:
''
;
DioUtil
().
requestR
(
Method
.
post
,
"api/v1/suggestion"
,
data:
{
"content"
:
content
,
"phone"
:
phone
}).
then
((
res
){
//
DioUtil().requestR(Method.post, "api/v1/suggestion",data: {"content": content, "phone": phone}).then((res){
if
(
res
.
code
==
0
)
{
//
if (res.code == 0) {
Toast
.
show
(
context
,
'提交成功'
);
//
Toast.show(context, '提交成功');
FlutterBoost
.
singleton
.
closePageForContext
(
context
);
//
FlutterBoost.singleton.closePageForContext(context);
}
else
{
//
} else {
Toast
.
show
(
context
,
res
.
msg
);
// Toast.show(context, res.msg);
}
//
}
}
//
}
).
then
((
error
){
//
).then((error){
if
(
error
!=
null
)
{
//
if (error != null) {
Toast
.
show
(
context
,
'提交失败'
);
//
Toast.show(context, '提交失败');
print
(
error
);
//
print(error);
}
else
{
//
} else {
// FlutterBoost.singleton.closePageForContext(context);
//
// FlutterBoost.singleton.closePageForContext(context);
}
//
}
//
});
//
});
}
}
}
}
...
...
lib/commonModel/net/DioUtil.dart
View file @
34109a02
...
@@ -157,7 +157,7 @@ class DioUtil {
...
@@ -157,7 +157,7 @@ class DioUtil {
String
_proxy
=
'172.30.9.117:8888'
;
String
_proxy
=
'172.30.9.117:8888'
;
Map
<
String
,
dynamic
>
addHeadMap
;
static
Map
<
String
,
dynamic
>
addHeadMap
;
/// 是否是debug模式.
/// 是否是debug模式.
static
bool
_isDebug
=
!
inProduction
;
static
bool
_isDebug
=
!
inProduction
;
...
@@ -170,40 +170,24 @@ class DioUtil {
...
@@ -170,40 +170,24 @@ class DioUtil {
return
_instance
;
return
_instance
;
}
}
static
var
interceptor
=
InterceptorsWrapper
(
onRequest:
(
opt
)
{
var
headers
=
opt
.
headers
;
if
(
addHeadMap
!=
null
)
{
print
(
"请求之前"
);
addHeadMap
.
forEach
((
k
,
v
)
{
headers
.
putIfAbsent
(
k
,
()
=>
v
);
print
(
"HEADDD
${k}
${v}
"
);
});
}
},
onResponse:
(
response
)
{
print
(
"相应之前"
);
},
onError:
(
e
)
{
print
(
"网络错误
$e
"
);
});
DioUtil
.
_init
()
{
DioUtil
.
_init
()
{
_dio
=
new
Dio
(
_options
);
_dio
=
new
Dio
(
_options
);
initDeviceInfo
().
then
((
value
)
{
_dio
.
interceptors
.
add
(
interceptor
);
_dio
.
interceptors
.
add
(
InterceptorsWrapper
(
onRequest:
(
RequestOptions
options
)
{
//TODO fix it
var
queryParameters
=
options
.
queryParameters
;
queryParameters
.
putIfAbsent
(
"app_name"
,
()
=>
value
.
packageName
);
queryParameters
.
putIfAbsent
(
"version"
,
()
=>
value
.
version
);
queryParameters
.
putIfAbsent
(
"platform"
,
()
=>
Platform
.
isIOS
?
"ios"
:
"android"
);
var
headers
=
options
.
headers
;
if
(
addHeadMap
!=
null
)
{
addHeadMap
.
forEach
((
k
,
v
)
{
headers
.
putIfAbsent
(
k
,
()
=>
v
);
});
}
print
(
"请求之前"
);
// Do something before request is sent
return
options
;
//continue
},
onResponse:
(
Response
response
)
{
print
(
"响应之前"
);
// Do something with response data
return
response
;
// continue
},
onError:
(
DioError
e
)
{
print
(
"错误之前"
);
// Do something with response error
return
e
;
//continue
}));
}).
catchError
((
error
)
{
print
(
error
);
});
//TODO
}
}
set
addHead
(
Map
<
String
,
dynamic
>
map
)
{
set
addHead
(
Map
<
String
,
dynamic
>
map
)
{
...
@@ -339,142 +323,6 @@ class DioUtil {
...
@@ -339,142 +323,6 @@ class DioUtil {
}
}
}
}
/// Make http request with options.
/// [method] The request method.
/// [path] The url path.
/// [data] The request data
/// [options] The request options.
/// Map<String, dynamic> queryParameters,
/// <BaseResp<T> 返回 status code msg data .
Future
<
BaseResp
<
T
>>
request
<
T
>(
String
method
,
String
path
,
{
Map
<
String
,
dynamic
>
queryParameters
,
data
,
Options
options
,
CancelToken
cancelToken
})
async
{
// _dio.request(path, que)
// _dio.request(path, )
Response
response
=
await
_dio
.
request
(
path
,
data:
data
,
queryParameters:
queryParameters
,
options:
_checkOptions
(
method
,
options
),
cancelToken:
cancelToken
);
_printHttpLog
(
response
);
String
_status
;
int
_code
;
String
_msg
;
T
_data
;
T
_extra
;
T
_userType
;
_status
=
response
.
statusCode
.
toString
();
if
(
response
.
statusCode
==
HttpStatus
.
ok
||
response
.
statusCode
==
HttpStatus
.
created
)
{
try
{
if
(
response
.
data
is
Map
)
{
_code
=
(
response
.
data
[
_codeKey
]
is
String
)
?
int
.
tryParse
(
response
.
data
[
_codeKey
])
:
response
.
data
[
_codeKey
];
_msg
=
response
.
data
[
_msgKey
];
_data
=
response
.
data
[
_dataKey
];
_extra
=
response
.
data
[
_extraKey
];
}
else
{
Map
<
String
,
dynamic
>
_dataMap
=
_decodeData
(
response
);
_code
=
(
_dataMap
[
_codeKey
]
is
String
)
?
int
.
tryParse
(
_dataMap
[
_codeKey
])
:
_dataMap
[
_codeKey
];
_msg
=
_dataMap
[
_msgKey
];
_data
=
_dataMap
[
_dataKey
];
_extra
=
response
.
data
[
_extraKey
];
_userType
=
response
.
data
[
_userType
];
}
print
(
"------ MSG
${_msg}
DATA
${_data}
EXTRA
${_extra}
USERTYPE
${_userType}
"
);
return
new
BaseResp
(
_status
,
_code
,
_msg
,
_data
,
_extra
,
_userType
);
}
catch
(
e
)
{
return
new
Future
.
error
(
new
DioError
(
response:
response
,
message:
"data parsing exception..."
,
type:
DioErrorType
.
RESPONSE
,
));
}
}
return
new
Future
.
error
(
new
DioError
(
response:
response
,
message:
"statusCode:
$response
.statusCode, service error"
,
type:
DioErrorType
.
RESPONSE
,
));
}
/// Make http request with options.
/// [method] The request method.
/// [path] The url path.
/// [data] The request data
/// [options] The request options.
/// <BaseRespR<T> 返回 status code msg data Response.
Future
<
BaseRespR
<
T
>>
requestR
<
T
>(
String
method
,
String
path
,
{
Map
<
String
,
dynamic
>
queryParameters
,
data
,
Options
options
,
CancelToken
cancelToken
})
async
{
// _dio.request(path,queryParameters: )
Response
response
=
await
_dio
.
request
(
path
,
data:
data
,
queryParameters:
queryParameters
,
options:
_checkOptions
(
method
,
options
),
cancelToken:
cancelToken
);
_printHttpLog
(
response
);
String
_status
;
int
_code
;
String
_msg
;
T
_data
;
T
_extra
;
T
_userType
;
_status
=
response
.
statusCode
.
toString
();
if
(
response
.
statusCode
==
HttpStatus
.
ok
||
response
.
statusCode
==
HttpStatus
.
created
)
{
try
{
if
(
response
.
data
is
Map
)
{
_code
=
(
response
.
data
[
_codeKey
]
is
String
)
?
int
.
tryParse
(
response
.
data
[
_codeKey
])
:
response
.
data
[
_codeKey
];
_msg
=
response
.
data
[
_msgKey
];
_data
=
response
.
data
[
_dataKey
];
}
else
{
Map
<
String
,
dynamic
>
_dataMap
=
_decodeData
(
response
);
_code
=
(
_dataMap
[
_codeKey
]
is
String
)
?
int
.
tryParse
(
_dataMap
[
_codeKey
])
:
_dataMap
[
_codeKey
];
_msg
=
_dataMap
[
_msgKey
];
_data
=
_dataMap
[
_dataKey
];
_extra
=
response
.
data
[
_extraKey
];
_userType
=
response
.
data
[
_userType
];
}
return
new
BaseRespR
(
_status
,
_code
,
_msg
,
_data
,
_extra
,
_userType
,
response
);
}
catch
(
e
)
{
return
new
Future
.
error
(
new
DioError
(
response:
response
,
message:
"data parsing exception..."
,
type:
DioErrorType
.
RESPONSE
,
));
}
}
else
{
_code
=
1
;
_msg
=
'请求失败'
;
}
return
new
Future
.
error
(
new
DioError
(
response:
response
,
message:
"statusCode:
$response
.statusCode, service error"
,
type:
DioErrorType
.
RESPONSE
,
));
}
/// Download the file and save it in local. The default http method is "GET",you can custom it by [Options.method].
/// [urlPath]: The file url.
/// [savePath]: The path to save the downloading file later.
/// [onProgress]: The callback to listen downloading progress.please refer to [OnDownloadProgress].
Future
<
Response
>
download
(
Future
<
Response
>
download
(
String
urlPath
,
String
urlPath
,
savePath
,
{
savePath
,
{
...
@@ -614,4 +462,5 @@ class DioUtil {
...
@@ -614,4 +462,5 @@ class DioUtil {
options
.
headers
=
headers
;
options
.
headers
=
headers
;
return
options
;
return
options
;
}
}
}
}
lib/messageModel/home/message_home.dart
View file @
34109a02
...
@@ -65,51 +65,51 @@ class _MessageHomePageState extends State<MessageHomePage> {
...
@@ -65,51 +65,51 @@ class _MessageHomePageState extends State<MessageHomePage> {
}
}
Future
<
List
<
ListItem
>>
_fetchMesssageList
()
async
{
Future
<
List
<
ListItem
>>
_fetchMesssageList
()
async
{
List
<
Message
>
messageList
=
List
<
Message
>();
//
List<Message> messageList = List<Message>();
BaseResp
<
List
>
baseresp
=
await
DioUtil
().
request
<
List
>(
Method
.
get
,
"api/v1/reply/my"
,
queryParameters:
{
'page'
:
pageIndex
,
'count'
:
10
});
//
BaseResp<List> baseresp = await DioUtil().request<List>(Method.get, "api/v1/reply/my", queryParameters: {'page': pageIndex, 'count': 10});
if
(
baseresp
.
code
!=
0
)
{
//
if (baseresp.code != 0) {
return
new
Future
.
error
(
baseresp
.
msg
);
//
return new Future.error(baseresp.msg);
}
//
}
//
if
(
baseresp
.
data
!=
null
)
{
//
if (baseresp.data != null) {
messageList
=
baseresp
.
data
.
map
((
value
)
{
//
messageList = baseresp.data.map((value) {
return
Message
.
fromJson
(
value
);
//
return Message.fromJson(value);
}).
toList
();
//
}).toList();
}
//
}
_refreshController
.
refreshCompleted
();
_refreshController
.
refreshCompleted
();
return
messageList
;
return
messageList
;
}
}
Future
<
List
<
ListItem
>>
_fetchNewestInfo
()
async
{
Future
<
List
<
ListItem
>>
_fetchNewestInfo
()
async
{
List
<
ListItem
>
notiData
=
List
<
ListItem
>();
List
<
ListItem
>
notiData
=
List
<
ListItem
>();
BaseRespR
noteResp
=
await
DioUtil
().
requestR
(
Method
.
get
,
'api/v1/push/newest/info'
);
// BaseRespR noteResp = await DioUtil().requestR(Method.get, 'api/v1/push/newest/info');
Map
noteData
=
noteResp
.
data
;
//
Map noteData = noteResp.data;
String
noteContent
=
noteData
[
'content'
];
//
String noteContent = noteData['content'];
NotificationItem
noteItem
=
NotificationItem
(
'images/message_noti.png'
,
noteContent
,
0
,
'通知'
);
//
NotificationItem noteItem = NotificationItem('images/message_noti.png', noteContent, 0, '通知');
notiData
.
add
(
noteItem
);
//
notiData.add(noteItem);
//
BaseRespR
likeResp
=
await
DioUtil
().
requestR
(
Method
.
get
,
'api/v1/message/unread'
,
queryParameters:
{
'type'
:
0
});
//
BaseRespR likeResp = await DioUtil().requestR(Method.get, 'api/v1/message/unread',queryParameters: {'type': 0});
print
(
likeResp
);
//
print(likeResp);
Map
likeData
=
likeResp
.
data
;
//
Map likeData = likeResp.data;
String
likeContent
=
''
;
//
String likeContent = '';
NotificationItem
likeItem
=
NotificationItem
(
'images/message_like.png'
,
likeContent
,
likeData
[
'count'
],
'Like'
);
//
NotificationItem likeItem = NotificationItem('images/message_like.png', likeContent, likeData['count'], 'Like');
if
(
likeItem
.
count
>
0
)
{
//
if (likeItem.count > 0) {
likeItem
.
content
=
'有
${likeItem.count}
个人Like了你'
;
//
likeItem.content = '有${likeItem.count}个人Like了你';
}
else
{
//
} else {
likeItem
.
content
=
'还没有人给你Like哦~'
;
//
likeItem.content = '还没有人给你Like哦~';
}
//
}
notiData
.
add
(
likeItem
);
//
notiData.add(likeItem);
BaseRespR
attentionResp
=
await
DioUtil
().
requestR
(
Method
.
get
,
'api/v1/message/unread'
,
queryParameters:
{
'type'
:
1
});
//
BaseRespR attentionResp = await DioUtil().requestR(Method.get, 'api/v1/message/unread',queryParameters: {'type': 1});
Map
attData
=
attentionResp
.
data
;
//
Map attData = attentionResp.data;
String
attContent
=
''
;
//
String attContent = '';
NotificationItem
attItem
=
NotificationItem
(
'images/message_att.png'
,
attContent
,
attData
[
'count'
],
'关注'
);
//
NotificationItem attItem = NotificationItem('images/message_att.png', attContent, attData['count'], '关注');
if
(
attItem
.
count
>
0
)
{
//
if (attItem.count > 0) {
attItem
.
content
=
'有
${attItem.count}
个人关注了你'
;
//
attItem.content = '有${attItem.count}个人关注了你';
}
else
{
//
} else {
attContent
=
'还没有人给你关注哦~'
;
//
attContent = '还没有人给你关注哦~';
}
//
}
notiData
.
add
(
attItem
);
//
notiData.add(attItem);
// this.dataArr = dataArr;
// this.dataArr = dataArr;
return
notiData
;
return
notiData
;
}
}
...
...
lib/messageModel/notification/notification_list.dart
View file @
34109a02
...
@@ -44,16 +44,16 @@ class _NotificationListState extends State<NotificationList> {
...
@@ -44,16 +44,16 @@ class _NotificationListState extends State<NotificationList> {
Future
<
List
<
ListItem
>>
_fetchMesssageList
()
async
{
Future
<
List
<
ListItem
>>
_fetchMesssageList
()
async
{
List
<
NotificationModel
>
messageList
=
List
<
NotificationModel
>();
List
<
NotificationModel
>
messageList
=
List
<
NotificationModel
>();
BaseResp
<
List
>
baseresp
=
await
DioUtil
().
request
<
List
>(
Method
.
get
,
"api/v1/message/notice"
,
queryParameters:
{
'page'
:
pageIndex
,
'count'
:
10
});
//
BaseResp<List> baseresp = await DioUtil().request<List>(Method.get, "api/v1/message/notice", queryParameters: {'page': pageIndex, 'count': 10});
if
(
baseresp
.
code
!=
0
)
{
//
if (baseresp.code != 0) {
return
new
Future
.
error
(
baseresp
.
msg
);
//
return new Future.error(baseresp.msg);
}
//
}
//
if
(
baseresp
.
data
!=
null
)
{
//
if (baseresp.data != null) {
messageList
=
baseresp
.
data
.
map
((
value
)
{
//
messageList = baseresp.data.map((value) {
return
NotificationModel
.
fromJson
(
value
);
//
return NotificationModel.fromJson(value);
}).
toList
();
//
}).toList();
}
//
}
_refreshController
.
refreshCompleted
();
_refreshController
.
refreshCompleted
();
return
messageList
;
return
messageList
;
}
}
...
...
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