Commit 7b7e13e4 authored by 杜欣's avatar 杜欣

add message

parent d15d271d
...@@ -107,38 +107,36 @@ class _MessagePageState extends State<MessagePage> { ...@@ -107,38 +107,36 @@ class _MessagePageState extends State<MessagePage> {
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
topCard(), topCard(),
StreamBuilder<MyMessageEntity>( Container(
stream: _messageModel.myMessageLive.stream, color: ALColors.ColorFFFFFF,
initialData: _messageModel.myMessageLive.data , child: StreamBuilder<MyMessageEntity>(
builder: (BuildContext context, data){ stream: _messageModel.myMessageLive.stream,
var dataList = data.data?.data; initialData: _messageModel.myMessageLive.data ,
if(dataList == null) { builder: (BuildContext context, data){
return Container( var dataList = data.data?.data;
color: ALColors.ColorFFFFFF, if(dataList == null) {
height: ScreenUtil().setHeight(430), return Container(
child: Center(child: Text('暂无相关内容', style: TextStyle(color: ALColors.Color999999, fontSize: ScreenUtil().setSp(16)))) 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,
); );
} },
print('++++++====================${dataList.length}================='); )
return ListView.builder(
itemCount: dataList.length + 1,
itemBuilder: (BuildContext context, int index) {
if (index == dataList.length) {
return _loadingView();
} else {
return Container(
color: ALColors.ColorFFFFFF,
child: Column(
children: <Widget>[
messageList(dataList[index])
],
),
);
}
},
controller: _scrollController,
);
},
) )
] ]
), ),
...@@ -147,7 +145,6 @@ class _MessagePageState extends State<MessagePage> { ...@@ -147,7 +145,6 @@ class _MessagePageState extends State<MessagePage> {
); );
} }
topCard(){ topCard(){
return Container( return Container(
color: ALColors.ColorFFFFFF, color: ALColors.ColorFFFFFF,
......
import 'package:common_utils/common_utils.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:gmalpha_flutter/commonModel/ui/ALColors.dart'; import 'package:gmalpha_flutter/commonModel/ui/ALColors.dart';
messageTitle(String text) { messageTitle(String text) {
return Text( return Text(
text, text,
...@@ -101,6 +103,7 @@ getNum([int count]) { ...@@ -101,6 +103,7 @@ getNum([int count]) {
} }
messageList(list) { messageList(list) {
var contentText = {1: '评论了你', 2: '评论了你的评论', 3: '评论了你', 4: '评论了你的评论', 5: '关注了你的问题'};
return Container( return Container(
padding: EdgeInsets.only(left: width, right: width), padding: EdgeInsets.only(left: width, right: width),
margin: EdgeInsets.only(bottom: ScreenUtil().setHeight(25)), margin: EdgeInsets.only(bottom: ScreenUtil().setHeight(25)),
...@@ -118,7 +121,7 @@ messageList(list) { ...@@ -118,7 +121,7 @@ messageList(list) {
decoration: BoxDecoration( decoration: BoxDecoration(
shape: BoxShape.circle, shape: BoxShape.circle,
image: DecorationImage( image: DecorationImage(
image: NetworkImage('http://alpha-s.gmeiapp.com/2018/12/23/c909726bc2-w') image: NetworkImage(list.icon)
), ),
), ),
), ),
...@@ -131,7 +134,7 @@ messageList(list) { ...@@ -131,7 +134,7 @@ messageList(list) {
Row( Row(
children: <Widget>[ children: <Widget>[
Text( Text(
'参白', list.name,
style: TextStyle( style: TextStyle(
color: ALColors.Color323232, color: ALColors.Color323232,
fontSize: ScreenUtil().setSp(13), fontSize: ScreenUtil().setSp(13),
...@@ -140,7 +143,7 @@ messageList(list) { ...@@ -140,7 +143,7 @@ messageList(list) {
), ),
SizedBox(width: ScreenUtil().setWidth(10)), SizedBox(width: ScreenUtil().setWidth(10)),
Text( Text(
'评论了你', contentText[list.repliedContent?.type],
style: TextStyle( style: TextStyle(
color: ALColors.Color323232, color: ALColors.Color323232,
fontSize: ScreenUtil().setSp(13) fontSize: ScreenUtil().setSp(13)
...@@ -149,7 +152,7 @@ messageList(list) { ...@@ -149,7 +152,7 @@ messageList(list) {
], ],
), ),
Text( Text(
'半框眼镜真的很搭配', list.content,
style: TextStyle( style: TextStyle(
color: ALColors.Color323232, color: ALColors.Color323232,
fontSize: ScreenUtil().setSp(13) fontSize: ScreenUtil().setSp(13)
...@@ -158,7 +161,11 @@ messageList(list) { ...@@ -158,7 +161,11 @@ messageList(list) {
overflow: TextOverflow.ellipsis overflow: TextOverflow.ellipsis
), ),
Text( Text(
'12小时', // TimelineUtil.format(list.time,
// locTimeMillis: DateTime.now().millisecondsSinceEpoch,
// locale: 'zh',
// dayFormat: DayFormat.Full),
list.time.toString(),
style: TextStyle( style: TextStyle(
color: Color(0xfff8e8e8e), color: Color(0xfff8e8e8e),
fontSize: ScreenUtil().setSp(10) fontSize: ScreenUtil().setSp(10)
...@@ -170,7 +177,7 @@ messageList(list) { ...@@ -170,7 +177,7 @@ messageList(list) {
], ],
), ),
Image.network( Image.network(
'http://alpha-s.gmeiapp.com/2018/12/24/2b9fca0930-w', list.repliedContent.content,
width: ScreenUtil().setWidth(48), width: ScreenUtil().setWidth(48),
fit: BoxFit.fill, fit: BoxFit.fill,
) )
......
...@@ -31,6 +31,7 @@ dependencies: ...@@ -31,6 +31,7 @@ dependencies:
# gengmei_flutter_plugin: ^0.0.731 # gengmei_flutter_plugin: ^0.0.731
cached_network_image: ^1.1.1 cached_network_image: ^1.1.1
flutter_screenutil: ^0.5.3 flutter_screenutil: ^0.5.3
common_utils: ^1.1.3
gengmei_flutter_plugin: gengmei_flutter_plugin:
git: git:
url: 'git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git' url: 'git@git.wanmeizhensuo.com:linshengyu/flutter_plugin.git'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment