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
d3a54528
Commit
d3a54528
authored
Oct 30, 2019
by
何碧荣
Browse files
Options
Browse Files
Download
Plain Diff
解决冲突
parents
0968a395
2fa3f27c
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
281 additions
and
21 deletions
+281
-21
common.dart
lib/NewMessageModel/page/common.dart
+236
-0
LikeListItem.dart
lib/NewMessageModel/page/likePage/LikeListItem.dart
+45
-21
No files found.
lib/NewMessageModel/page/common.dart
0 → 100644
View file @
d3a54528
import
'package:flutter/cupertino.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:flutter_svg/flutter_svg.dart'
;
import
'package:gmalpha_flutter/Annotations/RouterCenterRestore.mark.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/util/message_date.dart'
;
import
'package:gmalpha_flutter/commonModel/base/AppBase.dart'
;
import
'package:gmalpha_flutter/res/value/ALColors.dart'
;
messageTitle
(
String
text
)
{
return
Text
(
text
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
20
)
)
);
}
var
width
=
ScreenUtil
().
setWidth
(
16
);
Widget
messageTop
(
imgUrl
,
title
,
content
,
count
)
{
var
height
=
ScreenUtil
().
setHeight
(
12
);
return
Container
(
padding:
EdgeInsets
.
only
(
left:
width
,
right:
width
),
width:
double
.
infinity
,
child:
Stack
(
children:
<
Widget
>[
Container
(
padding:
EdgeInsets
.
only
(
left:
ScreenUtil
().
setWidth
(
28
)),
margin:
EdgeInsets
.
only
(
left:
ScreenUtil
().
setWidth
(
4
),
top:
height
,
bottom:
height
),
width:
double
.
infinity
,
decoration:
BoxDecoration
(
color:
ALColors
.
ColorFFFFFF
,
image:
DecorationImage
(
image:
AssetImage
(
imgUrl
),
alignment:
Alignment
.
centerLeft
)
),
child:
Row
(
children:
<
Widget
>[
Text
(
title
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
),
fontWeight:
FontWeight
.
bold
)
),
SizedBox
(
width:
ScreenUtil
().
setWidth
(
16
),
),
Container
(
width:
ScreenUtil
().
setWidth
(
200
),
child:
Text
(
content
,
style:
TextStyle
(
color:
ALColors
.
Color8E8E8E
,
fontSize:
ScreenUtil
().
setSp
(
13
)
),
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
)
)
],
),
),
getNum
(
count
),
Positioned
(
right:
ScreenUtil
().
setWidth
(
14
),
top:
ScreenUtil
().
setHeight
(
12
),
child:
Hero
(
tag:
"arrow_right"
,
child:
SvgPicture
.
asset
(
"images/arrow_right.svg"
,
color:
ALColors
.
Color323232
,
)),
)
],
)
);
}
Widget
getNum
(
[
int
count
])
{
if
(
count
>
0
)
{
return
Positioned
(
right:
0
,
top:
ScreenUtil
().
setHeight
(
12
),
child:
Container
(
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
().
setHeight
(
2
),
bottom:
ScreenUtil
().
setHeight
(
2
),
left:
ScreenUtil
().
setWidth
(
7
),
right:
ScreenUtil
().
setWidth
(
7
)),
decoration:
BoxDecoration
(
color:
ALColors
.
Color323232
,
borderRadius:
BorderRadius
.
circular
(
22.0
)
),
child:
Text
(
count
.
toString
(),
style:
TextStyle
(
color:
ALColors
.
ColorFFFFFF
,
fontSize:
ScreenUtil
().
setSp
(
11
),
height:
1.0
),
)
),
);
}
else
{
return
Container
();
}
}
Widget
messageList
(
list
)
{
var
content
=
{
1
:
{
'showText'
:
'评论了你'
,
'opeUrl'
:
'topic_detail?call_keyboard=1&open_comment=0&topic_id=
${list.repliedContent.topicId}
&reply_id=
${list.id}
'
},
2
:
{
'showText'
:
'评论了你的评论'
,
'opeUrl'
:
'topic_detail?call_keyboard=1&open_comment=0&topic_id=
${list.repliedContent.topicId}
&reply_id=
${list.id}
'
},
3
:
{
'showText'
:
'评论了你'
,
'opeUrl'
:
'pictorial_detail?pictorial_id=
${list.repliedContent.pictorialId}
&reply_id=
${list.id}
&show_reply=
${false}
'
},
4
:
{
'showText'
:
'评论了你的评论'
,
'opeUrl'
:
'pictorial_detail?pictorial_id=
${list.repliedContent.pictorialId}
&reply_id=
${list.id}
&show_reply=
${false}
'
},
5
:
{
'showText'
:
'关注了你的问题'
,
'opeUrl'
:
'pictorial_detail?pictorial_id=
${list.repliedContent.pictorialId}
'
}
};
return
Container
(
padding:
EdgeInsets
.
only
(
left:
width
,
right:
width
),
margin:
EdgeInsets
.
only
(
bottom:
ScreenUtil
().
setHeight
(
25
)),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
spaceBetween
,
children:
<
Widget
>[
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
<
Widget
>[
GestureDetector
(
onTap:
(){
onClickButton
(
'head_photo'
,
{
'business_id'
:
list
.
userId
.
toString
()});
jumpToNative
(
'message_home'
,
{
"url"
:
'alpha://user_detail?user_id=
${list.userId}
'
});
},
child:
Container
(
width:
42.0
,
height:
42.0
,
decoration:
BoxDecoration
(
shape:
BoxShape
.
circle
,
image:
DecorationImage
(
image:
NetworkImage
(
list
.
icon
)
)
)
)
),
SizedBox
(
width:
ScreenUtil
().
setWidth
(
10
)),
GestureDetector
(
onTap:
(){
onClickButton
(
'comment'
);
},
child:
Container
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
<
Widget
>[
Row
(
children:
<
Widget
>[
Text
(
list
.
name
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
),
fontWeight:
FontWeight
.
bold
)
),
SizedBox
(
width:
ScreenUtil
().
setWidth
(
10
)),
Text
(
content
[
list
.
repliedContent
?.
type
][
'showText'
],
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
)
)
)
],
),
Container
(
width:
ScreenUtil
().
setWidth
(
210
),
child:
Text
(
list
.
content
,
style:
TextStyle
(
color:
ALColors
.
Color323232
,
fontSize:
ScreenUtil
().
setSp
(
13
)
),
maxLines:
1
,
overflow:
TextOverflow
.
ellipsis
),
),
Text
(
MessageDate
(
list
.
time
).
diffTime
(),
style:
TextStyle
(
color:
Color
(
0xfff8e8e8e
),
fontSize:
ScreenUtil
().
setSp
(
10
)
)
)
]
)
)
)
]
),
GestureDetector
(
onTap:
()
{
onClickButton
(
'photo'
,
{
'business_id'
:
list
.
repliedContent
.
id
.
toString
()});
jumpToNative
(
'message_home'
,
{
"url"
:
'alpha://
${content[list.repliedContent?.type]['openUrl']}
'
});
},
child:
Image
.
network
(
list
.
repliedContent
.
content
,
width:
ScreenUtil
().
setWidth
(
48
),
fit:
BoxFit
.
fill
,
)
)
],
)
);
}
void
onClickButton
(
buttonName
,
[
params
])
{
RouterCenterImpl
()
.
findBuriedRouter
()
?.
onEvent
(
'on_click_button'
,
{
'page_name'
:
'message_home'
,
'button_name'
:
buttonName
,
...?
params
});
}
void
onClickLike
(
buttonName
,
[
params
])
{
RouterCenterImpl
()
.
findBuriedRouter
()
?.
onEvent
(
'on_click_button'
,
{
'page_name'
:
'like_list'
,
'button_name'
:
buttonName
,
...?
params
});
}
\ No newline at end of file
lib/NewMessageModel/page/likePage/LikeListItem.dart
View file @
d3a54528
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_screenutil/flutter_screenutil.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/page/common.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/service/remote/entity/LikePageEntity.dart'
;
import
'package:gmalpha_flutter/NewMessageModel/util/message_date.dart'
;
import
'package:gmalpha_flutter/commonModel/base/AppBase.dart'
;
...
...
@@ -22,14 +23,21 @@ class LikeListItem extends StatelessWidget {
fontSize:
ScreenUtil
.
instance
.
setSp
(
size
),
color:
color
,
height:
1.38
,
fontWeight:
weight
?
FontWeight
.
bold
:
FontWeight
.
normal
),
fontWeight:
weight
?
FontWeight
.
bold
:
FontWeight
.
normal
),
);
}
Widget
listItemHead
()
{
var
businessId
;
if
(
item
.
likeContent
!=
null
)
{
businessId
=
item
.
likeContent
.
id
.
toString
();
}
else
{
businessId
=
item
.
userId
.
toString
();
}
return
GestureDetector
(
onTap:
()
{
onClickLike
(
'head_photo'
,
{
'business_id'
:
businessId
,
'tab_name'
:
''
});
jumpToNative
(
'url_page'
,
{
"url"
:
'alpha://user_detail?user_id=
${item.userId}
'
});
},
...
...
@@ -57,8 +65,15 @@ class LikeListItem extends StatelessWidget {
commentImg
=
'http://alpha.iyanzhi.com/topic/2019/08/16/63ef62d019-w'
;
}
}
var
businessId
;
if
(
item
.
likeContent
!=
null
)
{
businessId
=
item
.
likeContent
.
id
.
toString
();
}
else
{
businessId
=
item
.
userId
.
toString
();
}
return
GestureDetector
(
onTap:
()
{
onClickLike
(
'photo'
,
{
'business_id'
:
businessId
,
'tab_name'
:
''
});
if
(
item
.
likeContent
.
type
==
0
)
{
jumpToNative
(
'url_page'
,
{
"url"
:
"alpha://topic_detail?topic_id=
${item.likeContent.id}
"
...
...
@@ -85,29 +100,34 @@ class LikeListItem extends StatelessWidget {
Widget
listItemInfo
()
{
var
commentInfo
;
var
commenTime
;
var
textTop
;
if
(
item
.
type
!=
2
)
{
if
(
item
.
likeContent
.
type
==
0
)
{
var
textTop
;
if
(
item
.
type
!=
2
)
{
if
(
item
.
likeContent
.
type
==
0
)
{
commentInfo
=
'赞了你的回答'
;
}
else
{
}
else
{
commentInfo
=
'赞了你的评论'
;
}
commenTime
=
MessageDate
(
item
.
time
).
diffTime
();
}
if
(
item
.
content
!=
null
){
textTop
=
11.0
;
if
(
item
.
content
!=
null
)
{
textTop
=
11.0
;
}
else
{
textTop
=
0.0
;
}
else
{
textTop
=
0.0
;
var
businessId
;
if
(
item
.
likeContent
!=
null
)
{
businessId
=
item
.
likeContent
.
id
.
toString
();
}
else
{
businessId
=
item
.
userId
.
toString
();
}
return
Expanded
(
child:
GestureDetector
(
onTap:
()
{
onClickLike
(
'like_message'
,
{
'business_id'
:
businessId
,
'tab_name'
:
''
});
if
(
item
.
likeContent
.
type
==
0
)
{
jumpToNative
(
'url_page'
,
{
"url"
:
"alpha://topic_detail?topic_id=
${item.likeContent.id}
"
});
jumpToNative
(
'url_page'
,
{
"url"
:
"alpha://topic_detail?topic_id=
${item.likeContent.id}
"
});
}
else
if
(
item
.
likeContent
.
type
==
1
)
{
jumpToNative
(
'url_page'
,
{
"url"
:
...
...
@@ -120,17 +140,21 @@ class LikeListItem extends StatelessWidget {
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
left:
ScreenUtil
.
instance
.
setWidth
(
10.0
)),
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
.
instance
.
setHeight
(
textTop
)),
child:
myText
(
'
${item.name??""}${item.content??""}${commentInfo??""}
'
,
ALColors
.
Color666666
,
13.0
),
padding:
EdgeInsets
.
only
(
top:
ScreenUtil
.
instance
.
setHeight
(
textTop
)),
child:
myText
(
'
${item.name ?? ""}${item.content ?? ""}${commentInfo ?? ""}
'
,
ALColors
.
Color666666
,
13.0
),
),
Padding
(
padding:
EdgeInsets
.
only
(
left:
ScreenUtil
.
instance
.
setWidth
(
10.0
),
top:
ScreenUtil
.
instance
.
setHeight
(
3.0
)),
child:
myText
(
'
${commenTime??""}
'
,
ALColors
.
Color999999
,
10.0
)
)
padding:
EdgeInsets
.
only
(
left:
ScreenUtil
.
instance
.
setWidth
(
10.0
),
top:
ScreenUtil
.
instance
.
setHeight
(
3.0
)),
child:
myText
(
'
${commenTime ?? ""}
'
,
ALColors
.
Color999999
,
10.0
))
],
),
)
);
));
}
Widget
listItemButton
()
{
...
...
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