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
09da21c9
Commit
09da21c9
authored
Oct 15, 2019
by
郑智刚
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
90b5b8f5
d58738cd
Hide whitespace changes
Inline
Side-by-side
Showing
31 changed files
with
546 additions
and
406 deletions
+546
-406
MainActivity.kt
...c/main/kotlin/com/example/gmalpha_flutter/MainActivity.kt
+1
-1
ActivityReportRouterImpl.dart
lib/ActivityReportModel/ActivityReportRouterImpl.dart
+1
-1
NewMessageRouter.dart
lib/NewMessageModel/NewMessageRouter.dart
+2
-2
NewMessageRouterImpl.dart
lib/NewMessageModel/NewMessageRouterImpl.dart
+2
-2
MessageModel.dart
lib/NewMessageModel/page/MessageModel.dart
+1
-0
MessagePage.dart
lib/NewMessageModel/page/MessagePage.dart
+70
-36
common.dart
lib/NewMessageModel/page/common.dart
+13
-6
Jump.dart
lib/NewMessageModel/util/Jump.dart
+13
-0
ReputationsModel.dart
lib/PrestigeModel/page/reputation/ReputationsModel.dart
+9
-3
ReputationsPage.dart
lib/PrestigeModel/page/reputation/ReputationsPage.dart
+3
-2
TestPage.dart
lib/TestPage.dart
+40
-32
BaseUtil.dart
lib/commonModel/base/BaseUtil.dart
+12
-0
LiveData.dart
lib/commonModel/live/LiveData.dart
+2
-0
DioUtil.dart
lib/commonModel/net/DioUtil.dart
+7
-143
main.dart
lib/main.dart
+0
-2
Anim.dart
lib/res/anim/Anim.dart
+86
-0
CommentModel.dart
lib/userModel/page/comment/CommentModel.dart
+32
-0
CommentSuggestPage.dart
lib/userModel/page/comment/CommentSuggestPage.dart
+41
-98
UserSettingModel.dart
lib/userModel/page/userSetting/UserSettingModel.dart
+39
-30
UserSettingPage.dart
lib/userModel/page/userSetting/UserSettingPage.dart
+7
-6
UserRepository.dart
lib/userModel/service/UserRepository.dart
+5
-0
UserRemote.dart
lib/userModel/service/remote/UserRemote.dart
+5
-0
UserApi.dart
lib/userModel/service/remote/api/UserApi.dart
+4
-0
UserApi.serv.dart
lib/userModel/service/remote/api/UserApi.serv.dart
+11
-0
CommentBean.dart
lib/userModel/service/remote/entity/CommentBean.dart
+59
-0
UserEntity.dart
lib/userModel/service/remote/entity/UserEntity.dart
+39
-35
UserEntity.user.dart
lib/userModel/service/remote/entity/UserEntity.user.dart
+6
-5
UserResultBean.dart
lib/userModel/service/remote/entity/UserResultBean.dart
+1
-2
JumpUtil.dart
lib/userModel/util/JumpUtil.dart
+13
-0
pubspec.lock
pubspec.lock
+21
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
android/app/src/main/kotlin/com/example/gmalpha_flutter/MainActivity.kt
View file @
09da21c9
...
...
@@ -63,7 +63,7 @@ class MainActivity : FlutterActivity() {
result
.
success
(
"wifi"
)
}
else
if
(
call
.
method
==
"INIT_PARAMS"
)
{
val
map
=
HashMap
<
String
,
String
>()
map
.
put
(
"buildConfig"
,
"
release
"
)
map
.
put
(
"buildConfig"
,
"
debug
"
)
//HERE
// map.put("proxy", "172.30.9.84:6666");
result
.
success
(
map
)
...
...
lib/ActivityReportModel/ActivityReportRouterImpl.dart
View file @
09da21c9
...
...
@@ -9,6 +9,6 @@ import 'package:gmalpha_flutter/ActivityReportModel/page/ActivityReportPage.dart
class
ActivityReportRouterImpl
implements
ActivityReportRouter
{
@override
Widget
getActivityReportPage
(
int
id
,
int
type
,
String
fromPage
)
{
return
ActivityReportPage
(
id
,
type
,
fromPage
);
return
new
ActivityReportPage
(
id
,
type
,
fromPage
);
}
}
lib/NewMessageModel/NewMessageRouter.dart
View file @
09da21c9
...
...
@@ -5,7 +5,6 @@ import 'package:gmalpha_flutter/NewMessageModel/NewMessageRouterImpl.dart';
@Router
(
"NewMessageModel"
,
NewMessageRouterImpl
,
true
)
abstract
class
NewMessageRouter
implements
RouterBaser
{
Widget
getMessagePage
();
Widget
getAttentionPage
(
String
fromPage
);
Widget
getMessagePage
(
String
fromPage
);
}
\ No newline at end of file
lib/NewMessageModel/NewMessageRouterImpl.dart
View file @
09da21c9
...
...
@@ -6,8 +6,8 @@ import 'package:gmalpha_flutter/NewMessageModel/page/AttentionPage.dart';
class
NewMessageRouterImpl
implements
NewMessageRouter
{
@override
Widget
getMessagePage
()
{
return
MessagePage
();
Widget
getMessagePage
(
String
fromPage
)
{
return
MessagePage
(
fromPage
);
}
@override
...
...
lib/NewMessageModel/page/MessageModel.dart
View file @
09da21c9
...
...
@@ -24,6 +24,7 @@ class MessageModel extends BaseModel {
getLatestMessage
();
}
getMyMessage
(
page
,
count
){
MessageRepository
.
getInstance
()
.
getMyMessage
(
page
,
count
)
...
...
lib/NewMessageModel/page/MessagePage.dart
View file @
09da21c9
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/page/MessageModel.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/service/remote/entity/LatestMessageEntity.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/service/remote/entity/MyMessageEntity.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/service/remote/entity/UnreadMessageEntity.dart'
;
import
'package:gmalpha_flutter/commonModel/ui/ALColors.dart'
;
import
'common.dart'
;
...
...
@@ -17,7 +20,7 @@ enum LoadingStatus {
class
MessagePage
extends
StatefulWidget
{
MessageModel
_messageModel
;
MessagePage
()
{
MessagePage
(
String
fromPage
)
{
_messageModel
=
new
MessageModel
(
1
,
10
);
}
@override
...
...
@@ -79,7 +82,6 @@ class _MessagePageState extends State<MessagePage> {
void
initState
()
{
super
.
initState
();
_messageModel
.
init
(
context
);
list
.
insertAll
(
0
,
[
1
]);
//在初始化状态的方法里 设置ListView的监听
_scrollController
.
addListener
(()
{
//判断 当滑动到最底部的时候,去加载更多的数据
...
...
@@ -100,49 +102,81 @@ class _MessagePageState extends State<MessagePage> {
title:
messageTitle
(
'消息'
),
elevation:
0
,
),
body:
ListView
.
builder
(
itemCount:
list
.
length
+
1
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
if
(
index
==
list
.
length
)
{
if
(
list
.
length
==
1
)
{
return
Container
(
body:
SingleChildScrollView
(
child:
Center
(
child:
Column
(
children:
<
Widget
>[
topCard
(),
Container
(
color:
ALColors
.
ColorFFFFFF
,
height:
ScreenUtil
().
setHeight
(
430
),
child:
Center
(
child:
Text
(
'暂无相关内容'
,
style:
TextStyle
(
color:
ALColors
.
Color999999
,
fontSize:
ScreenUtil
().
setSp
(
16
))))
);
}
else
{
return
_loadingView
();
}
}
else
{
if
(
index
==
0
)
{
return
topCard
(
_messageModel
.
latestMessageLive
);
}
else
{
return
Container
(
color:
ALColors
.
ColorFFFFFF
,
child:
Column
(
children:
<
Widget
>[
Center
(
child:
messageList
(
_messageModel
.
myMessageLive
),
)
],
),
);
}
}
},
controller:
_scrollController
,
child:
StreamBuilder
<
MyMessageEntity
>(
stream:
_messageModel
.
myMessageLive
.
stream
,
initialData:
_messageModel
.
myMessageLive
.
data
,
builder:
(
BuildContext
context
,
data
){
var
dataList
=
data
.
data
?.
data
;
if
(
dataList
==
null
)
{
return
Container
(
color:
ALColors
.
ColorFFFFFF
,
height:
ScreenUtil
().
setHeight
(
430
),
child:
Center
(
child:
Text
(
'暂无相关内容'
,
style:
TextStyle
(
color:
ALColors
.
Color999999
,
fontSize:
ScreenUtil
().
setSp
(
16
))))
);
}
print
(
'++++++====================
${dataList.length}
================='
);
return
ListView
.
builder
(
itemCount:
dataList
.
length
+
1
,
itemExtent:
50
,
itemBuilder:
(
BuildContext
context
,
int
index
)
{
print
(
'============
${index}
++++++++
${dataList.length}
============='
);
if
(
index
==
dataList
.
length
)
{
return
_loadingView
();
}
else
{
return
messageList
(
dataList
[
index
]);
}
},
controller:
_scrollController
,
);
},
)
)
]
),
),
)
);
}
topCard
(
latestMessageLive
){
topCard
(){
return
Container
(
color:
ALColors
.
ColorFFFFFF
,
child:
Column
(
children:
<
Widget
>[
messageTop
(
'images/message_noti.png'
,
'通知'
,
''
,
0
),
messageTop
(
'images/message_like.png'
,
'Like!'
,
'还没有人给你Like!哦~'
,
0
),
messageTop
(
'images/message_att.png'
,
'关注'
,
'还没有人给你关注哦~'
,
0
),
StreamBuilder
<
LatestMessageEntity
>(
stream:
_messageModel
.
latestMessageLive
.
stream
,
initialData:
_messageModel
.
latestMessageLive
.
data
,
builder:
(
BuildContext
context
,
data
){
var
content
=
data
.
data
?.
data
?.
content
??
'没有新的通知'
;
print
(
'-====================
${data.data.data.content}
================='
);
return
messageTop
(
'images/message_noti.png'
,
'通知'
,
content
==
''
?
'没有新的通知'
:
content
,
0
);
},
),
StreamBuilder
<
UnreadMessageEntity
>(
stream:
_messageModel
.
likeUnreadMessageLive
.
stream
,
initialData:
_messageModel
.
likeUnreadMessageLive
.
data
,
builder:
(
BuildContext
context
,
data
){
var
voteCount
=
data
.
data
?.
data
?.
voteCount
??
0
;
print
(
'-====================
${voteCount}
================='
);
return
messageTop
(
'images/message_like.png'
,
'Like!'
,
voteCount
==
0
?
'还没有人给你Like!哦~'
:
'有
$voteCount
个人Like!了你'
,
voteCount
);
},
),
StreamBuilder
<
UnreadMessageEntity
>(
stream:
_messageModel
.
followUnreadMessageLive
.
stream
,
initialData:
_messageModel
.
followUnreadMessageLive
.
data
,
builder:
(
BuildContext
context
,
data
){
var
count
=
data
.
data
?.
data
?.
count
??
0
;
print
(
'-====================
${count}
================='
);
return
messageTop
(
'images/message_att.png'
,
'关注'
,
count
==
0
?
'还没有人给你关注哦~'
:
'有
$count
个人关注了你'
,
count
);
},
),
Container
(
margin:
EdgeInsets
.
only
(
left:
ScreenUtil
().
setWidth
(
16
),
right:
ScreenUtil
().
setWidth
(
16
),
bottom:
ScreenUtil
().
setHeight
(
24
)),
height:
ScreenUtil
().
setHeight
(
12
),
...
...
lib/NewMessageModel/page/common.dart
View file @
09da21c9
import
'package:common_utils/common_utils.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:gmalpha_flutter/commonModel/ui/ALColors.dart'
;
messageTitle
(
String
text
)
{
return
Text
(
text
,
...
...
@@ -101,6 +103,7 @@ getNum([int count]) {
}
messageList
(
list
)
{
var
contentText
=
{
1
:
'评论了你'
,
2
:
'评论了你的评论'
,
3
:
'评论了你'
,
4
:
'评论了你的评论'
,
5
:
'关注了你的问题'
};
return
Container
(
padding:
EdgeInsets
.
only
(
left:
width
,
right:
width
),
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
().
setHeight
(
25
)),
...
...
@@ -118,7 +121,7 @@ messageList(list) {
decoration:
BoxDecoration
(
shape:
BoxShape
.
circle
,
image:
DecorationImage
(
image:
NetworkImage
(
'http://alpha-s.gmeiapp.com/2018/12/23/c909726bc2-w'
)
image:
NetworkImage
(
list
.
icon
)
),
),
),
...
...
@@ -131,7 +134,7 @@ messageList(list) {
Row
(
children:
<
Widget
>[
Text
(
'参白'
,
list
.
name
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
),
...
...
@@ -140,7 +143,7 @@ messageList(list) {
),
SizedBox
(
width:
ScreenUtil
().
setWidth
(
10
)),
Text
(
'评论了你'
,
contentText
[
list
.
repliedContent
?.
type
]
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
)
...
...
@@ -149,7 +152,7 @@ messageList(list) {
],
),
Text
(
'半框眼镜真的很搭配'
,
list
.
content
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
)
...
...
@@ -158,7 +161,11 @@ messageList(list) {
overflow:
TextOverflow
.
ellipsis
),
Text
(
'12小时'
,
// TimelineUtil.format(list.time,
// locTimeMillis: DateTime.now().millisecondsSinceEpoch,
// locale: 'zh',
// dayFormat: DayFormat.Full),
list
.
time
.
toString
(),
style:
TextStyle
(
color:
Color
(
0xfff8e8e8e
),
fontSize:
ScreenUtil
().
setSp
(
10
)
...
...
@@ -170,7 +177,7 @@ messageList(list) {
],
),
Image
.
network
(
'http://alpha-s.gmeiapp.com/2018/12/24/2b9fca0930-w'
,
list
.
repliedContent
.
content
,
width:
ScreenUtil
().
setWidth
(
48
),
fit:
BoxFit
.
fill
,
)
...
...
lib/NewMessageModel/util/Jump.dart
0 → 100644
View file @
09da21c9
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/page/MessagePage.dart'
;
void
jumpToMs
(
BuildContext
context
){
Navigator
.
push
(
context
,
new
MaterialPageRoute
(
builder:
(
context
)
=>
MessagePage
(
''
)
,
));
}
\ No newline at end of file
lib/PrestigeModel/page/reputation/ReputationsModel.dart
View file @
09da21c9
...
...
@@ -12,14 +12,19 @@ import 'package:gmalpha_flutter/commonModel/net/DioUtil.dart';
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
class
ReputationsModel
extends
BaseModel
{
LiveData
<
PrestigeEntity
>
prestigeLive
=
new
LiveData
()
;
LiveData
<
String
>
titleLive
=
new
LiveData
()
;
LiveData
<
PrestigeEntity
>
prestigeLive
;
LiveData
<
String
>
titleLive
;
final
int
userId
;
final
String
userName
;
final
String
fromPage
;
ReputationsModel
(
this
.
userId
,
this
.
userName
,
this
.
fromPage
);
ReputationsModel
(
this
.
userId
,
this
.
userName
,
this
.
fromPage
)
{
prestigeLive
=
new
LiveData
();
titleLive
=
new
LiveData
();
print
(
"lsy -->INIT!!!"
);
}
init
(
BuildContext
context
)
{
titleLive
.
notifyView
(
userName
);
...
...
@@ -37,5 +42,6 @@ class ReputationsModel extends BaseModel {
void
dispose
()
{
prestigeLive
.
dispost
();
titleLive
.
dispost
();
print
(
"lsy -->DISPOST!!!"
);
}
}
lib/PrestigeModel/page/reputation/ReputationsPage.dart
View file @
09da21c9
...
...
@@ -16,6 +16,7 @@ class ReputationsPage extends StatefulWidget {
ReputationsModel
_model
;
ReputationsPage
(
int
userId
,
String
userName
,
String
fromPage
)
{
print
(
"lsy --> ONEN PAGE"
);
_model
=
new
ReputationsModel
(
userId
,
userName
,
fromPage
);
}
...
...
@@ -60,7 +61,7 @@ class ReputationsState extends BasePage<ReputationsPage> {
RouterCenterImpl
()
.
findBuriedRouter
()
?.
onClick
(
pageName
(),
"return"
);
Navigator
.
pop
(
context
,
""
);
Navigator
.
pop
(
context
,
""
);
},
// child: Image.asset("images/nav_back.png"),
child:
Center
(
...
...
@@ -232,8 +233,8 @@ class ReputationsState extends BasePage<ReputationsPage> {
@override
void
dispose
()
{
super
.
dispose
();
_model
.
dispose
();
super
.
dispose
();
}
@override
...
...
lib/TestPage.dart
View file @
09da21c9
...
...
@@ -7,12 +7,13 @@ import 'package:flutter/material.dart';
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Api.dart'
;
import
'package:gmalpha_flutter/res/anim/Anim.dart'
;
class
TestPage
extends
StatelessWidget
{
TestPage
()
{
Api
.
getInstance
().
setDioCookie
({
'Cookie'
:
'sessionid=
iro2ke6i7rc9qselm7yogjf5xvgwzn1p; _gtid=203c91f8ebd811e981aa525400e82fab6765; _gm_token=2927681570850359
'
'sessionid=
k96qdzwb3bquf87g32kdfbn676jkfnmk; _gtid=6bcbb61eebf411e9bfa4525400e82fab7541; _gm_token=e0fc1c1570864112
'
});
}
...
...
@@ -27,62 +28,69 @@ class TestPage extends StatelessWidget {
presigePage
(
context
),
albumPage
(
context
),
userSettingPage
(
context
),
attentionPage
(
context
)
attentionPage
(
context
)
,
testMessagePage
(
context
),
],
),
));
}
base
(
BuildContext
context
,
Widget
page
,
String
itemName
)
{
base
(
BuildContext
context
,
VoidCallback
callback
,
String
itemName
)
{
return
Container
(
margin:
EdgeInsets
.
fromLTRB
(
16
,
16
,
16
,
0
),
child:
OutlineButton
(
onPressed:
()
{
Navigator
.
push
(
context
,
new
MaterialPageRoute
(
builder:
(
context
)
=>
page
,
));
},
onPressed:
callback
,
child:
Text
(
itemName
),
),
);
}
test
Report
Page
(
BuildContext
context
)
{
test
Message
Page
(
BuildContext
context
)
{
return
base
(
context
,
RouterCenterImpl
()
.
findActivityReportRouter
()
?.
getActivityReportPage
(
2
,
1
,
''
),
"报告页面"
);
.
findNewMessageRouter
()
?.
getMessagePage
(
''
),
"消息页面"
);
}
testReportPage
(
BuildContext
context
)
{
return
base
(
context
,
()
{
Navigator
.
push
(
context
,
new
CustomRoute
(
RouterCenterImpl
()
.
findActivityReportRouter
()
?.
getActivityReportPage
(
300
,
1
,
''
)));
},
"报告页面"
);
}
presigePage
(
BuildContext
context
)
{
return
base
(
context
,
RouterCenterImpl
()
.
findPrestigeRouter
()
?.
getReputationsPage
(
1
,
"ww"
,
"ww"
),
"专家声望页面"
);
return
base
(
context
,
()
{
Navigator
.
push
(
context
,
new
CustomRoute
(
RouterCenterImpl
()
.
findPrestigeRouter
()
?.
getReputationsPage
(
1
,
"ww"
,
"ww"
)));
},
"专家声望页面"
);
}
albumPage
(
BuildContext
context
)
{
return
base
(
context
,
RouterCenterImpl
().
findAlbumRouter
()?.
getAlbumPage
(
"com.example.gengmei_flutter_plugin_example"
,
true
,
1
,
null
),
"相册页面"
);
return
base
(
context
,
()
{
Navigator
.
push
(
context
,
new
CustomRoute
(
RouterCenterImpl
().
findAlbumRouter
()?.
getAlbumPage
(
"com.example.gengmei_flutter_plugin_example"
,
true
,
1
,
null
)));
},
"相册页面"
);
}
userSettingPage
(
BuildContext
context
)
{
return
base
(
context
,
RouterCenterImpl
()
.
findUserRouter
()
?.
getUserSettingPage
(
"241765327"
,
"NULL"
),
"设置页面"
);
return
base
(
context
,
()
{
Navigator
.
push
(
context
,
new
CustomRoute
(
RouterCenterImpl
()
.
findUserRouter
()
?.
getUserSettingPage
(
"241765462"
,
"NULL"
)));
},
"设置页面"
);
}
attentionPage
(
BuildContext
context
)
{
...
...
lib/commonModel/base/BaseUtil.dart
0 → 100644
View file @
09da21c9
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/material.dart'
;
void
jumpToPage
(
Widget
page
,
BuildContext
context
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
((
context
)
{
return
page
;
})));
}
lib/commonModel/live/LiveData.dart
View file @
09da21c9
...
...
@@ -9,6 +9,7 @@ class LiveData<T> {
T
data
;
LiveData
()
{
print
(
"!!!!
${_controller == null}
"
);
this
.
_controller
=
new
StreamController
<
T
>();
}
...
...
@@ -22,6 +23,7 @@ class LiveData<T> {
}
void
dispost
()
{
data
=
null
;
_controller
.
close
();
}
}
lib/commonModel/net/DioUtil.dart
View file @
09da21c9
...
...
@@ -6,70 +6,6 @@ import 'package:gmalpha_flutter/commonModel/toast/toast.dart';
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
/// <BaseResp<T> 返回 status code msg data.
class
BaseResp
<
T
>
{
String
status
;
int
code
;
String
msg
;
T
data
;
T
extra
;
T
userType
;
BaseResp
(
this
.
status
,
this
.
code
,
this
.
msg
,
this
.
data
,
this
.
extra
,
this
.
userType
);
@override
String
toString
()
{
StringBuffer
sb
=
new
StringBuffer
(
'{'
);
sb
.
write
(
"
\"
status
\"
:
\"
$status
\"
"
);
sb
.
write
(
",
\"
code
\"
:
$code
"
);
sb
.
write
(
",
\"
msg
\"
:
\"
$msg
\"
"
);
sb
.
write
(
",
\"
data
\"
:
\"
$data
\"
"
);
sb
.
write
(
",
\"
extra
\"
:
\"
$extra
\"
"
);
sb
.
write
(
",
\"
userType
\"
:
\"
$userType
\"
"
);
sb
.
write
(
'}'
);
return
sb
.
toString
();
}
}
/// <BaseRespR<T> 返回 status code msg data Response.
class
BaseRespR
<
T
>
{
String
status
;
int
code
;
String
msg
;
T
data
;
T
extra
;
T
userType
;
Response
response
;
BaseRespR
(
this
.
status
,
this
.
code
,
this
.
msg
,
this
.
data
,
this
.
extra
,
this
.
userType
,
this
.
response
);
@override
String
toString
()
{
StringBuffer
sb
=
new
StringBuffer
(
'{'
);
sb
.
write
(
"
\"
status
\"
:
\"
$status
\"
"
);
sb
.
write
(
",
\"
code
\"
:
$code
"
);
sb
.
write
(
",
\"
msg
\"
:
\"
$msg
\"
"
);
sb
.
write
(
",
\"
data
\"
:
\"
$data
\"
"
);
sb
.
write
(
",
\"
extra
\"
:
\"
$extra
\"
"
);
sb
.
write
(
",
\"
userType
\"
:
\"
$userType
\"
"
);
sb
.
write
(
'}'
);
return
sb
.
toString
();
;
}
}
/// 请求方法.
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"
;
}
///Http配置.
class
HttpConfig
{
/// constructor.
...
...
@@ -179,7 +115,7 @@ class DioUtil {
});
}
},
onResponse:
(
response
)
{
print
(
"响应之前"
);
print
(
"响应之前
response
${response}
"
);
},
onError:
(
e
)
{
print
(
"网络错误
$e
message
${e.message}
"
);
});
...
...
@@ -253,6 +189,7 @@ class DioUtil {
*/
Future
<
Response
>
get
(
url
,
{
data
,
options
,
cancelToken
})
async
{
Response
response
;
print
(
"GET===> URL:
$url
data:
$data
"
);
try
{
response
=
await
_dio
.
get
(
url
,
queryParameters:
data
,
options:
options
,
cancelToken:
cancelToken
);
...
...
@@ -275,9 +212,12 @@ class DioUtil {
*/
Future
<
Response
>
post
(
url
,
{
data
,
options
,
cancelToken
})
async
{
Response
response
;
print
(
"POST===> URL:
$url
data:
$data
"
);
try
{
response
=
await
_dio
.
post
(
url
,
queryParameters:
data
,
options:
options
,
cancelToken:
cancelToken
);
data:
FormData
.
from
(
data
),
options:
options
,
cancelToken:
cancelToken
);
print
(
'post success---------
${response.statusCode}
${response.data}
'
);
}
on
DioError
catch
(
e
)
{
print
(
'post error---------
$e
message
${e.message}
'
);
...
...
@@ -305,60 +245,6 @@ class DioUtil {
return
response
.
data
;
}
Future
<
BaseRespR
<
T
>>
requestR
<
T
>(
String
method
,
String
path
,
{
data
,
Options
options
,
CancelToken
cancelToken
})
async
{
Response
response
=
await
_dio
.
request
(
path
,
data:
data
,
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
,
));
}
void
formatError
(
DioError
e
)
{
String
reason
=
""
;
if
(
e
.
type
==
DioErrorType
.
CONNECT_TIMEOUT
)
{
...
...
@@ -400,16 +286,6 @@ class DioUtil {
cancelToken:
cancelToken
,
data:
data
,
options:
options
);
}
/// decode response data.
Map
<
String
,
dynamic
>
_decodeData
(
Response
response
)
{
if
(
response
==
null
||
response
.
data
==
null
||
response
.
data
.
toString
().
isEmpty
)
{
return
new
Map
();
}
return
json
.
decode
(
response
.
data
.
toString
());
}
/// check Options.
Options
_checkOptions
(
method
,
options
)
{
if
(
options
==
null
)
{
...
...
@@ -509,16 +385,6 @@ class DioUtil {
return
dio
;
}
static
String
getBaseUrl
()
{
// if (inProduction) {
// //正式环境的
// return APP_HOST_RELEASE;
// } else {
// return APP_HOST_DEBUG;
// }
return
APP_HOST_DEBUG
;
}
/// get Def Options.
static
BaseOptions
getDefOptions
()
{
BaseOptions
options
=
BaseOptions
();
...
...
@@ -527,9 +393,7 @@ class DioUtil {
// options.contentType = ContentType.parse('application/x-www-form-urlencoded');
options
.
contentType
=
ContentType
.
json
;
options
.
responseType
=
ResponseType
.
plain
;
// options.baseUrl = 'https://earth.iyanzhi.com/';
// options.baseUrl = 'http://earth.gmapp.env/';
options
.
baseUrl
=
getBaseUrl
()
+
"/"
;
options
.
baseUrl
=
APP_HOST_DEBUG
+
"/"
;
Map
<
String
,
dynamic
>
headers
=
Map
<
String
,
dynamic
>();
headers
[
'Accept'
]
=
'application/json'
;
headers
[
'version'
]
=
'1.0.0'
;
...
...
lib/main.dart
View file @
09da21c9
...
...
@@ -12,7 +12,6 @@ import 'package:gmalpha_flutter/commonModel/cache/CacheManager.dart';
import
'package:gmalpha_flutter/commonModel/net/Api.dart'
;
import
'package:gmalpha_flutter/messageModel/home/message_home.dart'
;
import
'comment_suggest.dart'
;
void
main
(
)
{
initParams
(()
=>
runApp
(
MyApp
()));
...
...
@@ -28,7 +27,6 @@ class _MyAppState extends State<MyApp> {
void
initState
()
{
super
.
initState
();
FlutterBoost
.
singleton
.
registerPageBuilders
({
'comment_suggest'
:
(
pageName
,
params
,
_
)
=>
CommentSuggest
(
params
),
'message_home'
:
(
pageName
,
params
,
_
)
=>
MessageHomePage
(
params
),
'album'
:
(
pageName
,
params
,
_
)
{
if
(
params
==
null
)
{
...
...
lib/res/anim/Anim.dart
0 → 100644
View file @
09da21c9
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/material.dart'
;
class
CustomRoute
extends
PageRouteBuilder
{
final
Widget
widget
;
CustomRoute
(
this
.
widget
)
:
super
(
// 设置过度时间
transitionDuration:
Duration
(
milliseconds:
500
),
// 构造器
pageBuilder:
(
// 上下文和动画
BuildContext
context
,
Animation
<
double
>
animaton1
,
Animation
<
double
>
animaton2
,
){
return
widget
;
},
transitionsBuilder:
(
BuildContext
context
,
Animation
<
double
>
animaton1
,
Animation
<
double
>
animaton2
,
Widget
child
,
){
// 需要什么效果把注释打开就行了
// 渐变效果
// return FadeTransition(
// // 从0开始到1
// opacity: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// // 传入设置的动画
// parent: animaton1,
// // 设置效果,快进漫出 这里有很多内置的效果
// curve: Curves.fastOutSlowIn,
// )),
// child: child,
// );
// 缩放动画效果
// return ScaleTransition(
// scale: Tween(begin: 0.0,end: 1.0).animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn
// )),
// child: child,
// );
// 旋转加缩放动画效果
// return RotationTransition(
// turns: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn,
// )),
// child: ScaleTransition(
// scale: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn
// )),
// child: child,
// ),
// );
// 左右滑动动画效果
return
SlideTransition
(
position:
Tween
<
Offset
>(
// 设置滑动的 X , Y 轴
begin:
Offset
(
1.0
,
0.0
),
end:
Offset
(
0.0
,
0.0
)
).
animate
(
CurvedAnimation
(
parent:
animaton1
,
curve:
Curves
.
fastOutSlowIn
)),
child:
child
,
);
}
);
}
\ No newline at end of file
lib/userModel/page/comment/CommentModel.dart
0 → 100644
View file @
09da21c9
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/cupertino.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/live/BaseModel.dart'
;
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
import
'package:gmalpha_flutter/userModel/service/UserRepository.dart'
;
class
CommentModel
extends
BaseModel
{
String
refer
;
CommentModel
(
this
.
refer
)
{}
@override
void
dispose
()
{}
void
confirmClick
(
BuildContext
context
,
String
content
,
String
phone
)
{
RouterCenterImpl
()
.
findBuriedRouter
()
?.
onEvent
(
'click_comment_suggest'
,
{
'comment_id'
:
'10086'
});
UserRepository
.
getInstance
().
commentSuggest
(
content
,
phone
).
listen
((
value
)
{
Toast
.
show
(
context
,
"提交成功"
);
Navigator
.
pop
(
context
);
}).
onError
((
error
)
{
Toast
.
show
(
context
,
"提交失败"
);
Toast
.
debugShow
(
context
,
error
.
message
);
print
(
error
.
message
);
});
}
}
lib/
comment_suggest
.dart
→
lib/
userModel/page/comment/CommentSuggestPage
.dart
View file @
09da21c9
...
...
@@ -9,77 +9,40 @@
import
'package:dio/dio.dart'
;
import
'package:flutter_boost/flutter_boost.dart'
;
import
'package:flutter/material.dart'
;
import
'commonModel/ui/ALColors.dart'
;
import
'commonModel/ui/ALDevice.dart'
;
import
'commonModel/net/DioUtil.dart'
;
import
'commonModel/toast/toast.dart'
;
//import 'package:native_flutter_transfer_plugin/native_flutter_transfer_plugin.dart';
class
CommentSuggest
extends
StatelessWidget
{
final
Map
params
;
CommentSuggest
(
this
.
params
);
Widget
build
(
BuildContext
context
)
{
return
MaterialApp
(
debugShowCheckedModeBanner:
false
,
title:
'意见与建议'
,
color:
Color
(
0xFFffffff
),
theme:
ThemeData
(
splashColor:
Colors
.
white10
,
//水波纹的颜色
),
home:
CommentSuggestPage
(
nativeCookie:
this
.
params
,
title:
'意见与建议'
,)
);
import
'package:gmalpha_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BasePage.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseState.dart'
;
import
'package:gmalpha_flutter/userModel/page/comment/CommentModel.dart'
;
import
'../../../commonModel/ui/ALColors.dart'
;
import
'../../../commonModel/ui/ALDevice.dart'
;
class
CommentSuggestPage
extends
StatefulWidget
{
var
_model
;
CommentSuggestPage
(
String
refer
)
{
_model
=
CommentModel
(
refer
);
}
}
class
CommentSuggestPage
extends
StatefulWidget
{
final
String
title
;
final
Map
nativeCookie
;
CommentSuggestPage
({
Key
key
,
this
.
title
,
this
.
nativeCookie
})
:
super
(
key:
key
);
@override
_CommentSuggestPageState
createState
()
=>
_CommentSuggestPageState
(
);
State
<
StatefulWidget
>
createState
()
=>
_CommentSuggestPageState
(
_model
);
}
class
_CommentSuggestPageState
extends
Stat
e
<
CommentSuggestPage
>
{
class
_CommentSuggestPageState
extends
BasePag
e
<
CommentSuggestPage
>
{
TextEditingController
opinionCtrl
=
TextEditingController
();
TextEditingController
telCtrl
=
TextEditingController
();
CommentModel
_model
;
_CommentSuggestPageState
(
this
.
_model
);
@override
Widget
build
(
BuildContext
context
)
{
return
Scaffold
(
appBar:
AppBar
(
backgroundColor:
Color
(
0xFFffffff
),
title:
Text
(
'意见与建议'
,
style:
new
TextStyle
(
fontSize:
16.0
,
color:
ALColors
.
Color323232
),
),
elevation:
0
,
brightness:
Brightness
.
light
,
leading:
new
GestureDetector
(
child:
new
ImageIcon
(
AssetImage
(
'images/nav_back.png'
),
color:
ALColors
.
Color323232
,
),
onTap:
()
{
print
(
'123-------'
);
// FlutterBoost.singleton.closePageForContext(context);
FlutterBoost
.
singleton
.
closePageForContext
(
context
);
}),
),
// floatingActionButton: new FloatingActionButton(
// onPressed: () {
// print('33333-------');
// FlutterBoost.singleton.openPage('second', {});
// },
// child: new Icon(Icons.add_box),
// elevation: 3.0,
// highlightElevation: 2.0,
// backgroundColor: Colors.red, // 红色
// ),
appBar:
baseAppBar
(
title:
'意见与建议'
,
backClick:
()
{
Navigator
.
pop
(
context
);
}),
body:
new
SingleChildScrollView
(
child:
Center
(
child:
Column
(
...
...
@@ -114,7 +77,7 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
margin:
EdgeInsets
.
only
(
left:
30
,
right:
30
,
top:
40
),
// padding: EdgeInsets.only(bottom: 10),
decoration:
BoxDecoration
(
border:
Border
(
border:
Border
(
bottom:
BorderSide
(
color:
ALColors
.
ColorC4C4C4
),
)),
alignment:
Alignment
.
centerLeft
,
...
...
@@ -138,12 +101,16 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
decoration:
BoxDecoration
(
border:
Border
.
all
(
color:
ALColors
.
Color323232
,
width:
1.5
)),
margin:
EdgeInsets
.
only
(
left:
30
,
right:
30
,
bottom:
30
,
top:
180
),
margin:
EdgeInsets
.
only
(
left:
30
,
right:
30
,
bottom:
30
,
top:
180
),
// padding: EdgeInsets.all(0),
constraints:
BoxConstraints
(
minWidth:
ALDevice
.
width
,
minHeight:
45
),
child:
FlatButton
(
onPressed:
confirmClick
,
onPressed:
()
{
_model
.
confirmClick
(
context
,
opinionCtrl
.
text
??
""
,
telCtrl
.
text
??
""
);
},
child:
Text
(
'提交'
,
style:
...
...
@@ -157,44 +124,20 @@ class _CommentSuggestPageState extends State<CommentSuggestPage> {
));
}
@override
void
di
dUpdateWidget
(
CommentSuggestPage
oldWidget
)
{
super
.
di
dUpdateWidget
(
oldWidget
);
print
(
'aaaaaaaaa--------'
);
print
(
oldWidget
);
@override
void
di
spose
(
)
{
super
.
di
spose
(
);
opinionCtrl
.
dispose
(
);
telCtrl
.
dispose
(
);
}
void
confirmClick
()
{
// NativeFlutterTransferPlugin.track('click_comment_suggest', {'comment_id': '10086'});
confimSuggestInfo
();
@override
String
pageName
()
{
return
"comment_arguement"
;
}
void
confimSuggestInfo
()
{
BaseOptions
options
=
DioUtil
.
getDefOptions
();
final
cookie
=
new
Map
<
String
,
dynamic
>.
from
(
widget
.
nativeCookie
);
HttpConfig
config
=
new
HttpConfig
(
options:
options
,
nativeCookie:
cookie
);
DioUtil
().
setConfig
(
config
);
String
content
=
(
this
.
opinionCtrl
.
text
.
length
>
0
)?
this
.
opinionCtrl
.
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
){
if
(
res
.
code
==
0
)
{
Toast
.
show
(
context
,
'提交成功'
);
FlutterBoost
.
singleton
.
closePageForContext
(
context
);
}
else
{
Toast
.
show
(
context
,
res
.
msg
);
}
}
).
then
((
error
){
if
(
error
!=
null
)
{
Toast
.
show
(
context
,
'提交失败'
);
print
(
error
);
}
else
{
// FlutterBoost.singleton.closePageForContext(context);
}
});
@override
String
referrer
()
{
return
_model
.
refer
;
}
}
lib/userModel/page/userSetting/UserSettingModel.dart
View file @
09da21c9
...
...
@@ -4,6 +4,9 @@
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/commonModel/base/BaseUtil.dart'
;
import
'package:gmalpha_flutter/commonModel/live/BaseModel.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/commonModel/toast/toast.dart'
;
...
...
@@ -25,34 +28,42 @@ class UserSettingModel extends BaseModel {
UserSettingModel
(
this
.
userid
,
this
.
refere
);
init
(
BuildContext
context
)
{
if
(
UserEntityImpl
().
getuserId
()
==
null
||
UserEntityImpl
().
getuserId
()
!=
userid
)
{
UserRepository
.
getInstance
().
getUserInfo
(
userid
).
listen
((
data
)
{
print
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
show
(
context
,
"error"
);
});
}
else
{
UserEntityImpl
().
getnickName
().
listen
((
data
)
{
nameLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getcountryInfoName
().
listen
((
data
)
{
cityLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getprofilePic
().
listen
((
value
)
{
headImgLive
.
notifyView
(
value
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
}
UserEntityImpl
().
getuserId
().
listen
((
value
)
{
print
(
"VALUEE
$value
"
);
if
(
value
==
null
||
value
!=
userid
)
{
UserRepository
.
getInstance
().
getUserInfo
(
userid
).
listen
((
data
)
{
print
(
data
);
nameLive
.
notifyView
(
data
?.
data
?.
nickName
);
cityLive
.
notifyView
(
data
?.
data
?.
countryInfo
?.
name
);
headImgLive
.
notifyView
(
data
?.
data
?.
profilePic
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
show
(
context
,
error
);
});
}
else
{
UserEntityImpl
().
getnickName
().
listen
((
data
)
{
print
(
"NICK
$data
"
);
nameLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getcountryInfoName
().
listen
((
data
)
{
print
(
"con
$data
"
);
cityLive
.
notifyView
(
data
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
UserEntityImpl
().
getprofilePic
().
listen
((
value
)
{
print
(
"head
$value
"
);
headImgLive
.
notifyView
(
value
);
}).
onError
((
error
)
{
print
(
error
);
Toast
.
debugShow
(
context
,
error
);
});
}
});
}
@override
...
...
@@ -62,6 +73,4 @@ class UserSettingModel extends BaseModel {
cityLive
.
dispost
();
saveLive
.
dispost
();
}
void
gotoCommentPage
(
BuildContext
context
)
{}
}
lib/userModel/page/userSetting/UserSettingPage.dart
View file @
09da21c9
...
...
@@ -14,6 +14,7 @@ import 'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart';
import
'package:gmalpha_flutter/userModel/page/userSetting/UserSettingModel.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/util/JumpUtil.dart'
;
class
UserSettingPage
extends
StatefulWidget
{
UserSettingModel
_model
;
...
...
@@ -153,7 +154,7 @@ class UserState extends BasePage<UserSettingPage> {
true
),
divideLine
(),
baseItem
(()
{
_model
.
gotoCommentPage
(
context
);
jumpToComment
(
context
,
pageName
()
);
},
"意见与建议"
,
null
,
true
),
divideLine
(),
baseItem
(()
{},
"隐私声明"
,
null
,
true
),
...
...
@@ -165,7 +166,7 @@ class UserState extends BasePage<UserSettingPage> {
),
Container
(
width:
double
.
maxFinite
,
height:
ScreenUtil
.
instance
.
setHeight
(
45
)
,
height:
45
,
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
.
instance
.
setHeight
(
30
),
left:
ScreenUtil
.
instance
.
setWidth
(
30
),
...
...
@@ -173,7 +174,7 @@ class UserState extends BasePage<UserSettingPage> {
child:
OutlineButton
(
onPressed:
()
{},
child:
baseText
(
"退出登入"
,
14
,
0xff323232
),
borderSide:
new
BorderSide
(
color:
Color
(
0xff323232
)),
borderSide:
new
BorderSide
(
color:
Color
(
0xff323232
)),
),
)
],
...
...
@@ -194,17 +195,17 @@ class UserState extends BasePage<UserSettingPage> {
baseItem
(
VoidCallback
ontap
,
String
left
,
Widget
center
,
bool
needRight
)
{
return
GestureDetector
(
onTap:
()
=>
ontap
,
onTap:
()
=>
ontap
()
,
child:
Container
(
margin:
EdgeInsets
.
only
(
right:
ScreenUtil
.
instance
.
setWidth
(
30
),
left:
ScreenUtil
.
instance
.
setWidth
(
30
)),
height:
ScreenUtil
.
instance
.
setHeight
(
60
)
,
height:
60
,
child:
Row
(
children:
<
Widget
>[
baseText
(
left
,
13
,
0xff323232
),
Expanded
(
child:
Container
(),
child:
SizedBox
(),
),
center
??
Container
(),
needRight
...
...
lib/userModel/service/UserRepository.dart
View file @
09da21c9
...
...
@@ -5,6 +5,7 @@
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/userModel/service/local/UserLocal.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/UserRemote.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.user.dart'
;
...
...
@@ -37,4 +38,8 @@ class UserRepository {
return
value
;
});
}
Observable
<
CommentBean
>
commentSuggest
(
String
content
,
String
phone
)
{
return
_remote
.
commentSuggest
(
content
,
phone
);
}
}
lib/userModel/service/remote/UserRemote.dart
View file @
09da21c9
...
...
@@ -4,6 +4,7 @@
**/
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/api/UserApi.serv.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.dart'
;
...
...
@@ -24,4 +25,8 @@ class UserRemote {
Observable
<
UserResultBean
>
getUserInfo
(
String
userID
)
{
return
UserApiImpl
().
getUserInfo
(
userID
);
}
Observable
<
CommentBean
>
commentSuggest
(
String
content
,
String
phone
)
{
return
UserApiImpl
().
comment
(
content
,
phone
);
}
}
lib/userModel/service/remote/api/UserApi.dart
View file @
09da21c9
...
...
@@ -7,6 +7,7 @@ import 'package:gmalpha_flutter/Annotations/anno/Post.dart';
import
'package:gmalpha_flutter/Annotations/anno/Query.dart'
;
import
'package:gmalpha_flutter/Annotations/anno/ServiceCenter.dart'
;
import
'package:gmalpha_flutter/commonModel/net/Responce/SimpleResponce.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/TestUserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserEntity.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.dart'
;
...
...
@@ -15,4 +16,7 @@ import 'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.d
abstract
class
UserApi
{
@Get
(
"api/account/user_profile"
)
UserResultBean
getUserInfo
(
@Query
(
"user_id"
)
String
userID
);
@Post
(
"api/v1/suggestion"
)
CommentBean
comment
(
@Query
(
"content"
)
String
content
,
@Query
(
"phone"
)
String
phone
);
}
lib/userModel/service/remote/api/UserApi.serv.dart
View file @
09da21c9
...
...
@@ -11,6 +11,7 @@ import 'dart:io';
import
'package:rxdart/rxdart.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/UserResultBean.dart'
;
import
'package:gmalpha_flutter/userModel/service/remote/entity/CommentBean.dart'
;
import
'package:gmalpha_flutter/commonModel/net/DioUtil.dart'
;
...
...
@@ -37,4 +38,14 @@ class UserApiImpl {
}
});
}
Observable
<
CommentBean
>
comment
(
String
content
,
String
phone
)
{
return
Observable
.
fromFuture
(
DioUtil
().
post
(
'api/v1/suggestion'
,
data:
{
'content'
:
content
,
'phone'
:
phone
})).
map
((
value
)
{
if
(
value
!=
null
&&
value
.
statusCode
==
200
)
{
Map
map
=
json
.
decode
(
value
.
toString
());
return
CommentBean
.
fromJson
(
map
);
}
});
}
}
lib/userModel/service/remote/entity/CommentBean.dart
0 → 100644
View file @
09da21c9
/*
* @author lsy
* @date 2019-10-14
**/
class
CommentBean
{
int
error
;
String
message
;
Null
extra
;
UserType
userType
;
Data
data
;
CommentBean
({
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
userType
,
this
.
data
});
CommentBean
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
error
=
json
[
'error'
];
message
=
json
[
'message'
];
extra
=
json
[
'extra'
];
userType
=
json
[
'user_type'
]
!=
null
?
new
UserType
.
fromJson
(
json
[
'user_type'
])
:
null
;
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'error'
]
=
this
.
error
;
data
[
'message'
]
=
this
.
message
;
data
[
'extra'
]
=
this
.
extra
;
if
(
this
.
userType
!=
null
)
{
data
[
'user_type'
]
=
this
.
userType
.
toJson
();
}
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
return
data
;
}
}
class
Data
{
Data
();
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
}
}
class
UserType
{
UserType
();
UserType
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
}
}
lib/userModel/service/remote/entity/UserEntity.dart
View file @
09da21c9
...
...
@@ -24,88 +24,93 @@ class UserEntity {
*/
@User
(
USER_ID
,
""
)
String
userId
;
/**
* 用户昵称
*/
@User
(
NICKNAME
,
""
)
String
nickName
;
/**
* 用户头像
*/
@User
(
PORTRAIT
,
""
)
@User
(
PORTRAIT
,
""
)
String
profilePic
;
/**
* 是否需要答题
*/
@User
(
PERSONAL_QA
,
true
)
@User
(
PERSONAL_QA
,
true
)
bool
hasAnswered
=
true
;
/**
* 是否扫过脸
*/
@User
(
HAS_SCAN_FACE
,
true
)
@User
(
HAS_SCAN_FACE
,
true
)
bool
hasScanFace
=
false
;
String
id
;
@User
(
GENDER
,
""
)
@User
(
GENDER
,
""
)
String
gender
;
@User
(
CURRENT_CITY_ID
,
""
)
@User
(
CURRENT_CITY_ID
,
""
)
String
cityId
;
@User
(
BIRTHDAY
,
0
)
int
birth
;
@User
(
BIRTHDAY
,
0.
0
)
double
birth
;
@User
(
COUNTRY_ID
,
""
)
@User
(
COUNTRY_ID
,
""
)
String
countryId
;
bool
logined
;
// 用户是否设置过个人信息
@User
(
DETAIL_SETTED
,
true
)
@User
(
DETAIL_SETTED
,
true
)
bool
detailSetted
=
true
;
//用户是否选择了标签
bool
tagSetted
=
false
;
//注册流程中断后返回之前的登录页面
@User
(
QUESTION_URL
,
""
)
@User
(
QUESTION_URL
,
""
)
String
questionUrl
;
@User
(
USER_BIND_MOBILE
,
true
)
@User
(
USER_BIND_MOBILE
,
true
)
bool
isBind
;
@User
(
COUNTRY_NAME
,
""
)
@User
(
COUNTRY_NAME
,
""
)
String
countryInfoName
;
@User
(
COUNTRY_ID
,
""
)
@User
(
COUNTRY_ID
,
""
)
String
countryInfoId
;
@User
(
COUNTRY_LANGUAGE
,
""
)
@User
(
COUNTRY_LANGUAGE
,
""
)
String
countryInfoLanguage
;
String
insBindId
;
String
registerTime
;
UserEntity
(
{
this
.
userId
,
this
.
nickName
,
this
.
profilePic
,
this
.
hasAnswered
,
this
.
hasScanFace
,
this
.
id
,
this
.
gender
,
this
.
cityId
,
this
.
birth
,
this
.
countryId
,
this
.
logined
,
this
.
detailSetted
,
this
.
tagSetted
,
this
.
questionUrl
,
this
.
isBind
,
this
.
countryInfoName
,
this
.
countryInfoId
,
this
.
countryInfoLanguage
,
this
.
insBindId
,
this
.
registerTime
});
this
.
nickName
,
this
.
profilePic
,
this
.
hasAnswered
,
this
.
hasScanFace
,
this
.
id
,
this
.
gender
,
this
.
cityId
,
this
.
birth
,
this
.
countryId
,
this
.
logined
,
this
.
detailSetted
,
this
.
tagSetted
,
this
.
questionUrl
,
this
.
isBind
,
this
.
countryInfoName
,
this
.
countryInfoId
,
this
.
countryInfoLanguage
,
this
.
insBindId
,
this
.
registerTime
});
UserEntity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
userId
=
json
[
'user_id'
];
...
...
@@ -154,5 +159,4 @@ class UserEntity {
data
[
'register_time'
]
=
this
.
registerTime
;
return
data
;
}
}
lib/userModel/service/remote/entity/UserEntity.user.dart
View file @
09da21c9
...
...
@@ -22,6 +22,7 @@ class UserEntityImpl {
}
SpUtil
spUtil
=
SpUtil
.
getInstance
();
String
_userId
;
Observable
<
bool
>
saveuserId
(
String
userId
)
{
return
Observable
.
fromFuture
(
spUtil
.
saveStringKv
(
"user_uid"
,
userId
))
...
...
@@ -149,9 +150,9 @@ class UserEntityImpl {
return
Observable
.
fromFuture
(
spUtil
.
getStringKv
(
"current_city_id"
));
}
int
_birth
;
Observable
<
bool
>
savebirth
(
int
birth
)
{
return
Observable
.
fromFuture
(
spUtil
.
save
Int
Kv
(
"birthday"
,
birth
))
double
_birth
;
Observable
<
bool
>
savebirth
(
double
birth
)
{
return
Observable
.
fromFuture
(
spUtil
.
save
Double
Kv
(
"birthday"
,
birth
))
.
map
((
value
)
{
if
(
value
)
{
this
.
_birth
=
birth
;
...
...
@@ -160,11 +161,11 @@ class UserEntityImpl {
});
}
Observable
<
int
>
getbirth
()
{
Observable
<
double
>
getbirth
()
{
if
(
_birth
!=
null
)
{
return
Observable
.
fromFuture
(
Future
.
value
(
_birth
));
}
return
Observable
.
fromFuture
(
spUtil
.
get
Int
Kv
(
"birthday"
));
return
Observable
.
fromFuture
(
spUtil
.
get
Double
Kv
(
"birthday"
));
}
String
_countryId
;
...
...
lib/userModel/service/remote/entity/UserResultBean.dart
View file @
09da21c9
...
...
@@ -2,7 +2,6 @@
* @author lsy
* @date 2019-10-12
**/
class
UserResultBean
{
int
error
;
String
message
;
...
...
@@ -47,7 +46,7 @@ class Data {
int
gender
;
Null
age
;
Null
cityId
;
int
birth
;
double
birth
;
double
registerTime
;
bool
isBind
;
bool
logined
;
...
...
lib/userModel/util/JumpUtil.dart
0 → 100644
View file @
09da21c9
/*
* @author lsy
* @date 2019-10-14
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gmalpha_flutter/res/anim/Anim.dart'
;
import
'package:gmalpha_flutter/userModel/page/comment/CommentSuggestPage.dart'
;
void
jumpToComment
(
BuildContext
context
,
String
refer
)
{
Navigator
.
push
(
context
,
new
CustomRoute
(
CommentSuggestPage
(
refer
)));
}
pubspec.lock
View file @
09da21c9
...
...
@@ -113,6 +113,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.11"
common_utils:
dependency: "direct main"
description:
name: common_utils
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.3"
convert:
dependency: transitive
description:
...
...
@@ -155,6 +162,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.7"
decimal:
dependency: transitive
description:
name: decimal
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.5"
dio:
dependency: "direct main"
description:
...
...
@@ -447,6 +461,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.3"
rational:
dependency: transitive
description:
name: rational
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.6"
rxdart:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
09da21c9
...
...
@@ -31,6 +31,7 @@ dependencies:
# gengmei_flutter_plugin: ^0.0.731
cached_network_image
:
^1.1.1
flutter_screenutil
:
^0.5.3
common_utils
:
^1.1.3
gengmei_flutter_plugin
:
git
:
url
:
'
git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git'
...
...
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