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

消息模块 通知页面修改

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