import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:ysairplane/tools/YSTools.dart'; class YSMessage extends StatefulWidget { @override _YSMessageState createState() => _YSMessageState(); } class _YSMessageState extends State { bool _isShow = false; @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Color(0xFFF0F0F1), appBar: CupertinoNavigationBar( backgroundColor: Colors.white, leading: GestureDetector(child: Icon(Icons.arrow_back_ios,size: 15,color: Color(0xFF000000),),onTap: (){Navigator.pop(context);},), border: Border(), middle: GestureDetector( onTap: (){ setState(() { _isShow = !_isShow; }); }, child: Row( mainAxisSize: MainAxisSize.min, children: [ Text('全部消息',style: TextStyle(fontSize: zsp(36),color: Color(0xFF000000)),), Icon(Icons.keyboard_arrow_down,size: 15,color: Color(0xFF000000),), ], ), ), ), body: Stack( children: [ ListView.separated( shrinkWrap: true, itemBuilder: (context,index){ return Container( padding: EdgeInsets.all(hsp(30)), color: Colors.white, child: index==0?Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: hsp(66), width: hsp(66), decoration: BoxDecoration( color: Colors.lightBlue, borderRadius: BorderRadius.all(Radius.circular(hsp(33))) ), margin: EdgeInsets.only(right: wsp(20)), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('系统消息',style: TextStyle(fontSize: zsp(28),color: Color(0xFF3C61B2),fontWeight: FontWeight.bold),), Container( child: Text('2020.09.09 12:00',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),), margin: EdgeInsets.only(top: hsp(10),bottom: hsp(20)), ), Container( child: Text('你提交的头条消息修改申请已通过申请你提交的头条消息修改申请已通过申请。你提交的头条消息修改申请已通过申请。',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434)),), width: MediaQuery.of(context).size.width-hsp(170), ) ], ) ], ):index==1||index==2||index==3?Column( children: [ Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Container( height: hsp(66), width: hsp(66), decoration: BoxDecoration( color: Colors.lightBlue, borderRadius: BorderRadius.all(Radius.circular(hsp(33))) ), margin: EdgeInsets.only(right: wsp(20)), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text('司徒杰森',style: TextStyle(fontSize: zsp(28),color: Color(0xFF3C61B2),fontWeight: FontWeight.bold),), Container( child: Text('2020.09.09 12:00',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),), margin: EdgeInsets.only(top: hsp(10)), ), ], ) ], ), Container( child: Text(index==1?'@我 好想和你一起提前过年':index==2?'赞了这条动态':'我亲戚家还有掉厕所的,哈哈哈哈哈哈哈哈哈哈都活的好好的 还考上了医学院。',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434)),), width: MediaQuery.of(context).size.width-hsp(66), margin: EdgeInsets.only(top: hsp(30),bottom: hsp(20)), ), Row( children: [ Container( height: hsp(120), width: hsp(120), color: Colors.blueGrey, ), Container( height: hsp(120), width: MediaQuery.of(context).size.width-hsp(186), color: Color(0xFFF4F6F8), child: Text('有没有想提前过年的小有想提前过年的小朋友,一起放个烟花呗~',style: TextStyle(fontSize: zsp(24),color: Color(0xFF7F7F7F)),maxLines: 2,overflow: TextOverflow.ellipsis,), padding: EdgeInsets.all(hsp(20)), ) ], ) ], ):Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Row( children: [ Container( height: hsp(66), width: hsp(66), decoration: BoxDecoration( color: Colors.lightBlue, borderRadius: BorderRadius.all(Radius.circular(hsp(33))) ), margin: EdgeInsets.only(right: wsp(20)), ), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ RichText( text: TextSpan( text: '司徒杰森', style: TextStyle(fontSize: zsp(28),color: Color(0xFF3C61B2),fontWeight: FontWeight.bold), children: [ TextSpan( text: ' 关注了你', style: TextStyle(color: Color(0xFF575757),fontWeight: FontWeight.normal), ) ] ), ), Container( child: Text('2020.09.09 12:00',style: TextStyle(fontSize: zsp(22),color: Color(0xFF9A9A9A)),), margin: EdgeInsets.only(top: hsp(10)), ), ], ) ], ), Container( height: hsp(60), width: wsp(100), decoration: BoxDecoration( color: Color(0xFF007AFF), borderRadius: BorderRadius.all(Radius.circular(50)) ), alignment: Alignment.center, child: Text('关注',style: TextStyle(color: Colors.white,fontSize: zsp(24)),), ) ], ), ); }, separatorBuilder: (context,index){ return Divider(height: hsp(12),thickness: hsp(12),color: Color(0xFFF0F0F1),); }, itemCount: 5, padding: EdgeInsets.only(top: hsp(12),bottom: hsp(43)), ), if(_isShow==true)Column( children: [ Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),), Container( color: Colors.white, child: ListView.separated( shrinkWrap: true, itemBuilder: (context,index){ return Container( height: hsp(105), color: Colors.white, alignment: Alignment.centerLeft, padding: EdgeInsets.only(left: wsp(50),right: wsp(50)), child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text('系统消息',style: TextStyle(fontSize: zsp(28),color: Color(0xFF343434),fontWeight: index==0?FontWeight.bold:FontWeight.normal),), Icon(Icons.check,color: index==0?Color(0xFF007AFF):Colors.transparent,size: hsp(40),) ], ) ); }, separatorBuilder: (context,index){ return Divider(height: 0.5,thickness: 0.5,color: Color(0xFFEEEEEE),); }, itemCount: 6, physics: NeverScrollableScrollPhysics(), ), ), GestureDetector( onTap: (){ setState(() { _isShow = false; }); }, child: Container( height: MediaQuery.of(context).size.height-hsp(105)*6-3-MediaQuery.of(context).padding.top-44, width: MediaQuery.of(context).size.width, color: Colors.black54, ), ) ], ) ], ), ); } }