YSMineLive.dart 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutterappfuyou/code/YSUserInfo.dart';
  4. import 'package:flutterappfuyou/code/base/YSBase.dart';
  5. import 'package:flutterappfuyou/code/base/YSTools.dart';
  6. import 'package:flutterappfuyou/code/version2/YSMineLiveAdd.dart';
  7. import 'package:flutterappfuyou/code/version2/view/YSMineLiveDataView.dart';
  8. class YSMineLive extends StatefulWidget {
  9. const YSMineLive({Key key}) : super(key: key);
  10. @override
  11. _YSMineLiveState createState() => _YSMineLiveState();
  12. }
  13. class _YSMineLiveState extends State<YSMineLive> with SingleTickerProviderStateMixin{
  14. List _titleArray = [
  15. {'title':'全部'},
  16. {'title':'预告'},
  17. {'title':'直播中'},
  18. {'title':'已结束'}
  19. ];
  20. TabController _tabController;
  21. @override
  22. void initState() {
  23. _tabController = TabController(
  24. vsync: this,
  25. length: _titleArray.length
  26. );
  27. super.initState();
  28. }
  29. @override
  30. Widget build(BuildContext context) {
  31. return YSBase(
  32. ystitle: '直播',
  33. yschild: Container(
  34. padding: EdgeInsets.only(top: 20),
  35. child: DefaultTabController(
  36. length: _titleArray.length,
  37. child: Column(
  38. children: [
  39. Container(
  40. height: 80,
  41. decoration: BoxDecoration(
  42. border: Border(bottom: BorderSide(color: Color(0xFFE26085),width: 0.1))
  43. ),
  44. padding: EdgeInsets.only(left: 20,right: 20),
  45. child: Row(
  46. children: [
  47. Container(
  48. height: 50,
  49. width: 50,
  50. decoration: BoxDecoration(
  51. image: DecorationImage(image: NetworkImage(User().avatar),fit: BoxFit.cover),
  52. color: Color(0xFFE26085),
  53. borderRadius: BorderRadius.all(Radius.circular(50))
  54. ),
  55. ),
  56. Container(
  57. height: 80,
  58. width: ysWidth(context)-170,
  59. padding: EdgeInsets.only(left: 10,right: 10),
  60. child: Column(
  61. crossAxisAlignment: CrossAxisAlignment.start,
  62. mainAxisAlignment: MainAxisAlignment.center,
  63. mainAxisSize: MainAxisSize.min,
  64. children: [
  65. Text(User().name,style: TextStyle(fontSize: 16,color: Color(0xFF222222),fontWeight: FontWeight.normal),),
  66. Container(
  67. padding: EdgeInsets.only(top: 3),
  68. child: Text('主讲老师',style: TextStyle(fontSize: 12,color: Color(0xFFB4B4B4)),),
  69. )
  70. ],
  71. ),
  72. ),
  73. GestureDetector(
  74. onTap: (){
  75. Navigator.of(context).push(
  76. CupertinoPageRoute(builder: (context){
  77. return YSMineLiveAdd();
  78. })
  79. ).then((value) {
  80. liveDataKey.currentState.refresh();
  81. });
  82. },
  83. child: Container(
  84. width: 80,
  85. height: 30,
  86. decoration: BoxDecoration(
  87. color: Color(0xFFE26085),
  88. borderRadius: BorderRadius.all(Radius.circular(2))
  89. ),
  90. alignment: Alignment.center,
  91. child: Text('我要直播',style: TextStyle(fontSize: 12,color: Colors.white),),
  92. ),
  93. )
  94. ],
  95. ),
  96. ),
  97. Container(
  98. height: ysHeight(context)-ysTOP(context)-150,
  99. width: ysWidth(context),
  100. color: Color(0xFFF0F0F1),
  101. child: YSMineLiveDataView(f: {'title':'全部'},key: liveDataKey,),
  102. )
  103. // Container(
  104. // width: ysWidth(context),
  105. // height: 50,
  106. // child: TabBar(
  107. // controller: _tabController,
  108. // isScrollable: true,
  109. // indicatorColor: Color(0xFFFA4444),
  110. // labelColor: Color(0xFFFA4444),
  111. // indicatorWeight: 2,
  112. // indicatorSize: TabBarIndicatorSize.label,
  113. // labelStyle: TextStyle(fontSize: 15),
  114. // unselectedLabelColor: Color(0xFF5D6978),
  115. // tabs: _titleArray.map((f) {
  116. // return Tab(text: '${f['title']}');
  117. // }).toList(),
  118. // )
  119. // ,
  120. // ),
  121. // Container(
  122. // height: ysHeight(context)-ysTOP(context)-200,
  123. // width: ysWidth(context),
  124. // color: Color(0xFFF0F0F1),
  125. // child: TabBarView(
  126. // controller: _tabController,
  127. // children: _titleArray.map((f) {
  128. // return YSMineLiveDataView(f: f,);
  129. // }).toList(),
  130. // ),
  131. // )
  132. ],
  133. ),
  134. ),
  135. ),
  136. );
  137. }
  138. }