You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
272 lines
8.8 KiB
272 lines
8.8 KiB
import 'package:dio/dio.dart'; |
|
import 'package:flutter/cupertino.dart'; |
|
import 'package:flutter/material.dart'; |
|
import 'package:huixiang/generated/l10n.dart'; |
|
import 'package:huixiang/retrofit/data/base_data.dart'; |
|
import 'package:huixiang/retrofit/data/vip_card.dart'; |
|
import 'package:huixiang/retrofit/retrofit_api.dart'; |
|
import 'package:huixiang/utils/font_weight.dart'; |
|
import 'package:huixiang/view_widget/classic_header.dart'; |
|
import 'package:huixiang/view_widget/custom_image.dart'; |
|
import 'package:huixiang/view_widget/my_footer.dart'; |
|
import 'package:huixiang/view_widget/no_data_view.dart'; |
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
import 'package:shared_preferences/shared_preferences.dart'; |
|
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
|
|
|
class ReleasePage extends StatefulWidget { |
|
@override |
|
State<StatefulWidget> createState() { |
|
return _ReleasePage(); |
|
} |
|
} |
|
|
|
class _ReleasePage extends State<ReleasePage> { |
|
RefreshController _refreshController; |
|
var isShowShrink = false; |
|
ApiService apiService; |
|
|
|
@override |
|
void initState() { |
|
super.initState(); |
|
_refreshController = RefreshController(); |
|
|
|
SharedPreferences.getInstance().then((value) { |
|
apiService = |
|
ApiService(Dio(), context: context, token: value.getString("token")); |
|
|
|
}); |
|
} |
|
|
|
|
|
|
|
@override |
|
Widget build(BuildContext context) { |
|
return Scaffold( |
|
body: Container( |
|
child: SmartRefresher( |
|
enablePullDown: true, |
|
enablePullUp: false, |
|
header: MyHeader(), |
|
footer: CustomFooter( |
|
builder: (context, mode) { |
|
return MyFooter(mode); |
|
}, |
|
), |
|
controller: _refreshController, |
|
// onRefresh: , |
|
physics: BouncingScrollPhysics(), |
|
child: ListView.builder( |
|
padding: EdgeInsets.symmetric(vertical: 8.h), |
|
itemBuilder: (context, position) { |
|
return GestureDetector( |
|
onTap: () { |
|
|
|
}, |
|
child: releaseItem(), |
|
); |
|
}, |
|
itemCount:5, |
|
) |
|
// NoDataView( |
|
// isShowBtn: false, |
|
// text: "共关注0人", |
|
// fontSize: 16.sp, |
|
// margin: EdgeInsets.only(top: 120.h), |
|
// ), |
|
), |
|
), |
|
); |
|
} |
|
|
|
|
|
Widget releaseItem() { |
|
return Container( |
|
color: Colors.white, |
|
padding: EdgeInsets.symmetric(horizontal: 16.w), |
|
margin: EdgeInsets.symmetric(vertical: 16.w), |
|
child:Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceAround, |
|
crossAxisAlignment:CrossAxisAlignment.start, |
|
children: [ |
|
Row( |
|
children: [ |
|
ClipOval( |
|
child: Image.network( |
|
"https://t7.baidu.com/it/u=2841334870,333581502&fm=193&f=GIF", |
|
fit: BoxFit.cover, |
|
width: 44.w, |
|
height: 44.h, |
|
), |
|
clipBehavior: Clip.hardEdge, |
|
), |
|
SizedBox( |
|
width: 8.w, |
|
), |
|
Expanded( |
|
child: Container( |
|
height: 60.h, |
|
child: Column( |
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Row( |
|
children: [ |
|
Expanded(child: Text( |
|
"百花谷", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
fontWeight: MyFontWeight.medium, |
|
color: Color(0xff808080), |
|
), |
|
), ), |
|
InkWell( |
|
onTap: () { |
|
}, |
|
child: Icon( |
|
Icons.close, |
|
color: Colors.black, |
|
size: 16, |
|
), |
|
), |
|
], |
|
), |
|
Text( |
|
"2021.04.12 12:12", |
|
overflow: TextOverflow.ellipsis, |
|
maxLines: 2, |
|
style: TextStyle( |
|
fontSize: 12.sp, |
|
color: Color(0xff808080), |
|
), |
|
), |
|
], |
|
), |
|
), |
|
flex: 1, |
|
), |
|
], |
|
), |
|
SizedBox(height: 12), |
|
Text( |
|
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组合。" |
|
"一个文本可以是一个句子(Sentence)、一个段落(Paragraph)或者一个篇章(Discourse)。广义“文本”:" |
|
"任何由书写所固定下来的任何话语。(利科尔) 狭义“文本”:由语言文字组成的文学实体,代指“作品”,相对于作者、世界构成一个独立、自足的系统。", |
|
overflow: isShowShrink |
|
? TextOverflow.visible |
|
: TextOverflow.ellipsis, |
|
maxLines: isShowShrink ? 10 :5, |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color:Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.regular, |
|
), |
|
), |
|
SizedBox(height: 4.h), |
|
GestureDetector( |
|
onTap: () { |
|
setState(() { |
|
isShowShrink = !isShowShrink; |
|
}); |
|
}, |
|
child: Row( |
|
// mainAxisAlignment: MainAxisAlignment.end, |
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
mainAxisSize: MainAxisSize.max, |
|
children: [ |
|
Text( |
|
(isShowShrink != null && !isShowShrink) |
|
?"查看全文":"收起", |
|
style: TextStyle( |
|
fontSize: 14.sp, |
|
color: Color(0xFF32A060), |
|
fontWeight: MyFontWeight.medium, |
|
), |
|
), |
|
], |
|
), |
|
), |
|
SizedBox(height:16.h), |
|
Image.asset( |
|
"assets/image/laoban.png", |
|
height: 310.h, |
|
), |
|
SizedBox(height: 17.h), |
|
Padding(padding: EdgeInsets.only(bottom: 16), |
|
child:Row( |
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
children: [ |
|
Row( |
|
children: [ |
|
InkWell( |
|
onTap: () { |
|
}, |
|
child: Image.asset( |
|
"assets/image/browse.png", |
|
height: 16.h, |
|
width: 16.w, |
|
), |
|
), |
|
SizedBox(width:4), |
|
Text( |
|
"15", |
|
style: TextStyle( |
|
fontSize: 12.sp, |
|
color:Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.regular, |
|
), |
|
), |
|
], |
|
), |
|
Row( |
|
children: [ |
|
InkWell( |
|
onTap: () { |
|
}, |
|
child: Image.asset( |
|
"assets/image/leaving_message.png", |
|
height: 16.h, |
|
width: 16.w, |
|
), |
|
), |
|
SizedBox(width:4), |
|
Text( |
|
"52", |
|
style: TextStyle( |
|
fontSize: 12.sp, |
|
color:Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.regular, |
|
), |
|
), |
|
], |
|
), |
|
Row( |
|
children: [ |
|
InkWell( |
|
onTap: () { |
|
}, |
|
child: Image.asset( |
|
"assets/image/follow.png", |
|
height: 16.h, |
|
width: 16.w, |
|
), |
|
), |
|
SizedBox(width:4), |
|
Text( |
|
"25", |
|
style: TextStyle( |
|
fontSize: 12.sp, |
|
color:Color(0xFF1A1A1A), |
|
fontWeight: MyFontWeight.regular, |
|
), |
|
), |
|
], |
|
), |
|
], |
|
),), |
|
], |
|
), |
|
); |
|
} |
|
}
|
|
|