|
...
|
...
|
@@ -18,7 +18,8 @@ class MessagePage extends StatefulWidget { |
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{
|
|
|
|
class MessagePageState extends State<MessagePage>
|
|
|
|
with TickerProviderStateMixin {
|
|
|
|
Color selectedColor = MyColours.color_199095;
|
|
|
|
Color unSelectedColor = MyColours.color_999999;
|
|
|
|
|
|
...
|
...
|
@@ -30,31 +31,31 @@ class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{ |
|
|
|
void initState() {
|
|
|
|
// TODO: implement initState
|
|
|
|
super.initState();
|
|
|
|
tabController = TabController(length: 2,vsync: this);
|
|
|
|
tabController = TabController(length: 2, vsync: this);
|
|
|
|
tabController.addListener(() {
|
|
|
|
setState(() {
|
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
});
|
|
|
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
|
|
|
_getUnMsgNum();
|
|
|
|
});
|
|
|
|
bus.on("refresh_untreated_num", (arg) {//舒心未读消息数目
|
|
|
|
bus.on("refresh_untreated_num", (arg) {
|
|
|
|
//刷新未读消息数目
|
|
|
|
_getUnMsgNum();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
_getUnMsgNum() async {
|
|
|
|
Map<String,String> params={
|
|
|
|
"sid":Provider.of<UserModel>(context,listen:false).user.sellerid
|
|
|
|
Map<String, String> params = {
|
|
|
|
"sid": Provider.of<UserModel>(context, listen: false).user.sellerid
|
|
|
|
};
|
|
|
|
await messageModel.getUnMsgNum(context, params);
|
|
|
|
setState(() {
|
|
|
|
});
|
|
|
|
setState(() {});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
// TODO: implement build
|
|
|
|
messageModel=Provider.of<MessageModel>(context,listen: false);
|
|
|
|
messageModel = Provider.of<MessageModel>(context, listen: false);
|
|
|
|
return Container(
|
|
|
|
width: double.infinity,
|
|
|
|
height: double.infinity,
|
|
...
|
...
|
@@ -80,7 +81,8 @@ class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{ |
|
|
|
color: tabController.index == 0
|
|
|
|
? selectedColor
|
|
|
|
: unSelectedColor,
|
|
|
|
fontSize: ScreenUtil().setSp(32),fontWeight: FontWeight.bold),
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
...
|
...
|
@@ -91,7 +93,9 @@ class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{ |
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(16)),
|
|
|
|
color: messageModel.onlineTotal>0?MyColours.color_fa5151:MyColours.color_ffffff),
|
|
|
|
color: messageModel.onlineTotal > 0
|
|
|
|
? MyColours.color_fa5151
|
|
|
|
: MyColours.color_ffffff),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
...
|
...
|
@@ -110,7 +114,8 @@ class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{ |
|
|
|
color: tabController.index == 1
|
|
|
|
? selectedColor
|
|
|
|
: unSelectedColor,
|
|
|
|
fontSize: ScreenUtil().setSp(32),fontWeight: FontWeight.bold),
|
|
|
|
fontSize: ScreenUtil().setSp(32),
|
|
|
|
fontWeight: FontWeight.bold),
|
|
|
|
),
|
|
|
|
Positioned(
|
|
|
|
top: 0,
|
|
...
|
...
|
@@ -121,7 +126,9 @@ class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{ |
|
|
|
decoration: BoxDecoration(
|
|
|
|
borderRadius: BorderRadius.circular(
|
|
|
|
ScreenUtil().setWidth(16)),
|
|
|
|
color: messageModel.orderTotal>0?MyColours.color_fa5151:MyColours.color_ffffff),
|
|
|
|
color: messageModel.orderTotal > 0
|
|
|
|
? MyColours.color_fa5151
|
|
|
|
: MyColours.color_ffffff),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
...
|
...
|
@@ -131,14 +138,17 @@ class MessagePageState extends State<MessagePage> with TickerProviderStateMixin{ |
|
|
|
],
|
|
|
|
indicatorColor: MyColours.color_199095,
|
|
|
|
indicatorSize: TabBarIndicatorSize.label,
|
|
|
|
indicatorPadding: EdgeInsets.only(left: ScreenUtil().setWidth(16),right: ScreenUtil().setWidth(32)),
|
|
|
|
indicatorPadding: EdgeInsets.only(
|
|
|
|
left: ScreenUtil().setWidth(16),
|
|
|
|
right: ScreenUtil().setWidth(32)),
|
|
|
|
indicatorWeight: ScreenUtil().setWidth(6.0),
|
|
|
|
),
|
|
|
|
VEmptyView(11),
|
|
|
|
Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child:
|
|
|
|
TabBarView(controller:tabController,children: [MessageOnlinePage(), MessageOrderPage()]),
|
|
|
|
child: TabBarView(
|
|
|
|
controller: tabController,
|
|
|
|
children: [MessageOnlinePage(), MessageOrderPage()]),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
...
|
...
|
|