first commit
This commit is contained in:
1
moehu/moehu_fontend/lib/views/Dynamic/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Dynamic/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
526bc4e1-6a8b-4b67-b7fa-a0786968ba28
|
||||
193
moehu/moehu_fontend/lib/views/Dynamic/Dynamic.dart
Normal file
193
moehu/moehu_fontend/lib/views/Dynamic/Dynamic.dart
Normal file
@@ -0,0 +1,193 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/event/_.dart';
|
||||
import 'package:peach/service/TagService.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/Dynamic/DynamicItem.dart';
|
||||
import 'package:peach/views/Dynamic/Topic.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
import 'MostFrequently.dart';
|
||||
|
||||
/*
|
||||
* 动态
|
||||
*/
|
||||
class Dynamic extends StatefulWidget {
|
||||
@override
|
||||
_Dynamic createState() => _Dynamic();
|
||||
}
|
||||
|
||||
class _Dynamic extends State<Dynamic> {
|
||||
EasyRefreshController _easyRefreshController;
|
||||
List<DynamicTabsDynamicEntity> dynamicList = [];
|
||||
List<DynamicDynamicHistoryEntity> history = [];
|
||||
List<TagRecommendTagEntityData> recommendTagList = [];
|
||||
|
||||
PageEntity page = PageEntity();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
super.initState();
|
||||
future();
|
||||
listenChange();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: Screen.setHeight(82),
|
||||
backgroundColor: ColorConfig.WhiteBackColor,
|
||||
elevation: 0,
|
||||
leading: SizedBox(width: 0.1),
|
||||
title: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text("动态",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: ColorConfig.TitleColor)),
|
||||
),
|
||||
actions: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed("/releaseNews");
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
width: Screen.setWidth(45),
|
||||
child: Icon(Icons.edit_road, color: ColorConfig.TitleColor),
|
||||
),
|
||||
)
|
||||
],
|
||||
bottom: bottom(),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(158),
|
||||
child: easyRefresh(Column(
|
||||
children: [
|
||||
MostFrequently(
|
||||
history: history,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Line(),
|
||||
Topic(
|
||||
topicList: recommendTagList,
|
||||
)
|
||||
],
|
||||
),
|
||||
...dynamicList
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => DynamicItem(dynamicData: dynamicList[e]))
|
||||
.toList(),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget bottom() {
|
||||
return PreferredSize(
|
||||
preferredSize: Size.fromHeight(45),
|
||||
child: Container(
|
||||
height: Screen.setHeight(37),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(
|
||||
color: ColorConfig.LineColor, width: 1, style: BorderStyle.solid),
|
||||
bottom: BorderSide(
|
||||
color: ColorConfig.LineColor, width: 1, style: BorderStyle.solid),
|
||||
)),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Panel(
|
||||
top: 5,
|
||||
bottom: 5,
|
||||
child: ExhibitionSearch(
|
||||
backgroundColor: ColorConfig.AshPlacement,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
Widget easyRefresh(Widget child) {
|
||||
return EasyRefresh(
|
||||
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
|
||||
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
|
||||
enableControlFinishRefresh: false,
|
||||
enableControlFinishLoad: true,
|
||||
controller: _easyRefreshController,
|
||||
child: child,
|
||||
bottomBouncing: true,
|
||||
onRefresh: () async {
|
||||
page.page = 1;
|
||||
dynamicList = [];
|
||||
page.isLoad = false;
|
||||
await dynamicPersonalDynamic();
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
if (!page.isLoad) {
|
||||
page.page += 1;
|
||||
await dynamicPersonalDynamic();
|
||||
_easyRefreshController.finishLoad();
|
||||
} else {
|
||||
new Future.delayed(Duration(seconds: 1), () {
|
||||
_easyRefreshController.finishLoad();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
listenChange() {
|
||||
Config.eventBus.on<ClassEditEvent>().listen((event) {
|
||||
print("${event.update}-------");
|
||||
if (event.update) {
|
||||
print(1);
|
||||
page.page = 1;
|
||||
dynamicList = [];
|
||||
future();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
future() async {
|
||||
await dynamicPersonalDynamic();
|
||||
await dynamicDynamicHistory();
|
||||
await tagRecommendTag();
|
||||
setState(() {});
|
||||
}
|
||||
|
||||
dynamicPersonalDynamic() async {
|
||||
DynamicTabsDynamicEntityData res = await DynamicService.dynamicTabsDynamic(
|
||||
{"page": page.page, "count": page.count});
|
||||
if (res == null) return;
|
||||
if (res.result.length < page.count) {
|
||||
page.isLoad = true;
|
||||
}
|
||||
dynamicList = [...dynamicList, ...res.result];
|
||||
}
|
||||
|
||||
dynamicDynamicHistory() async {
|
||||
DynamicDynamicHistoryEntityData res =
|
||||
await DynamicService.dynamicDynamicHistory({"page": 1, "count": 50});
|
||||
if (res == null) return;
|
||||
history = res.result;
|
||||
}
|
||||
|
||||
tagRecommendTag() async {
|
||||
List<TagRecommendTagEntityData> res = await TagService.tagRecommendTag({});
|
||||
if (res == null) return;
|
||||
recommendTagList = res.take(5).toList();
|
||||
}
|
||||
}
|
||||
350
moehu/moehu_fontend/lib/views/Dynamic/DynamicInfo.dart
Normal file
350
moehu/moehu_fontend/lib/views/Dynamic/DynamicInfo.dart
Normal file
@@ -0,0 +1,350 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_easyrefresh/easy_refresh.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/event/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/ImageView/ImageView.dart';
|
||||
import 'package:peach/widget/Empty.dart';
|
||||
import 'package:peach/widget/InputWidget/default_extra_item.dart';
|
||||
import 'package:peach/widget/InputWidget/input_widget.dart';
|
||||
import 'package:peach/widget/Line.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
import 'package:peach/widget/Panel.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 动态
|
||||
*/
|
||||
class DynamicInfo extends StatefulWidget {
|
||||
final String dynamicId;
|
||||
|
||||
const DynamicInfo({this.dynamicId});
|
||||
|
||||
@override
|
||||
_DynamicInfo createState() => _DynamicInfo(this.dynamicId);
|
||||
}
|
||||
|
||||
class _DynamicInfo extends State<DynamicInfo> {
|
||||
var hintText;
|
||||
|
||||
final String dynamicId;
|
||||
|
||||
FocusNode focusNode;
|
||||
|
||||
List<CommenListEntity> commenList = [];
|
||||
|
||||
TextEditingController ctl = TextEditingController();
|
||||
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
DynamicInfoEntityData data;
|
||||
|
||||
PageEntity page = PageEntity();
|
||||
|
||||
bool loading = true;
|
||||
|
||||
int commentReplyId;
|
||||
|
||||
_DynamicInfo(this.dynamicId);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
ctl.addListener(onValueChange);
|
||||
this.future();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
ctl.removeListener(onValueChange);
|
||||
ctl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void onValueChange() {
|
||||
print("${ctl.text} +++++++");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (loading) return Loading();
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
// 触摸收起键盘
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: Screen.setHeight(45),
|
||||
backgroundColor: ColorConfig.WhiteBackColor,
|
||||
elevation: 0,
|
||||
leading: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConfig.BlackBackColor,
|
||||
),
|
||||
title: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Text("详情",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(color: ColorConfig.TitleColor)),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(45) - Config.top,
|
||||
margin: EdgeInsets.only(bottom: 100),
|
||||
child: easyRefresh(
|
||||
ListView(
|
||||
children: [
|
||||
Panel(
|
||||
child: Row(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
child: ClipOval(
|
||||
child: data?.userInfo?.userHeadImg != null
|
||||
? Image.network(
|
||||
data?.userInfo?.userHeadImg,
|
||||
width: Screen.setWidth(40),
|
||||
height: Screen.setWidth(40),
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("${data?.userInfo?.userNickname}"),
|
||||
Text(
|
||||
"${data?.dynamicTime}",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Text("置顶"),
|
||||
],
|
||||
),
|
||||
),
|
||||
Panel(
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
"${data?.dynamicIntroduce}",
|
||||
style: TextStyle(fontSize: 16),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
),
|
||||
Panel(
|
||||
child: data != null
|
||||
? Container(
|
||||
height: gridViewHeight(data.dynamicImgs.length),
|
||||
child: GridView(
|
||||
physics: new NeverScrollableScrollPhysics(),
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount:
|
||||
gridCrossAxisCount(data.dynamicImgs.length),
|
||||
),
|
||||
children: [
|
||||
...data.dynamicImgs
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => _createGridViewItem(
|
||||
data.dynamicImgs[e].imgUrl, e))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Line(),
|
||||
Panel(
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
"热门评论",
|
||||
style: TextStyle(fontSize: 16),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
),
|
||||
commenList != null
|
||||
? CommentList(
|
||||
comment: commenList,
|
||||
reply: (String userNickname, int id) {
|
||||
hintText = userNickname;
|
||||
commentReplyId = id;
|
||||
Config.eventBus
|
||||
.fire(ClasshHntTextEvent("@${userNickname}"));
|
||||
FocusScope.of(context).requestFocus(focusNode);
|
||||
},
|
||||
)
|
||||
: Empty(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: InputWidget(
|
||||
controller: ctl,
|
||||
// hintText: hintText,
|
||||
extraWidget: DefaultExtraWidget(),
|
||||
onSend: (value) {
|
||||
// print("send text $value");
|
||||
commentAdd(value);
|
||||
},
|
||||
onFocusNode: (FocusNode node) {
|
||||
this.focusNode = node;
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
Widget easyRefresh(Widget child) {
|
||||
return EasyRefresh(
|
||||
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
|
||||
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
|
||||
enableControlFinishRefresh: false,
|
||||
enableControlFinishLoad: true,
|
||||
controller: _easyRefreshController,
|
||||
child: child,
|
||||
bottomBouncing: true,
|
||||
onRefresh: () async {
|
||||
commenList = [];
|
||||
page.page = 1;
|
||||
await this.getCommentList();
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
if (!page.isLoad) {
|
||||
page.page++;
|
||||
await this.getCommentList();
|
||||
_easyRefreshController.finishLoad();
|
||||
} else {
|
||||
new Future.delayed(Duration(seconds: 1), () {
|
||||
_easyRefreshController.finishLoad();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
_createGridViewItem(String str, int e) {
|
||||
List<ImagePickerEntity> arr = data.dynamicImgs
|
||||
.map((e) => ImagePickerEntity(netWorkPath: e.imgUrl))
|
||||
.toList();
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
new FadeRoute(
|
||||
page: PhotoViewGalleryScreen(
|
||||
images: arr,
|
||||
index: e,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.setHeight(80),
|
||||
child: str != null
|
||||
? Image.network(
|
||||
str,
|
||||
width: Screen.setWidth(40),
|
||||
height: Screen.setWidth(40),
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
gridViewHeight(int imgLength) {
|
||||
double height = Screen.width(context) - Screen.setHeight(20);
|
||||
if (imgLength == 1) {
|
||||
return height / 1.5 + 1;
|
||||
} else if (imgLength <= 3) {
|
||||
return height / 2 + 1;
|
||||
} else if (imgLength <= 6) {
|
||||
return height / 1.5 + 1;
|
||||
} else {
|
||||
return height + 1;
|
||||
}
|
||||
}
|
||||
|
||||
gridCrossAxisCount(int imgLength) {
|
||||
if (imgLength == 1) {
|
||||
return 1;
|
||||
} else if (imgLength == 2) {
|
||||
return 2;
|
||||
} else {
|
||||
return 3;
|
||||
}
|
||||
}
|
||||
|
||||
future() async {
|
||||
await dynamicInfo();
|
||||
await getCommentList();
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 评论列表
|
||||
*/
|
||||
getCommentList() async {
|
||||
CommenListEntityData res = await CommentService.getCommentList({
|
||||
"dynamic_id": dynamicId,
|
||||
"page": page.page,
|
||||
"count": page.count,
|
||||
"comment_type": 2,
|
||||
});
|
||||
if (res == null) return;
|
||||
if (page.count > res.result.length) {
|
||||
page.isLoad = true;
|
||||
}
|
||||
commenList = [...commenList, ...res.result];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前详情信息
|
||||
*/
|
||||
dynamicInfo() async {
|
||||
DynamicInfoEntityData res =
|
||||
await DynamicService.dynamicInfo({"dynamic_id": dynamicId});
|
||||
data = res;
|
||||
}
|
||||
|
||||
commentAdd(String str) async {
|
||||
if (str.trim().length <= 0) {
|
||||
BotToast.showText(text: "回复内容不能为空");
|
||||
return;
|
||||
}
|
||||
print(commentReplyId);
|
||||
Null res = await CommentService.commentAdd({
|
||||
"dynamic_id": dynamicId,
|
||||
"comment_content": str,
|
||||
"comment_type": 2,
|
||||
"comment_reply_id": commentReplyId,
|
||||
});
|
||||
BotToast.showText(text: "发送成功");
|
||||
page.page = 1;
|
||||
page.isLoad = false;
|
||||
commenList = [];
|
||||
getCommentList();
|
||||
}
|
||||
}
|
||||
206
moehu/moehu_fontend/lib/views/Dynamic/DynamicItem.dart
Normal file
206
moehu/moehu_fontend/lib/views/Dynamic/DynamicItem.dart
Normal file
@@ -0,0 +1,206 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/entity/DynamicTabsDynamicEntity.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
/*
|
||||
* 动态列表
|
||||
*/
|
||||
class DynamicItem extends StatefulWidget {
|
||||
final dynamic dynamicData;
|
||||
|
||||
const DynamicItem({this.dynamicData});
|
||||
|
||||
@override
|
||||
_DynamicItem createState() => _DynamicItem(this.dynamicData);
|
||||
}
|
||||
|
||||
class _DynamicItem extends State<DynamicItem> {
|
||||
final dynamic dynamicData;
|
||||
|
||||
_DynamicItem(this.dynamicData);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return item();
|
||||
}
|
||||
|
||||
Widget item() {
|
||||
return Column(
|
||||
children: [
|
||||
Line(),
|
||||
Panel(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed(
|
||||
"/personal/${dynamicData.userInfo.userId}");
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
dynamicData.userInfo.userHeadImg,
|
||||
width: Screen.setWidth(40),
|
||||
height: Screen.setWidth(40),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(dynamicData.userInfo.userNickname),
|
||||
Text(
|
||||
Tool.dateAndTimeToString(
|
||||
Tool.timeToStamp(dynamicData.dynamicTime),
|
||||
formart: {"y-m": "-", "m-d": "-", "h-m": ":"},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
itemShowDialog();
|
||||
},
|
||||
child: Transform.rotate(
|
||||
//旋转90度
|
||||
angle: math.pi / 2,
|
||||
child: Icon(Icons.more_horiz),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
if (dynamicData.dynamicType == 1) {
|
||||
Modular.to.pushNamed("/worksInfo/${dynamicData.opusId}");
|
||||
} else {
|
||||
Modular.to
|
||||
.pushNamed("/dynamicInfo/${dynamicData.dynamicId}");
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
dynamicData.dynamicIntroduce,
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
),
|
||||
),
|
||||
dynamicData.dynamicImg != ""
|
||||
? GestureDetector(
|
||||
onTap: () {
|
||||
if (dynamicData.dynamicType == 1) {
|
||||
Modular.to
|
||||
.pushNamed("/worksInfo/${dynamicData.opusId}");
|
||||
} else {
|
||||
Modular.to.pushNamed(
|
||||
"/dynamicInfo/${dynamicData.dynamicId}");
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Image.network(
|
||||
dynamicData.dynamicImg,
|
||||
width: Screen.width(context),
|
||||
height: Screen.setWidth(182),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.near_me,
|
||||
size: 18,
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
SizedBox(width: Screen.setFontSize(5),),
|
||||
Text(
|
||||
dynamicData.dynamicShareCount.toString(),
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.chat_bubble,
|
||||
size: 16,
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
SizedBox(width: Screen.setFontSize(5),),
|
||||
Text(
|
||||
dynamicData.dynamicCommentCount.toString(),
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.thumb_up,
|
||||
size: 18,
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
SizedBox(width: Screen.setFontSize(5),),
|
||||
Text(
|
||||
dynamicData.dynamicSatisfiedCount.toString(),
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
itemShowDialog() {
|
||||
RoutineShowDialog.itemShowDialog(context);
|
||||
}
|
||||
}
|
||||
79
moehu/moehu_fontend/lib/views/Dynamic/MostFrequently.dart
Normal file
79
moehu/moehu_fontend/lib/views/Dynamic/MostFrequently.dart
Normal file
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/DynamicDynamicHistoryEntity.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 动态
|
||||
*/
|
||||
|
||||
class MostFrequently extends StatelessWidget {
|
||||
final List<DynamicDynamicHistoryEntity> history;
|
||||
|
||||
const MostFrequently({this.history});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Panel(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(flex: 1, child: Text("最近访问")),
|
||||
// Row(
|
||||
// children: [
|
||||
// Text(
|
||||
// "查看更多",
|
||||
// style: TextStyle(color: ColorConfig.TextColor),
|
||||
// ),
|
||||
// Icon(
|
||||
// Icons.arrow_forward_ios,
|
||||
// size: 12,
|
||||
// color: ColorConfig.TextColor,
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
],
|
||||
),
|
||||
history.length > 0
|
||||
? Container(
|
||||
margin: EdgeInsets.only(top: 11),
|
||||
height: Screen.setHeight(58),
|
||||
child: GridView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return Column(
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(50),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
history[index].userHeadImg,
|
||||
width: Screen.setWidth(50),
|
||||
height: Screen.setWidth(50),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)),
|
||||
Text(
|
||||
history[index].userNickname,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(fontSize: 12),
|
||||
)
|
||||
],
|
||||
);
|
||||
},
|
||||
itemCount: history.length,
|
||||
),
|
||||
)
|
||||
: EmptyText()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
75
moehu/moehu_fontend/lib/views/Dynamic/Topic.dart
Normal file
75
moehu/moehu_fontend/lib/views/Dynamic/Topic.dart
Normal file
@@ -0,0 +1,75 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 话题
|
||||
*/
|
||||
// class Topic extends StatefulWidget {
|
||||
// final List<TagRecommendTagEntityData> topicList;
|
||||
// final TagRecommendTagEntityData topic;
|
||||
|
||||
// Topic({this.topicList, this.topic});
|
||||
|
||||
// @override
|
||||
// _Topic createState() => _Topic(this.topicList, this.topic);
|
||||
// }
|
||||
|
||||
class Topic extends StatelessWidget {
|
||||
final List<TagRecommendTagEntityData> topicList;
|
||||
|
||||
final Function onTap;
|
||||
|
||||
Topic({this.topicList, this.onTap});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Panel(
|
||||
child: Column(
|
||||
children: [
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text("话题"),
|
||||
),
|
||||
topicList.length > 0
|
||||
? Container(
|
||||
margin: EdgeInsets.only(top: 11),
|
||||
height: Screen.setHeight(90),
|
||||
child: GridView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2, childAspectRatio: 10 / 2),
|
||||
children: [
|
||||
...topicList
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => RowItem(topicList[e].tagsTitle))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
)
|
||||
: EmptyText()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// ignore: non_constant_identifier_names
|
||||
Widget RowItem(String title) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
onTap(title);
|
||||
},
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top: 5, bottom: 5),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(color: ColorConfig.Jump),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user