wurong
2 years ago
46 changed files with 1607 additions and 1274 deletions
@ -1,429 +0,0 @@
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
|
||||
class HotArticleDetailsPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _HotArticleDetailsPage(); |
||||
} |
||||
} |
||||
|
||||
class _HotArticleDetailsPage extends State<HotArticleDetailsPage> { |
||||
var controller = new ScrollController(); |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
appBar: MyAppBar( |
||||
background: Color(0xFFFFFFFF), |
||||
leadingColor: Colors.black, |
||||
title: S.of(context).wenzhangxiangqing, |
||||
titleColor: Colors.black, |
||||
titleSize: 16.sp, |
||||
action: Padding( |
||||
padding: EdgeInsets.only(right: 16.w), |
||||
child: Image.asset( |
||||
"assets/image/icon_share.webp", |
||||
width: 24.w, |
||||
height: 24.h, |
||||
), |
||||
), |
||||
), |
||||
body: Container( |
||||
child: SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
margin: EdgeInsets.only(bottom: 20.h), |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text( |
||||
"牡丹花的养护知识", |
||||
style: TextStyle( |
||||
fontSize: 24.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xff1A1A1A), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 20.h, |
||||
), |
||||
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: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "百花谷", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Colors.black), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
Text( |
||||
"2021.04.12 12:12", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xff808080), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
) |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 20.h, |
||||
), |
||||
RichText( |
||||
text: TextSpan( |
||||
text: |
||||
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组合。" |
||||
"一个文本可以是一个句子(Sentence)、一个段落(Paragraph)或者一个篇章(Discourse)。广义“文本”:" |
||||
"任何由书写所固定下来的任何话语。(利科尔) 狭义“文本”:由语言文字组成的文学实体,代指“作品”,相对于作者、世界构成一个独立、自足的系统。", |
||||
style: |
||||
TextStyle(color: Color(0xFF1A1A1A), fontSize: 16.sp), |
||||
)), |
||||
SizedBox( |
||||
height: 16.h, |
||||
), |
||||
Image.network( |
||||
"https://t7.baidu.com/it/u=2487758541,1861252964&fm=193&f=GIF", |
||||
fit: BoxFit.cover, |
||||
width: double.infinity, |
||||
height: 170.h, |
||||
), |
||||
SizedBox( |
||||
height: 16.h, |
||||
), |
||||
RichText( |
||||
text: TextSpan( |
||||
text: |
||||
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Message)的一个句子或多个句子的组合。一个文本可以", |
||||
style: |
||||
TextStyle(color: Color(0xFF1A1A1A), fontSize: 16.sp), |
||||
)), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
// margin: EdgeInsets.only(bottom: 20), |
||||
// padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0) |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.all(16), |
||||
child: Text("评论 (58) 喜欢 (58)", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xff1A1A1A))), |
||||
), |
||||
SizedBox( |
||||
height: 600.h, |
||||
child: ListView.builder( |
||||
itemCount: 6, |
||||
scrollDirection: Axis.vertical, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return _commentItem(position); |
||||
}, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0) |
||||
], |
||||
borderRadius: new BorderRadius.only( |
||||
topLeft: Radius.circular(8.0), |
||||
topRight: Radius.circular(8.0), |
||||
), |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Container( |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
borderRadius: BorderRadius.circular(2.0)), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
margin: const EdgeInsets.fromLTRB(4, 0, 4, 0), |
||||
alignment: Alignment.topLeft, |
||||
child: TextField( |
||||
maxLines: 8, |
||||
minLines: 1, |
||||
decoration: InputDecoration( |
||||
border: InputBorder.none, |
||||
hintText: "留下您精彩的评论吧~", |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xffCDCCCC), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w), |
||||
child: Text( |
||||
"发送", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0XFF1A1A1A)), |
||||
), |
||||
), |
||||
Image.asset("assets/image/icon_like_h.webp") |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
// var _status = 0; |
||||
// var _bgStatus = false; |
||||
// Widget rightAction() { |
||||
// if (_status == 0) { |
||||
// return Container( |
||||
// margin: EdgeInsets.only(right: 17), |
||||
// child: GestureDetector( |
||||
// onTap: () { |
||||
// setState(() { |
||||
// _status = (_status + 1) % 2; |
||||
// }); |
||||
// }, |
||||
// child: Image.asset( |
||||
// "assets/image/icon_share.webp", |
||||
// width: 24, |
||||
// height: 24, |
||||
// ), |
||||
// ), |
||||
// ); |
||||
// } else { |
||||
// return GestureDetector( |
||||
// onTap: () { |
||||
// setState(() { |
||||
// _status = (_status + 1) % 2; |
||||
// }); |
||||
// }, |
||||
// child: Container( |
||||
// margin: EdgeInsets.only(right: 17), |
||||
// padding: EdgeInsets.only(top: 15, bottom: 15), |
||||
// alignment: Alignment.center, |
||||
// child: RoundButton( |
||||
// text: S.of(context).wancheng, |
||||
// textColor: _bgStatus ? Colors.white : Color(0xFFA0A0A0), |
||||
// backgroup: _bgStatus ? Color(0xFF32A060) : Color(0xFFD8D8D8), |
||||
// fontSize: 14, |
||||
// fontWeight: FontWeight.bold, |
||||
// padding: EdgeInsets.only(left: 12, right: 12, top: 2, bottom: 2), |
||||
// radius: 12, |
||||
// ), |
||||
// ), |
||||
// ); |
||||
// } |
||||
// } |
||||
|
||||
Widget _commentItem(var position) { |
||||
return Container( |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.all(16), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
ClipOval( |
||||
child: Image.network( |
||||
"https://t7.baidu.com/it/u=2841334870,333581502&fm=193&f=GIF", |
||||
fit: BoxFit.cover, |
||||
width: 40.w, |
||||
height: 40.h, |
||||
), |
||||
clipBehavior: Clip.hardEdge, |
||||
), |
||||
SizedBox( |
||||
width: 12.w, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 60.h, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "张三", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Colors.black), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
Text( |
||||
"2021.04.12 12:12", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xff808080), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Container( |
||||
alignment: Alignment.topRight, |
||||
child: Row( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_like.webp", |
||||
width: 16.w, |
||||
height: 16.h, |
||||
), |
||||
Text( |
||||
"58", |
||||
style: TextStyle( |
||||
fontSize: 12.sp, color: Color(0xff1A1A1A)), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 68, right: 16), |
||||
child: Text( |
||||
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Mess…", |
||||
style: TextStyle(fontSize: 14.sp, color: Color(0xff1A1A1A)), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(left: 68.w, right: 16.w), |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
borderRadius: BorderRadius.circular(2.0), |
||||
), |
||||
child: Padding( |
||||
padding: EdgeInsets.only(left: 4.w, top: 4.h, bottom: 4.h), |
||||
child: Text( |
||||
"文本,是指书面语言的表现形式文本,是指、", |
||||
style: TextStyle(fontSize: 12.sp, color: Color(0xff808080)), |
||||
), |
||||
), |
||||
), |
||||
if (position == 5) |
||||
Container( |
||||
height: 63.h, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0) |
||||
], |
||||
), |
||||
margin: EdgeInsets.only(top: 30.h), |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
"-已显示全部评论-", |
||||
style: TextStyle(fontSize: 14.sp, color: Color(0xff353535)), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -1,163 +0,0 @@
|
||||
import 'package:dio/dio.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:flutter_easyloading/flutter_easyloading.dart'; |
||||
import 'package:huixiang/generated/l10n.dart'; |
||||
import 'package:huixiang/retrofit/data/article.dart'; |
||||
import 'package:huixiang/retrofit/data/banner.dart'; |
||||
import 'package:huixiang/retrofit/data/base_data.dart'; |
||||
import 'package:huixiang/retrofit/data/page.dart'; |
||||
import 'package:huixiang/retrofit/retrofit_api.dart'; |
||||
import 'package:huixiang/view_widget/classic_header.dart'; |
||||
import 'package:huixiang/view_widget/hot_item.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:huixiang/view_widget/my_footer.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 TouTiao extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _TouTiao(); |
||||
} |
||||
} |
||||
|
||||
class _TouTiao extends State<TouTiao> { |
||||
ApiService apiService; |
||||
List<BannerData> bannerData = []; |
||||
|
||||
@override |
||||
void dispose() { |
||||
super.dispose(); |
||||
refreshController.dispose(); |
||||
} |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
|
||||
SharedPreferences.getInstance().then((value) => { |
||||
apiService = ApiService(Dio(), context: context, token: value.getString("token")), |
||||
queryArticle(), |
||||
}); |
||||
} |
||||
|
||||
int pageNum = 1; |
||||
RefreshController refreshController = RefreshController(); |
||||
|
||||
_onRefresh() { |
||||
pageNum = 1; |
||||
queryArticle(); |
||||
} |
||||
|
||||
List<Article> articles = []; |
||||
|
||||
queryArticle() async { |
||||
BaseData<PageInfo<Article>> baseData = await apiService.queryArticle({ |
||||
"pageNum": pageNum, |
||||
"pageSize": 10, |
||||
"searchKey": "", |
||||
"state": 1, |
||||
"type": 2 |
||||
}).catchError((onError){ |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
refreshController.refreshCompleted(); |
||||
refreshController.loadComplete(); |
||||
if(pageNum == 1) { |
||||
articles.clear(); |
||||
} |
||||
articles.addAll(baseData.data.list); |
||||
if (baseData.data.pageNum == baseData.data.pages) { |
||||
refreshController.loadNoData(); |
||||
} else { |
||||
pageNum += 1; |
||||
} |
||||
setState(() {}); |
||||
} else { |
||||
refreshController.refreshFailed(); |
||||
refreshController.loadFailed(); |
||||
} |
||||
} |
||||
|
||||
///banner |
||||
queryCourseBanner() async { |
||||
if (apiService == null) { |
||||
SharedPreferences value = await SharedPreferences.getInstance(); |
||||
apiService = ApiService( |
||||
Dio(), |
||||
context: context, |
||||
token: value.getString("token"), |
||||
showLoading: true |
||||
); |
||||
} |
||||
BaseData<PageInfo<BannerData>> baseData = |
||||
await apiService.queryBanner({ |
||||
"model": {"type": "COURSE_BANNER"}, |
||||
}).catchError((onError) { |
||||
refreshController.refreshFailed(); |
||||
}); |
||||
if (baseData != null && baseData.isSuccess) { |
||||
bannerData.clear(); |
||||
bannerData.addAll(baseData.data.records); |
||||
refreshController.refreshCompleted(); |
||||
} else { |
||||
refreshController.refreshFailed(); |
||||
// SmartDialog.showToast(baseData.msg, alignment: Alignment.center); |
||||
} |
||||
EasyLoading.dismiss(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
// appBar: MyAppBar( |
||||
// background: Color(0xFFF7F7F7), |
||||
// leadingColor: Colors.black, |
||||
// title: S.of(context).huixiangtoutiao, |
||||
// titleColor: Colors.black, |
||||
// titleSize: 18.sp, |
||||
// ), |
||||
body: Container( |
||||
child: Column( |
||||
children: [ |
||||
|
||||
SmartRefresher( |
||||
controller: refreshController, |
||||
enablePullDown: true, |
||||
enablePullUp: true, |
||||
physics: BouncingScrollPhysics(), |
||||
header: MyHeader(), |
||||
footer: CustomFooter( |
||||
builder: (context, mode) { |
||||
return MyFooter(mode); |
||||
}, |
||||
), |
||||
onRefresh: _onRefresh, |
||||
onLoading: queryArticle, |
||||
child: ListView.builder( |
||||
itemCount: articles.length, |
||||
physics: NeverScrollableScrollPhysics(), |
||||
scrollDirection: Axis.vertical, |
||||
itemBuilder: (context, position) { |
||||
return AspectRatio( |
||||
aspectRatio: position == 0 ? 1.38 : 2.56, |
||||
child: Container( |
||||
height: position == 0 ? 247.h : 96.h, |
||||
margin: EdgeInsets.symmetric(vertical:6.h, horizontal: 16.w), |
||||
child: |
||||
HotArticleItem(article: articles[position], isHot: position == 0), |
||||
), |
||||
); |
||||
}, |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
); |
||||
} |
||||
} |
@ -1,428 +0,0 @@
|
||||
import 'package:chewie/chewie.dart'; |
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:video_player/video_player.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
|
||||
class VideoPlaybackPage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _VideoPlaybackPage(); |
||||
} |
||||
} |
||||
|
||||
class _VideoPlaybackPage extends State<VideoPlaybackPage> { |
||||
var controller = new ScrollController(); |
||||
VideoPlayerController videoPlayerController; |
||||
ChewieController chewieController; |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
// player.setDataSource( |
||||
// "https://www.xxx/test.mp4", |
||||
// autoPlay: false); |
||||
//配置视频地址 |
||||
videoPlayerController = VideoPlayerController.network( |
||||
'https://www.runoob.com/try/demo_source/movie.mp4'); |
||||
chewieController = ChewieController( |
||||
videoPlayerController: videoPlayerController, |
||||
aspectRatio: 3 / 2, |
||||
//宽高比 |
||||
autoPlay: !true, |
||||
//自动播放 |
||||
looping: true, |
||||
//循环播放 |
||||
// 拖动条样式颜色 |
||||
materialProgressColors: ChewieProgressColors( |
||||
playedColor: Colors.white, |
||||
handleColor: Colors.white, |
||||
backgroundColor: Colors.grey, |
||||
bufferedColor: Colors.transparent, |
||||
), |
||||
); |
||||
} |
||||
|
||||
@override |
||||
void dispose() { |
||||
/** |
||||
* 页面销毁时,视频播放器也销毁 |
||||
*/ |
||||
videoPlayerController.dispose(); |
||||
super.dispose(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
body: Container( |
||||
child: SingleChildScrollView( |
||||
physics: BouncingScrollPhysics(), |
||||
child: Column( |
||||
children: [ |
||||
Stack( |
||||
children: [ |
||||
Container( |
||||
height: 274.h, |
||||
child: Chewie( |
||||
controller: chewieController, |
||||
), |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(top: 40.h, left: 16.w, right: 16.w), |
||||
decoration: BoxDecoration( |
||||
color: Colors.transparent, |
||||
), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
GestureDetector( |
||||
child: Icon( |
||||
Icons.arrow_back_ios, |
||||
color: Colors.white, |
||||
size: 24, |
||||
), |
||||
onTap: () { |
||||
Navigator.of(context).pop(); |
||||
}, |
||||
), |
||||
Image.asset( |
||||
"assets/image/icon_share_w.webp", |
||||
width: 24.w, |
||||
height: 24.h, |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
Container( |
||||
margin: EdgeInsets.only(bottom: 20.h), |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0, |
||||
) |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
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: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "百花谷", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Colors.black), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
Row( |
||||
mainAxisAlignment: |
||||
MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
Text( |
||||
"2021.04.12 12:12", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xff808080), |
||||
), |
||||
), |
||||
Text( |
||||
"播放次数 56", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xff808080), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
) |
||||
], |
||||
), |
||||
SizedBox( |
||||
height: 20.h, |
||||
), |
||||
Text("牡丹花的养护知识", |
||||
style: TextStyle( |
||||
fontSize: 24.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xff1A1A1A))), |
||||
], |
||||
), |
||||
), |
||||
Container( |
||||
// margin: EdgeInsets.only(bottom: 20), |
||||
// padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0) |
||||
], |
||||
), |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.start, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.all(16), |
||||
child: Text("评论 (58) 喜欢 (58)", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0xff1A1A1A))), |
||||
), |
||||
SizedBox( |
||||
height: 500.h, |
||||
child: ListView.builder( |
||||
itemCount: 6, |
||||
scrollDirection: Axis.vertical, |
||||
physics: BouncingScrollPhysics(), |
||||
itemBuilder: (context, position) { |
||||
return _commentItem(position); |
||||
}, |
||||
), |
||||
), |
||||
// _commentItem() |
||||
], |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Container( |
||||
padding: EdgeInsets.all(16), |
||||
decoration: BoxDecoration( |
||||
color: Colors.white, |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0) |
||||
], |
||||
borderRadius: new BorderRadius.only( |
||||
topLeft: Radius.circular(8.0), |
||||
topRight: Radius.circular(8.0), |
||||
), |
||||
), |
||||
child: Row( |
||||
children: [ |
||||
Expanded( |
||||
flex: 1, |
||||
child: Container( |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
borderRadius: BorderRadius.circular(2.0)), |
||||
child: Column( |
||||
children: [ |
||||
Container( |
||||
margin: const EdgeInsets.fromLTRB(4, 0, 4, 0), |
||||
alignment: Alignment.topLeft, |
||||
child: TextField( |
||||
maxLines: 8, |
||||
minLines: 1, |
||||
decoration: InputDecoration( |
||||
border: InputBorder.none, |
||||
hintText: "留下您精彩的评论吧~", |
||||
hintStyle: TextStyle( |
||||
fontSize: 14.sp, |
||||
color: Color(0xffCDCCCC), |
||||
), |
||||
), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 20.w, right: 20.w), |
||||
child: Text( |
||||
"发送", |
||||
style: TextStyle( |
||||
fontSize: 16.sp, |
||||
fontWeight: FontWeight.bold, |
||||
color: Color(0XFF1A1A1A)), |
||||
), |
||||
), |
||||
Image.asset("assets/image/icon_like_h.webp") |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
), |
||||
); |
||||
} |
||||
|
||||
Widget _commentItem(var position) { |
||||
return Container( |
||||
child: Column( |
||||
children: [ |
||||
Padding( |
||||
padding: EdgeInsets.all(16), |
||||
child: Row( |
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
||||
crossAxisAlignment: CrossAxisAlignment.center, |
||||
children: [ |
||||
ClipOval( |
||||
child: Image.network( |
||||
"https://t7.baidu.com/it/u=2841334870,333581502&fm=193&f=GIF", |
||||
fit: BoxFit.cover, |
||||
width: 40.w, |
||||
height: 40.h, |
||||
), |
||||
clipBehavior: Clip.hardEdge, |
||||
), |
||||
SizedBox( |
||||
width: 12.w, |
||||
), |
||||
Expanded( |
||||
child: Container( |
||||
height: 60, |
||||
child: Column( |
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
||||
crossAxisAlignment: CrossAxisAlignment.start, |
||||
children: [ |
||||
Text.rich( |
||||
TextSpan(children: [ |
||||
TextSpan( |
||||
text: "张三", |
||||
style: TextStyle( |
||||
fontWeight: FontWeight.bold, |
||||
fontSize: 14.sp, |
||||
color: Colors.black), |
||||
), |
||||
]), |
||||
textDirection: TextDirection.ltr, |
||||
), |
||||
Text( |
||||
"2021.04.12 12:12", |
||||
overflow: TextOverflow.ellipsis, |
||||
maxLines: 2, |
||||
style: TextStyle( |
||||
fontSize: 12.sp, |
||||
color: Color(0xff808080), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
flex: 1, |
||||
), |
||||
Container( |
||||
alignment: Alignment.topRight, |
||||
child: Row( |
||||
children: [ |
||||
Image.asset( |
||||
"assets/image/icon_like.webp", |
||||
width: 16.w, |
||||
height: 16.h, |
||||
), |
||||
Text( |
||||
"58", |
||||
style: |
||||
TextStyle(fontSize: 12.sp, color: Color(0xff1A1A1A)), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
], |
||||
), |
||||
), |
||||
Padding( |
||||
padding: EdgeInsets.only(left: 68.w, right: 16.w), |
||||
child: Text( |
||||
"文本,是指书面语言的表现形式,从文学角度说,通常是具有完整、系统含义(Mess…", |
||||
style: TextStyle(fontSize: 14.sp, color: Color(0xff1A1A1A)), |
||||
), |
||||
), |
||||
SizedBox( |
||||
height: 12.h, |
||||
), |
||||
Container( |
||||
width: double.infinity, |
||||
margin: EdgeInsets.only(left: 68.w, right: 16.w), |
||||
decoration: new BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
borderRadius: BorderRadius.circular(2.0), |
||||
), |
||||
child: Padding( |
||||
padding: EdgeInsets.only(left: 4.w, top: 4.h, bottom: 4.h), |
||||
child: Text( |
||||
"文本,是指书面语言的表现形式文本,是指、", |
||||
style: TextStyle(fontSize: 12.sp, color: Color(0xff808080)), |
||||
), |
||||
), |
||||
), |
||||
if (position == 5) |
||||
Container( |
||||
height: 63.h, |
||||
decoration: BoxDecoration( |
||||
color: Color(0xffF2F2F2), |
||||
boxShadow: [ |
||||
BoxShadow( |
||||
color: Colors.black.withAlpha(12), |
||||
offset: Offset(0, 2), |
||||
blurRadius: 14, |
||||
spreadRadius: 0) |
||||
], |
||||
), |
||||
margin: EdgeInsets.only(top: 30.h), |
||||
alignment: Alignment.center, |
||||
child: Text( |
||||
"-已显示全部评论-", |
||||
style: TextStyle(fontSize: 14.sp, color: Color(0xff353535)), |
||||
), |
||||
), |
||||
], |
||||
), |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,49 @@
|
||||
import 'dart:io'; |
||||
|
||||
import 'package:flutter/cupertino.dart'; |
||||
import 'package:flutter/material.dart'; |
||||
import 'package:huixiang/utils/font_weight.dart'; |
||||
import 'package:huixiang/view_widget/my_appbar.dart'; |
||||
import 'package:flutter_screenutil/flutter_screenutil.dart'; |
||||
import 'package:webview_flutter/webview_flutter.dart'; |
||||
import 'package:webview_flutter/src/webview_cupertino.dart'; |
||||
|
||||
class UserVipServicePage extends StatefulWidget { |
||||
@override |
||||
State<StatefulWidget> createState() { |
||||
return _UserVipServicePage(); |
||||
} |
||||
} |
||||
|
||||
class _UserVipServicePage extends State<UserVipServicePage> with WidgetsBindingObserver { |
||||
var controller = new ScrollController(); |
||||
|
||||
@override |
||||
void initState() { |
||||
super.initState(); |
||||
WidgetsBinding.instance.addObserver(this); |
||||
if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); |
||||
if (Platform.isIOS) WebView.platform = CupertinoWebView(); |
||||
} |
||||
|
||||
@override |
||||
Widget build(BuildContext context) { |
||||
return Scaffold( |
||||
appBar: MyAppBar( |
||||
title:"回乡VIP会员卡规则协议", |
||||
titleColor: Colors.black, |
||||
background: Color(0xFFFFFFFF), |
||||
leadingColor: Colors.black, |
||||
), |
||||
body: Container( |
||||
width: MediaQuery.of(context).size.width, |
||||
height: MediaQuery.of(context).size.height, |
||||
alignment: Alignment.center, |
||||
child: |
||||
WebView( |
||||
initialUrl: "http://huixiang.lotus-wallet.com/vip.html", |
||||
javascriptMode: JavascriptMode.unrestricted, |
||||
)), |
||||
); |
||||
} |
||||
} |
Loading…
Reference in new issue