Commit 58f27625 authored by 郑智刚's avatar 郑智刚

消息模块 通知页面修改

parent d6b74536
......@@ -30,7 +30,7 @@ class AttentionListItem extends StatelessWidget {
Widget listItemHead() {
return Container(
margin: EdgeInsets.only(right: ScreenUtil().setWidth(10)),
margin: EdgeInsets.only(right: ScreenUtil().setWidth(10.0)),
child: CircleAvatar(
radius: 21.0,
backgroundImage: NetworkImage(item.icon),
......@@ -47,11 +47,11 @@ class AttentionListItem extends StatelessWidget {
child: myText('${item.title}', ALColors.Color464646, 13.0, weight: true),
),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(4)),
padding: EdgeInsets.only(top: ScreenUtil().setHeight(4.0)),
child: myText('${item.content}', ALColors.Color666666, 13.0, maxLines: 2),
),
Padding(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(3)),
padding: EdgeInsets.only(top: ScreenUtil().setHeight(3.0)),
child: myText(MessageDate(item.pushTime).diffTime(), ALColors.Color999999, 10.0)
)
],
......@@ -61,9 +61,9 @@ class AttentionListItem extends StatelessWidget {
Widget listItemButton() {
return Container(
padding: EdgeInsets.only(top: ScreenUtil().setHeight(5), left: ScreenUtil().setWidth(12)),
width: ScreenUtil().setWidth(66),
height: ScreenUtil().setHeight(34),
padding: EdgeInsets.only(top: ScreenUtil().setHeight(5.0), left: ScreenUtil().setWidth(12.0)),
width: ScreenUtil().setWidth(66.0),
height: ScreenUtil().setHeight(34.0),
child: OutlineButton(
padding: const EdgeInsets.only(left: 0.0, right: 0.0,),
borderSide: BorderSide(
......
......@@ -9,6 +9,13 @@ import 'package:gmalpha_flutter/commonModel/base/BasePage.dart';
import 'package:gmalpha_flutter/res/value/ALColors.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
double width15 = ScreenUtil().setWidth(15.0);
double width16 = ScreenUtil().setWidth(16.0);
double width10 = ScreenUtil().setWidth(10.0);
double height16 = ScreenUtil().setHeight(16.0);
double height10 = ScreenUtil().setHeight(10.0);
double height20 = ScreenUtil().setHeight(20.0);
class AttentionPage extends StatefulWidget {
final AttentionModel _model;
AttentionPage(String fromPage) : _model = AttentionModel(1, fromPage);
......@@ -49,7 +56,7 @@ class _AttentionPageState extends BasePage<AttentionPage> {
Widget buildNoticeitem(BuildContext context, int index) {
return Padding(
padding: EdgeInsets.only(bottom: ScreenUtil().setHeight(16), top: ScreenUtil().setHeight(16), left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15)),
padding: EdgeInsets.only(bottom: height16, top: height16, left: width15, right: width15),
child: AttentionListItem(_noticeLists[index]),
);
}
......@@ -61,7 +68,7 @@ class _AttentionPageState extends BasePage<AttentionPage> {
textAlign: TextAlign.center,
style: TextStyle(
color: ALColors.Color999999,
fontSize: ScreenUtil().setSp(14),
fontSize: ScreenUtil().setSp(14.0),
height: 1.07
),
);
......@@ -79,9 +86,9 @@ class _AttentionPageState extends BasePage<AttentionPage> {
),
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6),
top: ScreenUtil().setHeight(20),
bottom: ScreenUtil().setHeight(20)
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20
),
child: loadText
)
......@@ -94,9 +101,9 @@ class _AttentionPageState extends BasePage<AttentionPage> {
child: Container(
color: Color(0xFFF4F3F8),
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(6),
top: ScreenUtil().setHeight(20),
bottom:ScreenUtil().setHeight(20)
left: ScreenUtil().setWidth(6.0),
top: height20,
bottom: height20
),
child: loadText
),
......@@ -106,34 +113,42 @@ class _AttentionPageState extends BasePage<AttentionPage> {
}
Widget loadingItem() {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
CircularProgressIndicator(),
Padding(
padding: EdgeInsets.only(
left: ScreenUtil().setWidth(10),
right: ScreenUtil().setWidth(10),
top: ScreenUtil().setHeight(10),
bottom:ScreenUtil().setHeight(10)
),
child: Text('加载中...'),
)
],
),
Widget loadCircle = Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 60.0),
child: CircularProgressIndicator(),
),
Padding(
padding: EdgeInsets.only(
left: width10,
right: width10,
top: height10,
bottom: height10
),
child: Text('加载中...'),
)
],
);
return SliverFillViewport(
delegate: SliverChildListDelegate([loadCircle])
);
}
Widget errorItem(String reason) {
return Center(
child: Text("$reason"),
return SliverFillViewport(
delegate: SliverChildListDelegate([
Center(
child: Text("$reason"),
)
])
);
}
@override
Widget build(BuildContext context) {
ScreenUtil.instance = ScreenUtil(width: 375, height: 667)..init(context);
ScreenUtil.instance = ScreenUtil(width: 375.0, height: 667.0)..init(context);
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
......@@ -144,9 +159,9 @@ class _AttentionPageState extends BasePage<AttentionPage> {
},
child: Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setHeight(10),
right: ScreenUtil().setWidth(10),
bottom: ScreenUtil().setHeight(10)
top: height10,
right: width10,
bottom: height10
),
child: Center(
child: SvgPicture.asset("images/left_arrow.svg", color: Color(0xff323232)),
......@@ -174,23 +189,20 @@ class _AttentionPageState extends BasePage<AttentionPage> {
),
controller: _refreshController,
onLoading: _onLoading,
child: Container(
color: ALColors.ColorFFFFFF,
child: SingleChildScrollView(
child: Column(
children: <Widget>[
topTitle(),
renderList()
]
)
)
child: CustomScrollView(
slivers: <Widget>[
SliverToBoxAdapter(
child: topTitle(),
),
renderList()
],
)
),
);
}
Widget renderList() {
return StreamBuilder<AttentionEntity>(
return StreamBuilder(
stream: _model.attentiveLive.stream,
initialData: _model.attentiveLive.data,
builder: (context, data) {
......@@ -200,12 +212,24 @@ class _AttentionPageState extends BasePage<AttentionPage> {
if (data.data.error != 0 || data.data.data == null) {
return errorItem(data.data.message);
}
_noticeLists = data.data.data;
return ListView.builder(
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: buildNoticeitem,
itemCount: _noticeLists.length,
if(data.data != null){
_noticeLists = data.data.data;
}
return SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return Container(
padding: EdgeInsets.only(
bottom: height16,
top: height16,
left: width15,
right: width15
),
child: AttentionListItem(_noticeLists[index]),
);
},
childCount: _noticeLists.length,
),
);
},
);
......@@ -227,18 +251,18 @@ class _AttentionPageState extends BasePage<AttentionPage> {
children: <Widget>[
Padding(
padding: EdgeInsets.only(
top: ScreenUtil().setHeight(5),
left: ScreenUtil().setWidth(16),
right: ScreenUtil().setWidth(16),
bottom: ScreenUtil().setHeight(19)
top: ScreenUtil().setHeight(5.0),
left: width16,
right: width16,
bottom: ScreenUtil().setHeight(19.0)
),
child: Text(
'通知',
style: TextStyle(fontSize: ScreenUtil().setSp(20), color: ALColors.Color323232),
style: TextStyle(fontSize: ScreenUtil().setSp(20.0), color: ALColors.Color323232),
),
),
Container(
margin: EdgeInsets.only(left: ScreenUtil().setWidth(15), right: ScreenUtil().setWidth(15)),
margin: EdgeInsets.only(left: width15, right: width15),
child: Divider(
height: 1.0,
color: ALColors.ColorE4E4E4,
......
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