first commit
This commit is contained in:
1
moehu/moehu_fontend/lib/views/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
6a7874ca-a847-408f-bb27-f0bbc9012436
|
||||
80
moehu/moehu_fontend/lib/views/App.dart
Normal file
80
moehu/moehu_fontend/lib/views/App.dart
Normal file
@@ -0,0 +1,80 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
|
||||
import 'Appointment/Appointment.dart';
|
||||
import 'Customized/Customized.dart';
|
||||
import 'Dynamic/Dynamic.dart';
|
||||
import 'Index/Index.dart';
|
||||
import 'Index/PersonalpPop.dart';
|
||||
import 'Personal/Personal.dart';
|
||||
|
||||
/**
|
||||
* 有状态StatefulWidget
|
||||
* 继承于 StatefulWidget,通过 State 的 build 方法去构建控件
|
||||
*/
|
||||
class App extends StatefulWidget {
|
||||
App();
|
||||
|
||||
//主要是负责创建state
|
||||
@override
|
||||
BotomeMenumTabBarPageState createState() => BotomeMenumTabBarPageState();
|
||||
}
|
||||
|
||||
/**
|
||||
* 在 State 中,可以动态改变数据
|
||||
* 在 setState 之后,改变的数据会触发 Widget 重新构建刷新
|
||||
*/
|
||||
class BotomeMenumTabBarPageState extends State<App>
|
||||
with SingleTickerProviderStateMixin {
|
||||
BotomeMenumTabBarPageState();
|
||||
TabController tabController;
|
||||
@override
|
||||
void initState() {
|
||||
///初始化,这个函数在生命周期中只调用一次
|
||||
super.initState();
|
||||
CheckUpdate().check(context);
|
||||
tabController = new TabController(length: 4, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Config.context = context;
|
||||
//构建页面
|
||||
Core.barColor(Colors.transparent);
|
||||
return new Scaffold(
|
||||
extendBody: true,
|
||||
body: new TabBarView(controller: tabController, children: [
|
||||
Builder(builder: (BuildContext context) {
|
||||
return Index(clickHead: () => {Scaffold.of(context).openDrawer()});
|
||||
}),
|
||||
Appointment(),
|
||||
Dynamic(),
|
||||
Customized(),
|
||||
// Personal()
|
||||
]),
|
||||
bottomNavigationBar: Container(
|
||||
height: Screen.setHeight(50),
|
||||
decoration: new BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
border: new Border(top: BorderSide(color: ColorConfig.LineColor)),
|
||||
),
|
||||
child: new TabBar(
|
||||
indicatorColor: Colors.transparent,
|
||||
labelColor: ColorConfig.ThemeColor,
|
||||
unselectedLabelColor: ColorConfig.TextColor,
|
||||
controller: tabController,
|
||||
tabs: <Tab>[
|
||||
new Tab(text: "首页", icon: new Icon(Icons.home)),
|
||||
new Tab(text: "约稿", icon: new Icon(Icons.find_in_page)),
|
||||
new Tab(text: "动态", icon: new Icon(Icons.message)),
|
||||
new Tab(text: "定制", icon: new Icon(Icons.person)),
|
||||
// new Tab(text: "个人", icon: new Icon(Icons.person)),
|
||||
],
|
||||
indicatorWeight: 0.1,
|
||||
labelStyle: TextStyle(height: 0.5),
|
||||
),
|
||||
),
|
||||
drawer: PersonalpPop());
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/Appointment/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Appointment/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
bf367505-32e1-4734-9a41-9ab3be795c38
|
||||
32
moehu/moehu_fontend/lib/views/Appointment/Appointment.dart
Normal file
32
moehu/moehu_fontend/lib/views/Appointment/Appointment.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/*
|
||||
* 约稿
|
||||
*/
|
||||
class Appointment extends StatefulWidget {
|
||||
@override
|
||||
_Appointment createState() => _Appointment();
|
||||
}
|
||||
|
||||
class _Appointment extends State<Appointment> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
new Container(
|
||||
margin: const EdgeInsets.only(top: 8.0),
|
||||
child: new Text(
|
||||
"测试",
|
||||
style: new TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
32
moehu/moehu_fontend/lib/views/BlankPage.dart
Normal file
32
moehu/moehu_fontend/lib/views/BlankPage.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/*
|
||||
* 约稿
|
||||
*/
|
||||
class BlankPage extends StatefulWidget {
|
||||
@override
|
||||
_BlankPage createState() => _BlankPage();
|
||||
}
|
||||
|
||||
class _BlankPage extends State<BlankPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
new Container(
|
||||
margin: const EdgeInsets.only(top: 8.0),
|
||||
child: new Text(
|
||||
"测试",
|
||||
style: new TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/Customized/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Customized/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
e3d1e081-185d-46c1-8b94-b2b5cb5a9fd3
|
||||
32
moehu/moehu_fontend/lib/views/Customized/Customized.dart
Normal file
32
moehu/moehu_fontend/lib/views/Customized/Customized.dart
Normal file
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/*
|
||||
* 定制
|
||||
*/
|
||||
class Customized extends StatefulWidget {
|
||||
@override
|
||||
_Customized createState() => _Customized();
|
||||
}
|
||||
|
||||
class _Customized extends State<Customized> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
new Container(
|
||||
margin: const EdgeInsets.only(top: 8.0),
|
||||
child: new Text(
|
||||
"测试",
|
||||
style: new TextStyle(
|
||||
fontSize: 12.0,
|
||||
fontWeight: FontWeight.w400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
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),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/EditMaterials/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/EditMaterials/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
3be3baef-fabd-44bd-88b8-f27c18d1934a
|
||||
125
moehu/moehu_fontend/lib/views/EditMaterials/EditMaterials.dart
Normal file
125
moehu/moehu_fontend/lib/views/EditMaterials/EditMaterials.dart
Normal file
@@ -0,0 +1,125 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/utils/Screen.dart';
|
||||
import 'package:peach/widget/Panel.dart';
|
||||
|
||||
/*
|
||||
* 编辑资料
|
||||
*/
|
||||
class EditMaterials extends StatefulWidget {
|
||||
@override
|
||||
_EditMaterials createState() => _EditMaterials();
|
||||
}
|
||||
|
||||
class _EditMaterials extends State<EditMaterials> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.WhiteBackColor,
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
'编辑个人资料',
|
||||
style: TextStyle(color: ColorConfig.BlackBackColor),
|
||||
),
|
||||
iconTheme: IconThemeData(
|
||||
color: ColorConfig.BlackBackColor,
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: TextButton(
|
||||
child: Text(
|
||||
"保存",
|
||||
style: TextStyle(color: ColorConfig.TextColor, fontSize: 18),
|
||||
),
|
||||
onPressed: () {
|
||||
print("文字按钮");
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
body: Column(
|
||||
children: [
|
||||
Panel(
|
||||
child: Column(
|
||||
children: [
|
||||
GestureDetector(
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
child: ClipOval(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://upload.jianshu.io/users/upload_avatars/5685558/23e20d58-c5e1-4fd6-90d4-a3752cbe7d6a"),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
height: Screen.setHeight(77),
|
||||
width: Screen.setHeight(77),
|
||||
child: Container(
|
||||
color: Color.fromRGBO(0, 0, 0, .3),
|
||||
child: Icon(
|
||||
Icons.party_mode,
|
||||
color: ColorConfig.LineColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: () {},
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Text(
|
||||
"点击更换头像",
|
||||
style:
|
||||
TextStyle(color: ColorConfig.TextColor, fontSize: 16),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(height: 1),
|
||||
itemListTile(title: Text('昵称'), trailing: rightText("昵称")),
|
||||
itemListTile(title: Text('简介'), trailing: rightText("简介")),
|
||||
itemListTile(title: Text('性别'), trailing: rightText("性别")),
|
||||
itemListTile(title: Text('出生日期'), trailing: rightText("地区")),
|
||||
itemListTile(title: Text('地区'), trailing: rightText("地区"))
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget itemListTile({Widget title, Widget trailing}) {
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text('地区'),
|
||||
trailing: trailing,
|
||||
),
|
||||
Divider(height: 1),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget rightText(String text) {
|
||||
return Container(
|
||||
width: Screen.setWidth(200),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(text),
|
||||
Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/Fans/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Fans/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
3e58ab1d-150c-40e2-ac44-d4fe0d135641
|
||||
175
moehu/moehu_fontend/lib/views/Fans/Fans.dart
Normal file
175
moehu/moehu_fontend/lib/views/Fans/Fans.dart
Normal file
@@ -0,0 +1,175 @@
|
||||
import 'package:flutter/cupertino.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/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 粉丝列表
|
||||
*/
|
||||
class Fans extends StatefulWidget {
|
||||
final int userId;
|
||||
|
||||
const Fans({this.userId});
|
||||
|
||||
@override
|
||||
_Fans createState() => _Fans(this.userId);
|
||||
}
|
||||
|
||||
class _Fans extends State<Fans> with SingleTickerProviderStateMixin {
|
||||
final int userId;
|
||||
_Fans(this.userId);
|
||||
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
List<FansUserListEntityResult> fansList = [];
|
||||
|
||||
PageEntity page = PageEntity();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
super.initState();
|
||||
getFansUserList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: Screen.setHeight(45),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
"粉丝列表",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(158),
|
||||
child: easyRefresh(ListView(
|
||||
children: [
|
||||
...fansList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => Column(
|
||||
children: [
|
||||
Panel(
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
"/personal/${fansList[e].userId}");
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
fansList[e].userHeadImg,
|
||||
width: Screen.setWidth(40),
|
||||
height: Screen.setWidth(40),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
"/personal/${fansList[e].userId}");
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("${fansList[e].userNickname}"),
|
||||
Text("${fansList[e].userAutograph}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// backgroundColor:
|
||||
// MaterialStateProperty.resolveWith((states) {
|
||||
// //默认不使用背景颜色
|
||||
// return ColorConfig.ThemeColor;
|
||||
// }),
|
||||
// ),
|
||||
// child: Text('关注'),
|
||||
// onPressed: () {},
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
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;
|
||||
fansList = [];
|
||||
page.isLoad = false;
|
||||
await getFansUserList();
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
if (!page.isLoad) {
|
||||
page.page += 1;
|
||||
await getFansUserList();
|
||||
_easyRefreshController.finishLoad();
|
||||
} else {
|
||||
new Future.delayed(Duration(seconds: 1), () {
|
||||
_easyRefreshController.finishLoad();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
getFansUserList() async {
|
||||
FansUserListEntityData res = await UserService.getFansUserList({
|
||||
'user_id': userId,
|
||||
'page': page.page,
|
||||
'count': page.count,
|
||||
});
|
||||
if (res == null) return;
|
||||
if (res.result.length < page.count) {
|
||||
page.isLoad = true;
|
||||
}
|
||||
setState(() {
|
||||
fansList = [...fansList, ...res.result];
|
||||
});
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/Follow/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Follow/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
1291c150-225d-4944-b5c3-a8927080f978
|
||||
175
moehu/moehu_fontend/lib/views/Follow/Follow.dart
Normal file
175
moehu/moehu_fontend/lib/views/Follow/Follow.dart
Normal file
@@ -0,0 +1,175 @@
|
||||
import 'package:flutter/cupertino.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/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 关注列表
|
||||
*/
|
||||
class Follow extends StatefulWidget {
|
||||
final int userId;
|
||||
|
||||
const Follow({this.userId});
|
||||
|
||||
@override
|
||||
_Follow createState() => _Follow(this.userId);
|
||||
}
|
||||
|
||||
class _Follow extends State<Follow> with SingleTickerProviderStateMixin {
|
||||
final int userId;
|
||||
_Follow(this.userId);
|
||||
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
List<FollowUserListEntityResult> fansList = [];
|
||||
|
||||
PageEntity page = PageEntity();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
super.initState();
|
||||
getFansUserList();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
toolbarHeight: Screen.setHeight(45),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
elevation: 0,
|
||||
centerTitle: true,
|
||||
title: Text(
|
||||
"关注列表",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(158),
|
||||
child: easyRefresh(ListView(
|
||||
children: [
|
||||
...fansList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => Column(
|
||||
children: [
|
||||
Panel(
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
"/personal/${fansList[e].userId}");
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
fansList[e].userHeadImg,
|
||||
width: Screen.setWidth(40),
|
||||
height: Screen.setWidth(40),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed(
|
||||
"/personal/${fansList[e].userId}");
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment:
|
||||
CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("${fansList[e].userNickname}"),
|
||||
Text("${fansList[e].userAutograph}"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// backgroundColor:
|
||||
// MaterialStateProperty.resolveWith((states) {
|
||||
// //默认不使用背景颜色
|
||||
// return ColorConfig.ThemeColor;
|
||||
// }),
|
||||
// ),
|
||||
// child: Text('关注'),
|
||||
// onPressed: () {},
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
],
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
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;
|
||||
fansList = [];
|
||||
page.isLoad = false;
|
||||
await getFansUserList();
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
if (!page.isLoad) {
|
||||
page.page += 1;
|
||||
await getFansUserList();
|
||||
_easyRefreshController.finishLoad();
|
||||
} else {
|
||||
new Future.delayed(Duration(seconds: 1), () {
|
||||
_easyRefreshController.finishLoad();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
getFansUserList() async {
|
||||
FollowUserListEntityData res = await UserService.getFollowUserList({
|
||||
'user_id': userId,
|
||||
'page': page.page,
|
||||
'count': page.count,
|
||||
});
|
||||
if (res == null) return;
|
||||
if (res.result.length < page.count) {
|
||||
page.isLoad = true;
|
||||
}
|
||||
setState(() {
|
||||
fansList = [...fansList, ...res.result];
|
||||
});
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/ImageView/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/ImageView/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
a4277967-b661-464a-af2f-b5364f5d720a
|
||||
123
moehu/moehu_fontend/lib/views/ImageView/ImageView.dart
Normal file
123
moehu/moehu_fontend/lib/views/ImageView/ImageView.dart
Normal file
@@ -0,0 +1,123 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
import 'package:photo_view/photo_view_gallery.dart';
|
||||
|
||||
/*
|
||||
* 查看大图
|
||||
*/
|
||||
class PhotoViewGalleryScreen extends StatefulWidget {
|
||||
List<ImagePickerEntity> images = [];
|
||||
int index = 0;
|
||||
String heroTag;
|
||||
PageController controller;
|
||||
|
||||
PhotoViewGalleryScreen(
|
||||
{Key key,
|
||||
@required this.images,
|
||||
this.index,
|
||||
this.controller,
|
||||
this.heroTag})
|
||||
: super(key: key) {
|
||||
controller = PageController(initialPage: index);
|
||||
}
|
||||
|
||||
@override
|
||||
_PhotoViewGalleryScreenState createState() => _PhotoViewGalleryScreenState();
|
||||
}
|
||||
|
||||
class _PhotoViewGalleryScreenState extends State<PhotoViewGalleryScreen> {
|
||||
int currentIndex = 0;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
currentIndex = widget.index;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
top: 0,
|
||||
left: 0,
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
child: PhotoViewGallery.builder(
|
||||
scrollPhysics: const BouncingScrollPhysics(),
|
||||
builder: (BuildContext context, int index) {
|
||||
return PhotoViewGalleryPageOptions(
|
||||
imageProvider: widget.images[index].getNetWorkPath != null
|
||||
? NetworkImage(widget.images[index]?.getNetWorkPath)
|
||||
: FileImage(widget.images[index]?.getPath),
|
||||
);
|
||||
},
|
||||
itemCount: widget.images.length,
|
||||
backgroundDecoration: null,
|
||||
pageController: widget.controller,
|
||||
enableRotation: true,
|
||||
onPageChanged: (index) {
|
||||
setState(
|
||||
() {
|
||||
currentIndex = index;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
//图片index显示
|
||||
top: MediaQuery.of(context).padding.top + 15,
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Center(
|
||||
child: Text("${currentIndex + 1}/${widget.images.length}",
|
||||
style: TextStyle(color: Colors.white, fontSize: 16)),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
//右上角关闭按钮
|
||||
right: 10,
|
||||
top: MediaQuery.of(context).padding.top,
|
||||
child: IconButton(
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
size: 30,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class FadeRoute extends PageRouteBuilder {
|
||||
final Widget page;
|
||||
FadeRoute({this.page})
|
||||
: super(
|
||||
pageBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
) =>
|
||||
page,
|
||||
transitionsBuilder: (
|
||||
BuildContext context,
|
||||
Animation<double> animation,
|
||||
Animation<double> secondaryAnimation,
|
||||
Widget child,
|
||||
) =>
|
||||
FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/Index/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Index/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
b8c19708-4e09-4001-98bf-0834f16fc12c
|
||||
512
moehu/moehu_fontend/lib/views/Index/Index.dart
Normal file
512
moehu/moehu_fontend/lib/views/Index/Index.dart
Normal file
@@ -0,0 +1,512 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:cached_network_image/cached_network_image.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:flutter_modular/flutter_modular.dart';
|
||||
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
||||
import 'package:peach/config/Index.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/Empty.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 首页
|
||||
*/
|
||||
class Index extends StatefulWidget {
|
||||
final Function clickHead;
|
||||
|
||||
const Index({Key key, this.clickHead}) : super(key: key);
|
||||
@override
|
||||
_Index createState() => _Index(this.clickHead);
|
||||
}
|
||||
|
||||
class _Index extends State<Index> with SingleTickerProviderStateMixin {
|
||||
final Function clickHead;
|
||||
|
||||
_Index(this.clickHead);
|
||||
|
||||
final List<String> _tabValues = ['推荐', '排行', '关注'];
|
||||
|
||||
List<List<dynamic>> tabsResult = [[], [], []];
|
||||
|
||||
int index = 0;
|
||||
|
||||
List<PageEntity> pageList = [
|
||||
PageEntity(),
|
||||
PageEntity(),
|
||||
PageEntity(),
|
||||
];
|
||||
|
||||
PageController _controller;
|
||||
TabController _tabController;
|
||||
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
BoxDecoration decoration = BoxDecoration(color: ColorConfig.WhiteBackColor);
|
||||
|
||||
UserInfoPersonalEntityData userInfo = UserInfoPersonalEntityData.fromJson(
|
||||
jsonDecode(SPreferences().getString("onUserInfo")));
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_controller = PageController();
|
||||
_tabController = new TabController(length: _tabValues.length, vsync: this);
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
getOpusRecommend();
|
||||
opusRanking();
|
||||
getFollow();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return new Scaffold(
|
||||
appBar: AppBar(
|
||||
leading: leading(),
|
||||
toolbarHeight: Screen.setHeight(82),
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
title: title(),
|
||||
bottom: bottom(),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(132) - Config.top,
|
||||
margin: EdgeInsets.only(top: 2, bottom: 2),
|
||||
child: PageView(
|
||||
controller: _controller,
|
||||
children: <Widget>[
|
||||
indexView(),
|
||||
rankingView(),
|
||||
userViewList(),
|
||||
],
|
||||
onPageChanged: (e) => {
|
||||
this.setState(() {
|
||||
index = e;
|
||||
})
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 推荐item样式
|
||||
_createGridViewItem(int e) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/worksInfo/${this.tabsResult[0][e].opusId}");
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: NetworkImage(this.tabsResult[0][e].opusImg),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: tabsResult[0][e].opusImg,
|
||||
placeholder: (context, url) => new Container(
|
||||
child: new Center(
|
||||
child: new CircularProgressIndicator(),
|
||||
),
|
||||
width: 160.0,
|
||||
height: 90.0,
|
||||
),
|
||||
errorWidget: (context, url, error) => new Icon(Icons.error),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget leading() {
|
||||
return Align(
|
||||
alignment: Alignment.center,
|
||||
child: GestureDetector(
|
||||
onTapDown: (TapDownDetails tapDownDetails) {
|
||||
clickHead();
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
userInfo.userHeadImg,
|
||||
width: Screen.setWidth(38),
|
||||
height: Screen.setWidth(38),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget title() {
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
// indexSearch
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed("/indexSearch");
|
||||
},
|
||||
child: ExhibitionSearch(),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Icon(Icons.person),
|
||||
Text(
|
||||
"好友",
|
||||
style: TextStyle(fontSize: 12),
|
||||
)
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Icon(Icons.group),
|
||||
Text(
|
||||
"群聊",
|
||||
style: TextStyle(fontSize: 12),
|
||||
)
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget bottom() {
|
||||
return PreferredSize(
|
||||
preferredSize: Size.fromHeight(10),
|
||||
child: Container(
|
||||
height: Screen.setHeight(38),
|
||||
width: Screen.width(context),
|
||||
decoration: BoxDecoration(color: ColorConfig.WhiteBackColor),
|
||||
child: Align(
|
||||
child: TabBar(
|
||||
tabs: _tabValues
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => Tab(
|
||||
child: Container(
|
||||
decoration: index == e
|
||||
? BoxDecoration(
|
||||
color: ColorConfig.ThemeColor,
|
||||
borderRadius:
|
||||
BorderRadius.all(Radius.circular(25.0)),
|
||||
)
|
||||
: decoration,
|
||||
padding: EdgeInsets.only(
|
||||
left: 16, right: 16, top: 6, bottom: 6),
|
||||
child: Text(_tabValues[e],
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: index == e
|
||||
? Colors.white
|
||||
: Color(0XFF7c7c7c))),
|
||||
),
|
||||
))
|
||||
.toList(),
|
||||
indicatorColor: ColorConfig.WhiteBackColor,
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
isScrollable: true,
|
||||
controller: _tabController,
|
||||
labelColor: ColorConfig.ThemeColor,
|
||||
labelPadding: EdgeInsets.only(right: 30, left: 30),
|
||||
unselectedLabelColor: Colors.black,
|
||||
indicatorWeight: 0.1,
|
||||
onTap: (int i) {
|
||||
setState(() {
|
||||
index = i;
|
||||
_controller.jumpToPage(i);
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
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 {
|
||||
this.pageList[index].page = 1;
|
||||
this.pageList[index].isLoad = false;
|
||||
this.tabsResult[index] = [];
|
||||
await requestType(index);
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
_easyRefreshController.finishRefresh();
|
||||
if (!this.pageList[index].isLoad) {
|
||||
this.pageList[index].page++;
|
||||
await requestType(index);
|
||||
} else {
|
||||
await requestType(index);
|
||||
// _easyRefreshController.finishLoad(noMore: true);
|
||||
}
|
||||
_easyRefreshController.finishLoad();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexView() {
|
||||
return easyRefresh(tabsResult[0].length == 0
|
||||
? Container(
|
||||
height: MediaQuery.of(context).size.height / 2,
|
||||
child: Center(
|
||||
child: SpinKitWave(
|
||||
color: ColorConfig.ThemeColor, itemCount: 3, size: 40),
|
||||
),
|
||||
)
|
||||
: ListView(
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
children: [
|
||||
GridView.builder(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
shrinkWrap: true,
|
||||
physics: BouncingScrollPhysics(),
|
||||
itemCount: tabsResult[0].length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _createGridViewItem(index);
|
||||
})
|
||||
]));
|
||||
}
|
||||
|
||||
// 排行
|
||||
Widget rankingView() {
|
||||
return Empty(
|
||||
isShow: tabsResult[1].length <= 0,
|
||||
child: easyRefresh(
|
||||
ListView(
|
||||
children: [
|
||||
...tabsResult[1]
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => _rankingItemView(tabsResult[1][e]))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 排行
|
||||
Widget _rankingItemView(OpusRankingEntity data) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/worksInfo/${data.opusId}");
|
||||
},
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setHeight(200),
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: NetworkImage(data.opusImg),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: data.opusImg,
|
||||
height: Screen.setHeight(200),
|
||||
width: Screen.width(context),
|
||||
placeholder: (context, url) => new Container(
|
||||
child: new Center(
|
||||
child: new CircularProgressIndicator(),
|
||||
),
|
||||
width: 160.0,
|
||||
height: 90.0,
|
||||
),
|
||||
errorWidget: (context, url, error) => new Icon(Icons.error),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Container(
|
||||
height: Screen.setHeight(45),
|
||||
width: 45,
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(30),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
data.userHeadImg,
|
||||
width: Screen.setWidth(38),
|
||||
height: Screen.setWidth(38),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
title: Text(data.userNickname),
|
||||
subtitle: Text(
|
||||
data.userAutograph,
|
||||
maxLines: 1,
|
||||
style: TextStyle(fontSize: 13),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
trailing: Container(
|
||||
width: Screen.setWidth(40),
|
||||
alignment: Alignment.centerRight,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
Icons.thumb_up,
|
||||
size: 18,
|
||||
),
|
||||
SizedBox(
|
||||
width: 5,
|
||||
),
|
||||
Text(data.opusSatisfied.toString())
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Line(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 关注列表view
|
||||
Widget userViewList() {
|
||||
return Empty(
|
||||
isShow: tabsResult[2].length <= 0,
|
||||
child: easyRefresh(
|
||||
GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
children: [
|
||||
...tabsResult[2].asMap().keys.map((e) => userView(e)).toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 关注列表
|
||||
Widget userView(int e) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/worksInfo/${tabsResult[2][e].opusId}");
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
// decoration: BoxDecoration(
|
||||
// image: DecorationImage(
|
||||
// image: NetworkImage(tabsResult[2][e].opusImg),
|
||||
// fit: BoxFit.cover,
|
||||
// ),
|
||||
// ),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: tabsResult[2][e].opusImg,
|
||||
placeholder: (context, url) => new Container(
|
||||
child: new Center(
|
||||
child: new CircularProgressIndicator(),
|
||||
),
|
||||
width: 160.0,
|
||||
height: 90.0,
|
||||
),
|
||||
errorWidget: (context, url, error) => new Icon(Icons.error),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 根据当前不同下标调用不用接口
|
||||
requestType(int e) async {
|
||||
if (e == 0) {
|
||||
return await getOpusRecommend();
|
||||
} else if (e == 1) {
|
||||
return await opusRanking();
|
||||
} else {
|
||||
return await getFollow();
|
||||
}
|
||||
}
|
||||
|
||||
// 推荐
|
||||
getOpusRecommend() async {
|
||||
OpusRecommendData res = await OpusService.getOpusRecommend({
|
||||
"page": this.pageList[0].page,
|
||||
"count": this.pageList[0].count,
|
||||
});
|
||||
if (res == null) {
|
||||
setState(() {
|
||||
this.pageList[0].isLoad = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
this.tabsResult[0] = [...this.tabsResult[0], ...res.result];
|
||||
});
|
||||
}
|
||||
|
||||
// 排行列表
|
||||
opusRanking() async {
|
||||
OpusRankingEntityData res = await OpusService.opusRanking({
|
||||
"page": this.pageList[1].page,
|
||||
"count": this.pageList[1].count,
|
||||
});
|
||||
if (res == null) {
|
||||
setState(() {
|
||||
this.pageList[1].isLoad = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
this.tabsResult[1] = [...this.tabsResult[1], ...res.result];
|
||||
});
|
||||
}
|
||||
|
||||
// 关注列表
|
||||
getFollow() async {
|
||||
FollowData res = await OpusService.getFollow({
|
||||
"page": this.pageList[2].page,
|
||||
"count": this.pageList[2].count,
|
||||
});
|
||||
if (res == null) {
|
||||
setState(() {
|
||||
this.pageList[2].isLoad = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
this.tabsResult[2] = [...this.tabsResult[2], ...res.result];
|
||||
});
|
||||
}
|
||||
}
|
||||
384
moehu/moehu_fontend/lib/views/Index/IndexResultsList.dart
Normal file
384
moehu/moehu_fontend/lib/views/Index/IndexResultsList.dart
Normal file
@@ -0,0 +1,384 @@
|
||||
import 'dart:developer';
|
||||
|
||||
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/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/Index/Index.dart';
|
||||
import 'package:peach/widget/Empty.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
/*
|
||||
* 搜索结果列表页
|
||||
*/
|
||||
class IndexResultsList extends StatefulWidget {
|
||||
final String affKeyword;
|
||||
|
||||
final int afferentType;
|
||||
|
||||
const IndexResultsList({this.affKeyword, this.afferentType = 0});
|
||||
|
||||
@override
|
||||
_IndexResultsList createState() =>
|
||||
_IndexResultsList(affKeyword, afferentType);
|
||||
}
|
||||
|
||||
class _IndexResultsList extends State<IndexResultsList>
|
||||
with SingleTickerProviderStateMixin {
|
||||
final String affKeyword;
|
||||
|
||||
final int afferentType;
|
||||
|
||||
TextEditingController _controller;
|
||||
|
||||
TabController _tabController;
|
||||
PageController _pageController;
|
||||
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
// 当前搜索类型
|
||||
int type = 0;
|
||||
|
||||
List<String> typeList = ['opus', 'user', 'tag'];
|
||||
|
||||
// 搜索值
|
||||
String keyword = '';
|
||||
|
||||
List<PageEntity> page = [PageEntity(), PageEntity(), PageEntity()];
|
||||
|
||||
List<List<dynamic>> listData = [[], [], []];
|
||||
|
||||
bool lock = false;
|
||||
|
||||
_IndexResultsList(this.affKeyword, this.afferentType);
|
||||
|
||||
bool loading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
//初始化,这个函数在生命周期中只调用一次
|
||||
super.initState();
|
||||
_tabController =
|
||||
TabController(initialIndex: this.afferentType, length: 3, vsync: this);
|
||||
_pageController = PageController(initialPage: this.afferentType);
|
||||
type = this.afferentType;
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
_controller = TextEditingController();
|
||||
httpCall();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (loading) return Loading();
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: search(),
|
||||
centerTitle: true,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
bottom: PreferredSize(
|
||||
preferredSize: Size.fromHeight(48),
|
||||
child: Material(
|
||||
//这里设置tab的背景色
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
child: TabBar(
|
||||
controller: _tabController,
|
||||
tabs: [Tab(text: "作品"), Tab(text: "用户"), Tab(text: "标签")],
|
||||
isScrollable: true,
|
||||
indicatorColor: ColorConfig.ThemeColor,
|
||||
indicatorWeight: 2,
|
||||
// indicatorPadding: EdgeInsets.only(left: 20, right: 20),
|
||||
// in
|
||||
indicatorSize: TabBarIndicatorSize.tab,
|
||||
labelColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(fontSize: 15),
|
||||
labelPadding:
|
||||
EdgeInsets.only(left: 50, top: 0, right: 50, bottom: 0),
|
||||
unselectedLabelColor: ColorConfig.TextColor,
|
||||
unselectedLabelStyle: TextStyle(fontSize: 15),
|
||||
onTap: (index) {
|
||||
setType(index);
|
||||
_pageController.jumpToPage(index);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Config.top,
|
||||
margin: EdgeInsets.only(top: 2, bottom: 2),
|
||||
child: PageView(
|
||||
controller: _pageController,
|
||||
children: <Widget>[
|
||||
indexView(),
|
||||
userViewList(),
|
||||
tagView(),
|
||||
],
|
||||
onPageChanged: (index) {
|
||||
// setType(index);
|
||||
_tabController.animateTo(index);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
;
|
||||
}
|
||||
|
||||
Widget search() {
|
||||
return Container(
|
||||
width: Screen.width(context),
|
||||
height: Screen.setHeight(28),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(28.0)),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
textInputAction: TextInputAction.search,
|
||||
onSubmitted: (res) {
|
||||
keyword = res;
|
||||
page[0].page = 1;
|
||||
page[1].page = 1;
|
||||
page[2].page = 1;
|
||||
listData[0] = [];
|
||||
listData[1] = [];
|
||||
listData[2] = [];
|
||||
opusSearch();
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
hintText: "请输入关键字",
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: ColorConfig.TextColor,
|
||||
size: 20,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
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[type].page = 1;
|
||||
listData[type] = [];
|
||||
await opusSearch();
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
_easyRefreshController.finishRefresh();
|
||||
if (!page[type].isLoad) {
|
||||
page[type].page++;
|
||||
await opusSearch();
|
||||
_easyRefreshController.finishLoad();
|
||||
} else {
|
||||
new Future.delayed(Duration(seconds: 1), () {
|
||||
_easyRefreshController.finishLoad();
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget indexView() {
|
||||
return Empty(
|
||||
isShow: listData[0].length <= 0,
|
||||
child: easyRefresh(
|
||||
GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
children: [
|
||||
...listData[0]
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => _createGridViewItem(listData[0][e]))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget tagView() {
|
||||
return Empty(
|
||||
isShow: listData[2].length <= 0,
|
||||
child: easyRefresh(
|
||||
GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 2,
|
||||
),
|
||||
children: [
|
||||
...listData[2]
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => _createGridViewItem(listData[2][e]))
|
||||
.toList()
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 用户列表view
|
||||
Widget userViewList() {
|
||||
return Empty(
|
||||
isShow: listData[1].length <= 0,
|
||||
child: easyRefresh(ListView(
|
||||
children: [
|
||||
...listData[1]
|
||||
.asMap()
|
||||
.keys
|
||||
.map((e) => userView(listData[1][e]))
|
||||
.toList()
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
Widget userView(OpusSearchUserEntityResult data) {
|
||||
return Column(
|
||||
children: [
|
||||
Panel(
|
||||
child: Row(
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed("/personal/${data.userId}");
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
data.userHeadImg,
|
||||
width: Screen.setWidth(40),
|
||||
height: Screen.setWidth(40),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed("/personal/${data.userId}");
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(left: 10),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text("${data.userNickname}"),
|
||||
Text(
|
||||
"${data.userAutograph}",
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
// ElevatedButton(
|
||||
// style: ButtonStyle(
|
||||
// backgroundColor: MaterialStateProperty.resolveWith((states) {
|
||||
// //默认不使用背景颜色
|
||||
// return ColorConfig.ThemeColor;
|
||||
// }),
|
||||
// ),
|
||||
// child: Text('关注'),
|
||||
// onPressed: () {},
|
||||
// ),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider()
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
// 推荐item样式
|
||||
_createGridViewItem(OpusSearchTagEntityResult data) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/worksInfo/${data.opusId}");
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(data.opusImg),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
httpCall() async {
|
||||
keyword = affKeyword;
|
||||
_controller.text = affKeyword;
|
||||
await this.opusSearch();
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
setType(int i) async {
|
||||
type = i;
|
||||
if (listData[type].length <= 0) {
|
||||
await opusSearch();
|
||||
}
|
||||
}
|
||||
|
||||
opusSearch() async {
|
||||
var content = utf8.encode(keyword);
|
||||
var digest = base64Encode(content);
|
||||
dynamic res = await OpusService.opusSearch({
|
||||
"keyword": digest,
|
||||
"type": typeList[type],
|
||||
"page": page[type].page,
|
||||
"count": page[type].count,
|
||||
});
|
||||
dynamic rel;
|
||||
if (type == 0) {
|
||||
rel = OpusSearchTagEntityList.fromJson(res).data;
|
||||
} else if (type == 1) {
|
||||
rel = OpusSearchUserEntityList.fromJson(res).data;
|
||||
} else if (type == 2) {
|
||||
rel = OpusSearchTagEntityList.fromJson(res).data;
|
||||
}
|
||||
if (rel == null) {
|
||||
return;
|
||||
}
|
||||
listData[type] = [...listData[type], ...rel.result];
|
||||
if (rel.result.length < page[type].count) {
|
||||
page[type].isLoad = true;
|
||||
}
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
211
moehu/moehu_fontend/lib/views/Index/IndexSearch.dart
Normal file
211
moehu/moehu_fontend/lib/views/Index/IndexSearch.dart
Normal file
@@ -0,0 +1,211 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/TagService.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/Dynamic/Topic.dart';
|
||||
import 'package:peach/widget/Panel.dart';
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:convert' as convert;
|
||||
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 首页搜索页
|
||||
*/
|
||||
class IndexSearch extends StatefulWidget {
|
||||
final Function clickHead;
|
||||
|
||||
const IndexSearch({Key key, this.clickHead}) : super(key: key);
|
||||
@override
|
||||
_IndexSearch createState() => _IndexSearch();
|
||||
}
|
||||
|
||||
class _IndexSearch extends State<IndexSearch>
|
||||
with SingleTickerProviderStateMixin {
|
||||
TextEditingController _controller;
|
||||
|
||||
List<TagRecommendTagEntityData> recommendTagList = [];
|
||||
|
||||
List<String> historyList = [];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// SharedPreferences 初始化
|
||||
SPreferences.init();
|
||||
getHistory();
|
||||
_controller = TextEditingController(text: "");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return FutureBuilder(
|
||||
future: future(),
|
||||
builder: (context, snapshot) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: search(),
|
||||
toolbarHeight: Screen.setHeight(40),
|
||||
centerTitle: true,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(45) - Config.top,
|
||||
width: Screen.width(context),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setHeight(140),
|
||||
child: Topic(
|
||||
topicList: recommendTagList,
|
||||
onTap: (rel) {
|
||||
setHistory(rel);
|
||||
Modular.to.pushNamed("/indexResultsList/$rel/0");
|
||||
}),
|
||||
),
|
||||
Container(
|
||||
height: Screen.setHeight(200),
|
||||
child: titleSection(
|
||||
"历史搜索",
|
||||
Wrap(
|
||||
crossAxisAlignment: WrapCrossAlignment.end,
|
||||
runSpacing: 5,
|
||||
spacing: 10,
|
||||
children: [
|
||||
...historyList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => GestureDetector(
|
||||
onTap: () {
|
||||
String res = historyList[e];
|
||||
setHistory(res);
|
||||
Modular.to.pushNamed(
|
||||
"/indexResultsList/${res}/0",
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
historyList[e],
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
fontSize: 16),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
)),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget search() {
|
||||
return Container(
|
||||
width: Screen.width(context),
|
||||
height: Screen.setHeight(28),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
borderRadius: BorderRadius.all(Radius.circular(28.0)),
|
||||
),
|
||||
child: TextField(
|
||||
controller: _controller,
|
||||
textInputAction: TextInputAction.search,
|
||||
onSubmitted: (res) {
|
||||
_controller.text = "";
|
||||
setHistory(res);
|
||||
Modular.to.pushNamed("/indexResultsList/$res/0");
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
hintText: "请输入关键字",
|
||||
prefixIcon: Icon(
|
||||
Icons.search,
|
||||
color: ColorConfig.TextColor,
|
||||
size: 20,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
enabledBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget titleSection(String title, Widget child) {
|
||||
return Panel(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start, //分析 2
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.only(bottom: 8.0),
|
||||
child: Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: child,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
future() async {
|
||||
await tagRecommendTag();
|
||||
}
|
||||
|
||||
tagRecommendTag() async {
|
||||
List<TagRecommendTagEntityData> res = await TagService.tagRecommendTag({});
|
||||
if (res != null) {
|
||||
recommendTagList = res.take(5).toList();
|
||||
}
|
||||
}
|
||||
|
||||
setHistory(String value) {
|
||||
int index = historyList.indexOf(value);
|
||||
if (index == -1) {
|
||||
setHistoryList(value);
|
||||
return;
|
||||
}
|
||||
historyList.remove(value);
|
||||
setHistoryList(value);
|
||||
}
|
||||
|
||||
getHistory() {
|
||||
String res = SPreferences().getString("historyList");
|
||||
print(res);
|
||||
if (res != null) {
|
||||
List<String> res =
|
||||
jsonDecode(SPreferences().getString("historyList")).cast<String>();
|
||||
historyList = res;
|
||||
}
|
||||
}
|
||||
|
||||
setHistoryList(String value) {
|
||||
historyList = [value, ...historyList];
|
||||
SPreferences().setString("historyList", convert.jsonEncode(historyList));
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
156
moehu/moehu_fontend/lib/views/Index/PersonalpPop.dart
Normal file
156
moehu/moehu_fontend/lib/views/Index/PersonalpPop.dart
Normal file
@@ -0,0 +1,156 @@
|
||||
import 'dart:convert';
|
||||
|
||||
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/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/PersonalpTitle.dart';
|
||||
|
||||
/*
|
||||
* 首页
|
||||
*/
|
||||
class PersonalpPop extends StatefulWidget {
|
||||
@override
|
||||
_PersonalpPop createState() => _PersonalpPop();
|
||||
}
|
||||
|
||||
class _PersonalpPop extends State<PersonalpPop>
|
||||
with SingleTickerProviderStateMixin {
|
||||
UserInfoPersonalEntityData userInfo = UserInfoPersonalEntityData.fromJson(
|
||||
jsonDecode(SPreferences().getString("onUserInfo")));
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Drawer(
|
||||
child: Container(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
DrawerHeader(
|
||||
child: PersonalpTitle(
|
||||
imgHead: userInfo.userHeadImg,
|
||||
nickname: userInfo.userNickname,
|
||||
autograph: userInfo.userAutograph,
|
||||
fansNums: userInfo.fansNums,
|
||||
satisfiedNums: userInfo.satisfiedNums,
|
||||
followNums: userInfo.followNums,
|
||||
userId: userInfo.userId),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context)
|
||||
.pushNamed("/personal/${userInfo.userId}");
|
||||
},
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.grade),
|
||||
title: Text('个人空间'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pushNamed("/publishingWorks");
|
||||
},
|
||||
child: ListTile(
|
||||
leading: Icon(Icons.add_photo_alternate),
|
||||
title: Text('发布作品'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.record_voice_over),
|
||||
title: Text('我要约稿'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.accessibility_new),
|
||||
title: Text('我要接稿'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.paid),
|
||||
title: Text('创作激励'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.grading),
|
||||
title: Text('投稿管理'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.favorite),
|
||||
title: Text('我的收藏'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.settings_phone),
|
||||
title: Text('联系客服'),
|
||||
trailing: Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
],
|
||||
)),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: InkWell(
|
||||
onTap: () => {
|
||||
Modular.to.pushNamed("/setting")
|
||||
},
|
||||
child: Column(
|
||||
children: [Icon(Icons.settings), Text("设置")],
|
||||
),
|
||||
)
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [Icon(Icons.color_lens), Text("主题")],
|
||||
)),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Column(
|
||||
children: [Icon(Icons.brightness_4), Text("夜间")],
|
||||
)),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/Personal/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/Personal/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
d7f8112d-aaec-40d5-825a-b15602506e25
|
||||
500
moehu/moehu_fontend/lib/views/Personal/Personal.dart
Normal file
500
moehu/moehu_fontend/lib/views/Personal/Personal.dart
Normal file
@@ -0,0 +1,500 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:bot_toast/bot_toast.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/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/BlankPage.dart';
|
||||
import 'package:peach/views/Dynamic/DynamicItem.dart';
|
||||
import 'package:peach/widget/Empty.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
/*
|
||||
* 个人空间
|
||||
*/
|
||||
class Personal extends StatefulWidget {
|
||||
final int userId;
|
||||
|
||||
const Personal({this.userId});
|
||||
|
||||
@override
|
||||
_Personal createState() => _Personal(this.userId);
|
||||
}
|
||||
|
||||
class _Personal extends State<Personal> with SingleTickerProviderStateMixin {
|
||||
final int userId;
|
||||
|
||||
ScrollController nestedScrollViewController;
|
||||
|
||||
List<String> _tabValues = [
|
||||
'动态',
|
||||
'投稿',
|
||||
'收藏',
|
||||
];
|
||||
TabController _tabController;
|
||||
|
||||
double textHeight = 20;
|
||||
|
||||
List<PageEntity> page = [
|
||||
PageEntity(),
|
||||
PageEntity(),
|
||||
PageEntity(),
|
||||
];
|
||||
|
||||
List<DynamicPersonalDynamicEntity> dynamicList = [];
|
||||
|
||||
List<CollectionOpusListEntityResult> collectionOpusList = [];
|
||||
|
||||
List<OpusListEntityResult> opusList = [];
|
||||
|
||||
UserInfoPersonalEntityData userInfo;
|
||||
|
||||
_Personal(this.userId);
|
||||
|
||||
bool loading = true;
|
||||
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
UserInfo _userInfo =
|
||||
UserInfo.fromJson(jsonDecode(SPreferences().getString("userInfo")));
|
||||
|
||||
bool isCheckUser = false;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
///初始化,这个函数在生命周期中只调用一次
|
||||
super.initState();
|
||||
nestedScrollViewController = ScrollController();
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
_tabController = TabController(length: _tabValues.length, vsync: this);
|
||||
future();
|
||||
|
||||
nestedScrollViewController.addListener(() {
|
||||
if (nestedScrollViewController.position.pixels ==
|
||||
nestedScrollViewController.position.maxScrollExtent) {
|
||||
rollingToTheBottom();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (loading) return Loading();
|
||||
return Scaffold(
|
||||
body: NestedScrollView(
|
||||
controller: nestedScrollViewController,
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
expandedHeight: Screen.setHeight(210) + textHeight,
|
||||
// collapsedHeight: Screen.setHeight(20) + Config.top,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setHeight(90),
|
||||
decoration: new BoxDecoration(
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(
|
||||
"https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1770575461,2828994027&fm=26&gp=0.jpg"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: Screen.setHeight(155),
|
||||
child: Panel(
|
||||
child: PersonalpTitle(
|
||||
headImgHeight: 80,
|
||||
isEditing: true,
|
||||
textHeight: textHeight,
|
||||
isOpenFollow: _userInfo.userId != userId,
|
||||
isFollow: isCheckUser,
|
||||
isText: textHeight > 20 ? true : false,
|
||||
imgHead: userInfo.userHeadImg,
|
||||
nickname: userInfo.userNickname,
|
||||
autograph: userInfo.userAutograph,
|
||||
fansNums: userInfo.fansNums,
|
||||
satisfiedNums: userInfo.satisfiedNums,
|
||||
followNums: userInfo.followNums,
|
||||
userId: userInfo.userId,
|
||||
onExpand: (height) {
|
||||
setState(
|
||||
() {
|
||||
textHeight = height;
|
||||
},
|
||||
);
|
||||
},
|
||||
opusFollowUser: () {
|
||||
opusFollowUser(userId);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: CircleTransparentIcon(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: CircleTransparentIcon(
|
||||
icon: Transform.rotate(
|
||||
//旋转90度
|
||||
angle: math.pi / 2,
|
||||
child: Icon(Icons.more_horiz),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SliverPersistentHeader(
|
||||
delegate: _SliverTabBarDelegate(
|
||||
Container(
|
||||
child: CustomTabBar(
|
||||
tabController: _tabController,
|
||||
tabValues: _tabValues,
|
||||
),
|
||||
),
|
||||
),
|
||||
pinned: true,
|
||||
),
|
||||
];
|
||||
},
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(400) - Config.top,
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
dynamicView(),
|
||||
contributionList(),
|
||||
_collectionList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 动态列表
|
||||
Widget dynamicView() {
|
||||
return Empty(
|
||||
isShow: dynamicList.length <= 0,
|
||||
child: MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
removeBottom: true,
|
||||
child: ListView(
|
||||
children: [
|
||||
...dynamicList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => DynamicItem(
|
||||
dynamicData: dynamicList[0],
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
page[0].isLoad ? loadingComplete() : null
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 投稿列表
|
||||
Widget contributionList() {
|
||||
return Empty(
|
||||
isShow: opusList.length <= 0,
|
||||
child: MediaQuery.removePadding(
|
||||
removeTop: true,
|
||||
context: context,
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
children: [
|
||||
...opusList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed("/worksInfo/${opusList[e].opusId}");
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
opusList[e].opusImg,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 收藏列表
|
||||
Widget _collectionList() {
|
||||
return Empty(
|
||||
isShow: collectionOpusList.length <= 0,
|
||||
child: MediaQuery.removePadding(
|
||||
removeTop: true,
|
||||
context: context,
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
children: [
|
||||
...collectionOpusList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed(
|
||||
"/worksInfo/${collectionOpusList[e].opusId}");
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
collectionOpusList[e].opusImg,
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 加载完成
|
||||
loadingComplete() {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 10,
|
||||
bottom: 10,
|
||||
),
|
||||
child: Text(
|
||||
"再这么找也没有啦",
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
future() async {
|
||||
await dynamicPersonalDynamic();
|
||||
await getUserInfo();
|
||||
await getCollectionOpusList();
|
||||
await getOpusList();
|
||||
await isCheckUserIsFollow(userId);
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
// 滚动触底时触发
|
||||
rollingToTheBottom() async {
|
||||
int index = _tabController.index;
|
||||
if (index == 0) {
|
||||
if (page[0].isLoad) return;
|
||||
page[0].page++;
|
||||
dynamicPersonalDynamic();
|
||||
} else if (index == 2) {
|
||||
if (page[2].isLoad) return;
|
||||
page[2].page++;
|
||||
getCollectionOpusList();
|
||||
}
|
||||
}
|
||||
|
||||
// 动态列表
|
||||
dynamicPersonalDynamic() async {
|
||||
print(userId);
|
||||
DynamicPersonalDynamicEntityData res =
|
||||
await DynamicService.dynamicPersonalDynamic(
|
||||
{
|
||||
"page": page[0].page,
|
||||
"count": page[0].count,
|
||||
"userid": userId,
|
||||
},
|
||||
);
|
||||
if (res == null) return;
|
||||
if (res.result.length < page[0].count) {
|
||||
page[0].isLoad = true;
|
||||
}
|
||||
setState(() {
|
||||
dynamicList = [...dynamicList, ...res.result];
|
||||
});
|
||||
}
|
||||
|
||||
// 个人信息
|
||||
getUserInfo() async {
|
||||
UserInfoPersonalEntityData res = await UserService.UserInfo({
|
||||
'user_id': userId,
|
||||
});
|
||||
setState(() {
|
||||
userInfo = res;
|
||||
});
|
||||
}
|
||||
|
||||
// 设置关注
|
||||
opusFollowUser(int id) async {
|
||||
Null res = await OpusService.opusFollowUser({
|
||||
"user_to_id": id,
|
||||
});
|
||||
if (isCheckUser) {
|
||||
BotToast.showText(text: "取消关注");
|
||||
} else {
|
||||
BotToast.showText(text: "关注成功");
|
||||
}
|
||||
await isCheckUserIsFollow(id);
|
||||
this.setState(() {});
|
||||
}
|
||||
|
||||
isCheckUserIsFollow(int id) async {
|
||||
bool res = await OpusService.isCheckUserIsFollow({
|
||||
"user_to_id": id,
|
||||
});
|
||||
isCheckUser = res;
|
||||
}
|
||||
|
||||
// 收藏列表
|
||||
getCollectionOpusList() async {
|
||||
CollectionOpusListEntityData res = await OpusService.collectionOpusList({
|
||||
'userid': userId,
|
||||
"page": page[2].page,
|
||||
"count": page[2].count,
|
||||
});
|
||||
if (res == null) return;
|
||||
if (res.result.length < page[2].count) {
|
||||
page[2].isLoad = true;
|
||||
}
|
||||
setState(() {
|
||||
collectionOpusList = res.result;
|
||||
});
|
||||
}
|
||||
|
||||
getOpusList() async {
|
||||
OpusListEntityData res = await OpusService.getOpusList({
|
||||
'userid': userId,
|
||||
"page": page[1].page,
|
||||
"count": page[1].count,
|
||||
});
|
||||
if (res == null) return;
|
||||
if (res.result.length < page[1].count) {
|
||||
page[1].isLoad = true;
|
||||
}
|
||||
setState(() {
|
||||
opusList = res.result;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
class CustomTabBar extends StatefulWidget {
|
||||
final TabController tabController;
|
||||
final List<String> tabValues;
|
||||
|
||||
CustomTabBar({Key key, this.tabController, this.tabValues}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CustomTabBarState createState() => _CustomTabBarState();
|
||||
}
|
||||
|
||||
class _CustomTabBarState extends State<CustomTabBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PreferredSize(
|
||||
preferredSize: Size.fromHeight(30),
|
||||
child: Container(
|
||||
width: Screen.width(context),
|
||||
height: Screen.setHeight(40),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: ColorConfig.LineColor, width: 1),
|
||||
),
|
||||
),
|
||||
child: TabBar(
|
||||
unselectedLabelColor: ColorConfig.TextColor,
|
||||
labelColor: ColorConfig.ThemeColor,
|
||||
indicatorColor: ColorConfig.ThemeColor,
|
||||
indicatorPadding: EdgeInsets.only(left: 30, right: 30),
|
||||
controller: widget.tabController,
|
||||
tabs: widget.tabValues
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => Tab(
|
||||
child: Text(
|
||||
widget.tabValues[e],
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SliverTabBarDelegate extends SliverPersistentHeaderDelegate {
|
||||
final widget;
|
||||
|
||||
_SliverTabBarDelegate(this.widget);
|
||||
|
||||
@override
|
||||
double get minExtent => 40.0;
|
||||
|
||||
@override
|
||||
double get maxExtent => 40.0;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return widget;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRebuild(_SliverTabBarDelegate oldDelegate) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
362
moehu/moehu_fontend/lib/views/Personal/PersonalSpace.dart
Normal file
362
moehu/moehu_fontend/lib/views/Personal/PersonalSpace.dart
Normal file
@@ -0,0 +1,362 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/BlankPage.dart';
|
||||
import 'package:peach/views/Dynamic/DynamicItem.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
import 'dart:math' as math;
|
||||
|
||||
/*
|
||||
* 个人空间
|
||||
*/
|
||||
class Personal extends StatefulWidget {
|
||||
final String isLeading;
|
||||
|
||||
const Personal({this.isLeading = '0'});
|
||||
|
||||
@override
|
||||
_Personal createState() => _Personal(this.isLeading);
|
||||
}
|
||||
|
||||
class _Personal extends State<Personal> with SingleTickerProviderStateMixin {
|
||||
final String isLeading;
|
||||
|
||||
List<String> _tabValues = [
|
||||
'动态',
|
||||
'投稿',
|
||||
'收藏',
|
||||
];
|
||||
TabController _tabController;
|
||||
|
||||
double textHeight = 20;
|
||||
|
||||
PageEntity page = PageEntity();
|
||||
|
||||
List<DynamicPersonalDynamicEntity> dynamicList = [];
|
||||
|
||||
UserInfo _userInfo =
|
||||
UserInfo.fromJson(jsonDecode(SPreferences().getString("userInfo")));
|
||||
|
||||
_Personal(this.isLeading);
|
||||
|
||||
bool loading = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
///初始化,这个函数在生命周期中只调用一次
|
||||
super.initState();
|
||||
_tabController = TabController(length: _tabValues.length, vsync: this);
|
||||
future();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (loading) return Loading();
|
||||
return Scaffold(
|
||||
body: NestedScrollView(
|
||||
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
|
||||
return [
|
||||
SliverAppBar(
|
||||
pinned: true,
|
||||
expandedHeight: Screen.setHeight(190) + textHeight,
|
||||
collapsedHeight: Screen.setHeight(20) + Config.top,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
background: Container(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setHeight(90),
|
||||
decoration: new BoxDecoration(
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: NetworkImage(
|
||||
"https://dss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1770575461,2828994027&fm=26&gp=0.jpg"),
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: Screen.setHeight(140),
|
||||
child: Panel(
|
||||
child: PersonalpTitle(
|
||||
headImgHeight: 80,
|
||||
isEditing: true,
|
||||
textHeight: textHeight,
|
||||
isText: textHeight > 20 ? true : false,
|
||||
onExpand: (height) {
|
||||
setState(
|
||||
() {
|
||||
textHeight = height;
|
||||
},
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
leading: isLeading == '1'
|
||||
? null
|
||||
: Container(
|
||||
width: 1,
|
||||
height: 1,
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: CircleTransparentIcon(
|
||||
icon: Icon(
|
||||
Icons.search,
|
||||
size: 18,
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: CircleTransparentIcon(
|
||||
icon: Transform.rotate(
|
||||
//旋转90度
|
||||
angle: math.pi / 2,
|
||||
child: Icon(Icons.more_horiz),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SliverPersistentHeader(
|
||||
delegate: _SliverTabBarDelegate(
|
||||
Container(
|
||||
child: CustomTabBar(
|
||||
tabController: _tabController,
|
||||
tabValues: _tabValues,
|
||||
),
|
||||
),
|
||||
),
|
||||
pinned: true,
|
||||
),
|
||||
];
|
||||
},
|
||||
body: TabBarView(
|
||||
controller: _tabController,
|
||||
children: [
|
||||
MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
removeBottom: true,
|
||||
child: ListView(
|
||||
children: [
|
||||
...dynamicList
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => DynamicItem(
|
||||
dynamicData: dynamicList[0],
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
Container(
|
||||
height: 80,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
BlankPage(),
|
||||
_collectionList()
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 推荐item样式
|
||||
Widget _collectionList() {
|
||||
return MediaQuery.removePadding(
|
||||
removeTop: true,
|
||||
context: context,
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 3,
|
||||
),
|
||||
children: [
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// "/worksInfo",
|
||||
// arguments: WorksInfoProps(this.tabsResult[index][e].opusId),
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://upload.jianshu.io/users/upload_avatars/5685558/23e20d58-c5e1-4fd6-90d4-a3752cbe7d6a",
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// "/worksInfo",
|
||||
// arguments: WorksInfoProps(this.tabsResult[index][e].opusId),
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://upload.jianshu.io/users/upload_avatars/5685558/23e20d58-c5e1-4fd6-90d4-a3752cbe7d6a",
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// "/worksInfo",
|
||||
// arguments: WorksInfoProps(this.tabsResult[index][e].opusId),
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://upload.jianshu.io/users/upload_avatars/5685558/23e20d58-c5e1-4fd6-90d4-a3752cbe7d6a",
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
// Navigator.of(context).pushNamed(
|
||||
// "/worksInfo",
|
||||
// arguments: WorksInfoProps(this.tabsResult[index][e].opusId),
|
||||
// );
|
||||
},
|
||||
child: Container(
|
||||
height: Screen.width(context) / 2,
|
||||
width: Screen.width(context) / 2,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(
|
||||
"https://upload.jianshu.io/users/upload_avatars/5685558/23e20d58-c5e1-4fd6-90d4-a3752cbe7d6a",
|
||||
),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
future() async {
|
||||
await dynamicPersonalDynamic();
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
dynamicPersonalDynamic() async {
|
||||
DynamicPersonalDynamicEntityData res =
|
||||
await DynamicService.dynamicPersonalDynamic(
|
||||
{
|
||||
"page": page.page,
|
||||
"count": page.count,
|
||||
"userid": _userInfo.userId,
|
||||
},
|
||||
);
|
||||
dynamicList = res.result;
|
||||
}
|
||||
}
|
||||
|
||||
class CustomTabBar extends StatefulWidget {
|
||||
final TabController tabController;
|
||||
final List<String> tabValues;
|
||||
|
||||
CustomTabBar({Key key, this.tabController, this.tabValues}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CustomTabBarState createState() => _CustomTabBarState();
|
||||
}
|
||||
|
||||
class _CustomTabBarState extends State<CustomTabBar> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PreferredSize(
|
||||
preferredSize: Size.fromHeight(30),
|
||||
child: Container(
|
||||
width: Screen.width(context),
|
||||
height: Screen.setHeight(40),
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
border: Border(
|
||||
bottom: BorderSide(color: ColorConfig.LineColor, width: 1),
|
||||
),
|
||||
),
|
||||
child: TabBar(
|
||||
unselectedLabelColor: ColorConfig.TextColor,
|
||||
labelColor: ColorConfig.ThemeColor,
|
||||
indicatorColor: ColorConfig.ThemeColor,
|
||||
indicatorPadding: EdgeInsets.only(left: 30, right: 30),
|
||||
controller: widget.tabController,
|
||||
tabs: widget.tabValues
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => Tab(
|
||||
child: Text(
|
||||
widget.tabValues[e],
|
||||
style: TextStyle(fontSize: 18),
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SliverTabBarDelegate extends SliverPersistentHeaderDelegate {
|
||||
final widget;
|
||||
|
||||
_SliverTabBarDelegate(this.widget);
|
||||
|
||||
@override
|
||||
double get minExtent => 40.0;
|
||||
|
||||
@override
|
||||
double get maxExtent => 40.0;
|
||||
|
||||
@override
|
||||
Widget build(
|
||||
BuildContext context, double shrinkOffset, bool overlapsContent) {
|
||||
return widget;
|
||||
}
|
||||
|
||||
@override
|
||||
bool shouldRebuild(_SliverTabBarDelegate oldDelegate) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
236
moehu/moehu_fontend/lib/views/Personal/Setting.dart
Normal file
236
moehu/moehu_fontend/lib/views/Personal/Setting.dart
Normal file
@@ -0,0 +1,236 @@
|
||||
import 'dart:io';
|
||||
|
||||
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/config/Index.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/widget/CellWidget.dart';
|
||||
import 'package:toast/toast.dart';
|
||||
|
||||
class Setting extends StatefulWidget {
|
||||
@override
|
||||
_Setting createState() => _Setting();
|
||||
}
|
||||
|
||||
class _Setting extends State<Setting> {
|
||||
String cacheSize = "0.00B";
|
||||
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
ComputeCache();
|
||||
}
|
||||
|
||||
Future<void> ComputeCache() async {
|
||||
String size = await ClearCache.loadCache();
|
||||
setState(() {
|
||||
cacheSize = size;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
elevation: 0.0,
|
||||
title: Text("设置", style: TextStyle(color: ColorConfig.BlackBackColor),),
|
||||
centerTitle: true,
|
||||
backgroundColor: ColorConfig.WhiteBackColor,
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConfig.BlackBackColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
body: SingleChildScrollView(
|
||||
scrollDirection: Axis.vertical,
|
||||
physics: BouncingScrollPhysics(),
|
||||
child: Container(
|
||||
color: ColorConfig.LineColor,
|
||||
child: Column(
|
||||
children: [
|
||||
CellWidget(
|
||||
leftText: Text("账号设置", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("个人资料", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("安全隐私", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 18,
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("推送设置", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("消息设置", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("屏蔽设置", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("清理缓存", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text(cacheSize,style: TextStyle(fontSize: Screen.setFontSize(12),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
title: Row(
|
||||
children: [
|
||||
Icon(Icons.delete),
|
||||
Text("清除缓存")
|
||||
],
|
||||
),
|
||||
content: Container(
|
||||
height: Screen.setHeight(50),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("此操作将删除您的App的所有缓存数据"),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text('取消', style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("清除", style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
bool status = await ClearCache.clearCache();
|
||||
await ComputeCache();
|
||||
if (status) {
|
||||
Toast.show("清除成功", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
}
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("其他设置", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 18,
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("意见反馈", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
onTap: () {
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Divider(height: 1),
|
||||
CellWidget(
|
||||
leftText: Text("检查更新", style: TextStyle(fontSize: Screen.setFontSize(14),color: ColorConfig.TextColor)),
|
||||
rightText: Text("v"+Config.packageInfo.version,style: TextStyle(fontSize: Screen.setFontSize(12),color: Color.fromARGB(87, 0, 0, 0))),
|
||||
onTap: () async {
|
||||
bool status = await CheckUpdate().check(context);
|
||||
if (!status) {
|
||||
Toast.show("已是最新版", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
|
||||
}
|
||||
// Modular.to.pushNamed('');
|
||||
},
|
||||
),
|
||||
Container(
|
||||
height: 18,
|
||||
),
|
||||
InkWell(
|
||||
onTap: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
title: Text("退出登录"),
|
||||
content: Container(
|
||||
height: Screen.setHeight(40),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("退出后无法再接受到好友消息,您确定退出此次登录吗?"),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text('取消', style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("确定", style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () async {
|
||||
await SPreferences().setBool("isLogin", false);
|
||||
Modular.to.pushReplacementNamed('/signUp');
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
height: 48,
|
||||
alignment: Alignment.center,
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
width: Screen.width(context),
|
||||
child: Text("退出登录", style: TextStyle(fontSize: Screen.setFontSize(15)),),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/PublishingWorks/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/PublishingWorks/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
1ffb38a9-7069-4d2d-9634-f36c2dd2c8a8
|
||||
@@ -0,0 +1,648 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/gestures.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
|
||||
import 'package:flutter_swiper/flutter_swiper.dart';
|
||||
import 'package:group_button/group_button.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/OpusService.dart';
|
||||
import 'package:peach/service/PublicService.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/ImageView/ImageView.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 发布作品
|
||||
*/
|
||||
class PublishingWorks extends StatefulWidget {
|
||||
@override
|
||||
_PublishingWorks createState() => _PublishingWorks();
|
||||
}
|
||||
|
||||
class _PublishingWorks extends State<PublishingWorks>
|
||||
with SingleTickerProviderStateMixin {
|
||||
var count = 1;
|
||||
|
||||
List<ImagePickerEntity> imageList = [];
|
||||
|
||||
List<String> imageUrl = [];
|
||||
|
||||
List<String> tagList = [];
|
||||
|
||||
//标题
|
||||
TextEditingController titleText = TextEditingController();
|
||||
|
||||
//介绍
|
||||
TextEditingController introduceText = TextEditingController();
|
||||
|
||||
// tag标签
|
||||
TextEditingController tagText = TextEditingController();
|
||||
bool isTag = false;
|
||||
|
||||
// 公开范围
|
||||
List<String> jurisdiction = [
|
||||
"所有人",
|
||||
"好友",
|
||||
"不公开",
|
||||
];
|
||||
// 公开范围单选框
|
||||
int _jurisdiction = 0;
|
||||
|
||||
// 作品类型列表
|
||||
int _original = 0;
|
||||
|
||||
// 定时发布时间
|
||||
String _opusTime = "";
|
||||
|
||||
//是否定时发布
|
||||
var _checkValue = false;
|
||||
|
||||
bool syncDynamic = true;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
tagText.addListener(_onTagTextChange);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
tagText.removeListener(_onTagTextChange);
|
||||
BotToast.closeAllLoading();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
_onTagTextChange() {
|
||||
if (tagText.text.length > 0) {
|
||||
setState(() {
|
||||
isTag = true;
|
||||
});
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
isTag = false;
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
// ignore: missing_return
|
||||
onWillPop: () async {
|
||||
await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (context) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: AlertDialog(
|
||||
title: Text("温馨提示"),
|
||||
content: Container(
|
||||
height: Screen.setHeight(40),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("您当前正在发布作品,退出后将丢失现在的内容,确定吗?"),
|
||||
],
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
FlatButton(
|
||||
child: Text('取消', style: TextStyle(color: ColorConfig.ThemeColor),),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
),
|
||||
FlatButton(
|
||||
child: Text("确定", style: TextStyle(color: ColorConfig.NoActiveColor),),
|
||||
onPressed: () async {
|
||||
Navigator.of(context)..pop()..pop();
|
||||
}
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
},
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
// 触摸收起键盘
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
centerTitle: true,
|
||||
title: Text("作品发布"),
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: Screen.width(context),
|
||||
height: 200,
|
||||
margin: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: new Swiper(
|
||||
loop: false,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
if (index + 1 == count) {
|
||||
return ImagePickerWidget(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: ColorConfig.LineColor,
|
||||
border: new Border.all(
|
||||
color: Color(0xFFFF0000),
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Image.asset(
|
||||
R.libStaticAddTo,
|
||||
fit: BoxFit.fill,
|
||||
width: 50,
|
||||
height: 50,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChange: (ImagePickerEntity pickedFile) {
|
||||
getImage(pickedFile);
|
||||
});
|
||||
} else {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
new FadeRoute(
|
||||
page: PhotoViewGalleryScreen(
|
||||
images: imageList,
|
||||
index: index,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Image.file(
|
||||
imageList[index]?.getPath,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
itemCount: count,
|
||||
viewportFraction: 0.6,
|
||||
scale: 0.9,
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Panel(
|
||||
child: Column(
|
||||
children: [
|
||||
titleConten(
|
||||
"标题",
|
||||
"",
|
||||
TextField(
|
||||
controller: titleText,
|
||||
maxLength: 32,
|
||||
decoration: InputDecoration(
|
||||
hintText: "输入标题",
|
||||
isDense: true,
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
titleConten(
|
||||
"说明",
|
||||
"",
|
||||
TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: 5,
|
||||
minLines: 1,
|
||||
controller: introduceText,
|
||||
maxLength: 2000,
|
||||
decoration: InputDecoration(
|
||||
hintText: "输入说明",
|
||||
isDense: true,
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
onChanged: (str) {
|
||||
print(str);
|
||||
},
|
||||
),
|
||||
),
|
||||
titleConten(
|
||||
"标签",
|
||||
"",
|
||||
Column(
|
||||
children: [
|
||||
label(),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: TextField(
|
||||
keyboardType: TextInputType.multiline,
|
||||
maxLines: 5,
|
||||
minLines: 1,
|
||||
controller: tagText,
|
||||
maxLength: 10,
|
||||
decoration: InputDecoration(
|
||||
hintText: "输入标签",
|
||||
isDense: true,
|
||||
labelStyle: TextStyle(
|
||||
color: Colors.red,
|
||||
),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
isTag
|
||||
? IconButton(
|
||||
icon: Icon(Icons.add),
|
||||
iconSize: 30,
|
||||
color: ColorConfig.ThemeColor,
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
tagList.add(tagText.text);
|
||||
tagText.text = "";
|
||||
});
|
||||
},
|
||||
)
|
||||
: IconButton(
|
||||
icon: Icon(Icons.add),
|
||||
iconSize: 30,
|
||||
splashColor: Colors.transparent,
|
||||
highlightColor: Colors.transparent,
|
||||
color: ColorConfig.ThemeOtherColor,
|
||||
onPressed: () {},
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
titleConten(
|
||||
"公开范围",
|
||||
"",
|
||||
GroupButton(
|
||||
isRadio: true,
|
||||
spacing: 10,
|
||||
selectedColor: ColorConfig.ThemeColor,
|
||||
onSelected: (index, isSelected) =>
|
||||
_jurisdiction = index,
|
||||
buttons: jurisdiction,
|
||||
),
|
||||
),
|
||||
titleConten(
|
||||
"作品类型",
|
||||
"",
|
||||
GroupButton(
|
||||
isRadio: true,
|
||||
spacing: 10,
|
||||
selectedColor: ColorConfig.ThemeColor,
|
||||
onSelected: (index, isSelected) => _original = index,
|
||||
buttons: [
|
||||
"原创作品",
|
||||
"其他",
|
||||
],
|
||||
),
|
||||
),
|
||||
// titleConten(
|
||||
// "同步到动态",
|
||||
// "",
|
||||
// GroupButton(
|
||||
// isRadio: true,
|
||||
// spacing: 10,
|
||||
// selectedColor: ColorConfig.ThemeColor,
|
||||
// onSelected: (index, isSelected) =>
|
||||
// {syncDynamic = index == 0 ? true : false},
|
||||
// buttons: [
|
||||
// "同步",
|
||||
// "不同步",
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
titleConten(
|
||||
"定时发布",
|
||||
"",
|
||||
Container(
|
||||
// constraints: BoxConstraints(
|
||||
// maxHeight: 300,
|
||||
// maxWidth: 200,
|
||||
// ),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
activeColor: ColorConfig.ThemeColor,
|
||||
value: _checkValue,
|
||||
onChanged: (value) {
|
||||
setState(() {
|
||||
_checkValue = value;
|
||||
});
|
||||
},
|
||||
),
|
||||
Text("指定发布时间"),
|
||||
_checkValue
|
||||
? Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
DatePicker.showDateTimePicker(
|
||||
context,
|
||||
showTitleActions: true,
|
||||
onConfirm: (date) {
|
||||
setState(
|
||||
() {
|
||||
_opusTime =
|
||||
Tool.dateAndTimeToString(
|
||||
date.millisecondsSinceEpoch,
|
||||
formart: {
|
||||
"y-m": "/",
|
||||
"m-d": "/",
|
||||
"h-m": ":",
|
||||
"m-s": ":"
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
currentTime: DateTime.now(),
|
||||
locale: LocaleType.zh,
|
||||
);
|
||||
},
|
||||
child: Text(
|
||||
_opusTime.length > 0
|
||||
? _opusTime
|
||||
: '请选择时间',
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
"以下作品禁止发布。请在发布之前进行确认。",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"1.他人制作的作品,发售中的商品图像,第三方持有权利的图像、游戏、视频作品中的角色,包含截图画面的作品。",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"2.挪用以上画面,从最初开始就完全不是自己创作的作品。",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"3.作品以外的照片画面。",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
Text(
|
||||
"违反作品投稿利用规则的用户,将会被停止发布作品公开,停止账号使用。",
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(fontSize: 12),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: EdgeInsets.only(left: 10, right: 10),
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: '使用条款',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 12,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
print('onTap');
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 20),
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: '凡违反',
|
||||
style: TextStyle(
|
||||
fontSize: 11, color: Color(0xFF999999)),
|
||||
children: [
|
||||
TextSpan(
|
||||
text: '使用条款',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
print('onTap');
|
||||
},
|
||||
),
|
||||
TextSpan(text: "和"),
|
||||
TextSpan(
|
||||
text: '用户须知',
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontWeight: FontWeight.bold),
|
||||
recognizer: TapGestureRecognizer()
|
||||
..onTap = () {
|
||||
print('onTap');
|
||||
},
|
||||
),
|
||||
TextSpan(text: "的作品将予以删除"),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 200,
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith(
|
||||
(states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
return ColorConfig.ThemeOtherColor;
|
||||
}
|
||||
//默认不使用背景颜色
|
||||
return ColorConfig.ThemeColor;
|
||||
},
|
||||
),
|
||||
),
|
||||
child: Text("发布", style: TextStyle(fontSize: 20)),
|
||||
onPressed: () {
|
||||
opusPushOpus();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget titleConten(String title, String rightText, Widget child) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(bottom: 10),
|
||||
child: ListTile(
|
||||
title: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
rightText,
|
||||
style: TextStyle(color: ColorConfig.ThemeColor, fontSize: 14),
|
||||
),
|
||||
],
|
||||
),
|
||||
subtitle: Builder(
|
||||
builder: (context) {
|
||||
return Container(
|
||||
width: Screen.width(context),
|
||||
child: child,
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget label() {
|
||||
return Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Wrap(
|
||||
spacing: 5,
|
||||
runSpacing: 1,
|
||||
children: List.generate(
|
||||
tagList.length,
|
||||
(index) {
|
||||
return MediaQuery.removePadding(
|
||||
removeTop: true,
|
||||
removeBottom: true,
|
||||
context: context,
|
||||
child: RawChip(
|
||||
label: Text(tagList[index]),
|
||||
deleteIcon: Icon(
|
||||
Icons.close,
|
||||
size: 16,
|
||||
),
|
||||
deleteIconColor: Colors.red,
|
||||
deleteButtonTooltipMessage: '删除',
|
||||
onDeleted: () {
|
||||
setState(() {
|
||||
tagList.remove(tagList[index]);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
getImage(ImagePickerEntity pickedFile) async {
|
||||
setState(() {
|
||||
imageList = [...imageList, pickedFile];
|
||||
count = imageList.length + 1;
|
||||
});
|
||||
toolUploadFile(pickedFile.getPath);
|
||||
}
|
||||
|
||||
toolUploadFile(File file) async {
|
||||
BotToast.showLoading();
|
||||
String path = file.path;
|
||||
var name = path.substring(path.lastIndexOf("/") + 1, path.length);
|
||||
FormData formdata = FormData.fromMap(
|
||||
{"file": await MultipartFile.fromFile(path, filename: name)});
|
||||
ToolUploadFileEntityData res = await PublicService.toolUploadFile(formdata);
|
||||
imageUrl.add(res.imgUrl);
|
||||
BotToast.closeAllLoading();
|
||||
}
|
||||
|
||||
opusPushOpus() async {
|
||||
if (imageUrl.length <= 0) {
|
||||
return BotToast.showText(text: "请上传作品");
|
||||
}
|
||||
if (titleText.text == "") {
|
||||
return BotToast.showText(text: "请输入作品标题");
|
||||
}
|
||||
if (tagList.length <= 0) {
|
||||
return BotToast.showText(text: "请填写标签");
|
||||
}
|
||||
Null res = await OpusService.opusPushOpus({
|
||||
"opus_title": titleText.text,
|
||||
"opus_introduce": introduceText.text,
|
||||
"opus_tags": tagList,
|
||||
"opus_imgs": imageUrl,
|
||||
"opus_jurisdiction": _jurisdiction + 1,
|
||||
"opus_original": _original + 1,
|
||||
"opus_time": _checkValue ? _opusTime : "",
|
||||
"opus_syncDynamic": syncDynamic
|
||||
});
|
||||
BotToast.showText(text: "发布成功");
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/ReleaseNews/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/ReleaseNews/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
9c804fe9-1882-4f24-8768-14a2252e122c
|
||||
226
moehu/moehu_fontend/lib/views/ReleaseNews/ReleaseNews.dart
Normal file
226
moehu/moehu_fontend/lib/views/ReleaseNews/ReleaseNews.dart
Normal file
@@ -0,0 +1,226 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/event/_.dart';
|
||||
import 'package:peach/service/PublicService.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/Screen.dart';
|
||||
import 'package:peach/widget/Panel.dart';
|
||||
import 'package:peach/widget/_.dart';
|
||||
|
||||
/*
|
||||
* 发布动态
|
||||
*/
|
||||
class ReleaseNews extends StatefulWidget {
|
||||
@override
|
||||
_ReleaseNews createState() => _ReleaseNews();
|
||||
}
|
||||
|
||||
class _ReleaseNews extends State<ReleaseNews>
|
||||
with SingleTickerProviderStateMixin {
|
||||
List<ImagePickerEntity> imgList = [];
|
||||
List<String> imageUrl = [];
|
||||
|
||||
// tag标签
|
||||
TextEditingController introduce = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: ColorConfig.WhiteBackColor,
|
||||
// brightness: Brightness.dark,
|
||||
leading: GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
child: Icon(
|
||||
Icons.arrow_back,
|
||||
color: ColorConfig.BlackBackColor,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
width: Screen.setWidth(80),
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
margin: EdgeInsets.only(right: 10),
|
||||
child: RaisedButton(
|
||||
color: ColorConfig.ThemeColor,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
),
|
||||
child: Text(
|
||||
'发布',
|
||||
style: TextStyle(color: ColorConfig.WhiteBackColor),
|
||||
),
|
||||
onPressed: () {
|
||||
dynamicPush();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context),
|
||||
child: Panel(
|
||||
child: MediaQuery.removePadding(
|
||||
context: context,
|
||||
removeTop: true,
|
||||
removeBottom: true,
|
||||
child: ListView(
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setHeight(200),
|
||||
child: TextField(
|
||||
maxLines: 8,
|
||||
controller: introduce,
|
||||
decoration: InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.symmetric(horizontal: 8, vertical: 10),
|
||||
filled: true,
|
||||
fillColor: Colors.transparent,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.transparent),
|
||||
),
|
||||
hintText: '这一刻的想法',
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Colors.transparent),
|
||||
),
|
||||
),
|
||||
style: TextStyle(fontSize: 14),
|
||||
maxLength: 255,
|
||||
),
|
||||
),
|
||||
// Align(
|
||||
// alignment: Alignment.centerRight,
|
||||
// child: Text(
|
||||
// "10/255",
|
||||
// style: TextStyle(fontSize: 14, color: ColorConfig.TextColor),
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
height: Screen.setWidth(380),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: GridView(
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 4,
|
||||
crossAxisSpacing: 4,
|
||||
mainAxisSpacing: 4,
|
||||
),
|
||||
children: [
|
||||
...imgList.asMap().keys.map((e) => imgView(e)).toList(),
|
||||
imgList.length < 9
|
||||
? ImagePickerWidget(
|
||||
child: Container(
|
||||
height: Screen.setWidth(100),
|
||||
width: Screen.setWidth(100),
|
||||
decoration: new BoxDecoration(
|
||||
border: new Border.all(
|
||||
color: ColorConfig.TextColor, width: 0.5),
|
||||
borderRadius:
|
||||
new BorderRadius.circular((2.0)),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
),
|
||||
onChange: (ImagePickerEntity pickedFile) {
|
||||
getImage(pickedFile);
|
||||
},
|
||||
)
|
||||
: Container(
|
||||
height: 0,
|
||||
width: 0,
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget imgView(int e) {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setWidth(120),
|
||||
width: Screen.setWidth(120),
|
||||
decoration: new BoxDecoration(
|
||||
borderRadius: new BorderRadius.circular((2.0)),
|
||||
),
|
||||
child: ClipRRect(
|
||||
// borderRadius: BorderRadius.circular(10),
|
||||
child: Image.file(
|
||||
imgList[e].getPath,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
delImage(e);
|
||||
},
|
||||
child: Container(
|
||||
decoration:
|
||||
BoxDecoration(color: ColorConfig.TransparentBackground),
|
||||
padding: EdgeInsets.all(2),
|
||||
child: Icon(
|
||||
Icons.close,
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
size: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
/*
|
||||
* 展示图片
|
||||
*/
|
||||
getImage(ImagePickerEntity pickedFile) async {
|
||||
setState(() {
|
||||
imgList = [...imgList, pickedFile];
|
||||
});
|
||||
toolUploadFile(pickedFile.getPath);
|
||||
}
|
||||
|
||||
toolUploadFile(File file) async {
|
||||
BotToast.showLoading();
|
||||
String path = file.path;
|
||||
var name = path.substring(path.lastIndexOf("/") + 1, path.length);
|
||||
FormData formdata = FormData.fromMap(
|
||||
{"file": await MultipartFile.fromFile(path, filename: name)});
|
||||
ToolUploadFileEntityData res = await PublicService.toolUploadFile(formdata);
|
||||
imageUrl.add(res.imgUrl);
|
||||
BotToast.closeAllLoading();
|
||||
}
|
||||
|
||||
delImage(int index) {
|
||||
setState(() {
|
||||
imgList.removeAt(index);
|
||||
imageUrl.removeAt(index);
|
||||
});
|
||||
}
|
||||
|
||||
dynamicPush() async {
|
||||
Null res = await DynamicService.dynamicPush(
|
||||
{"dynamic_introduce": introduce.text, "dynamic_imgs": imageUrl});
|
||||
Config.eventBus.fire(ClassEditEvent(true));
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/SignUp/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/SignUp/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
d63b0685-299f-4077-a349-306b85bbbd7e
|
||||
401
moehu/moehu_fontend/lib/views/SignUp/SignUp.dart
Normal file
401
moehu/moehu_fontend/lib/views/SignUp/SignUp.dart
Normal file
@@ -0,0 +1,401 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:peach/R.dart';
|
||||
import 'package:peach/config/Colors.dart';
|
||||
import 'package:peach/entity/_.dart';
|
||||
import 'package:peach/service/_.dart';
|
||||
import 'package:peach/utils/Screen.dart';
|
||||
import 'dart:convert' as convert;
|
||||
|
||||
import 'package:peach/utils/_.dart';
|
||||
|
||||
/*
|
||||
* 首页
|
||||
*/
|
||||
class SignUp extends StatefulWidget {
|
||||
@override
|
||||
_SignUp createState() => _SignUp();
|
||||
}
|
||||
|
||||
class _SignUp extends State<SignUp> with SingleTickerProviderStateMixin {
|
||||
final List<String> _tabValues = [
|
||||
'登录',
|
||||
'注册',
|
||||
];
|
||||
TabController tabController;
|
||||
|
||||
String loginPhpne = '18305520337';
|
||||
String logingPass = '11111';
|
||||
|
||||
String regPhpne = '15395283087';
|
||||
String regPass = '111111';
|
||||
String regName = '程睿是狗';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
SPreferences.init();
|
||||
super.initState();
|
||||
tabController = new TabController(length: _tabValues.length, vsync: this);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
// 触摸收起键盘
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: Scaffold(
|
||||
backgroundColor: ColorConfig.WhiteBackColor,
|
||||
body: Stack(
|
||||
children: <Widget>[
|
||||
Positioned(
|
||||
height: Screen.setHeight(320),
|
||||
width: Screen.width(context),
|
||||
child: Container(
|
||||
decoration: new BoxDecoration(
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: AssetImage(R.libStaticSignupBackground),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 200,
|
||||
width: Screen.width(context),
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(40),
|
||||
child: Container(
|
||||
height: Screen.setHeight(300),
|
||||
decoration: new BoxDecoration(
|
||||
color: ColorConfig.WhiteBackColor,
|
||||
borderRadius: new BorderRadius.vertical(
|
||||
top: Radius.elliptical(5, 5),
|
||||
bottom: Radius.elliptical(5, 5)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: ColorConfig.ThemeOtherColor, //底色,阴影颜色
|
||||
offset: Offset(0, 0), //阴影位置,从什么位置开始
|
||||
blurRadius: 10, // 阴影模糊层度
|
||||
spreadRadius: 2,
|
||||
) //阴影模糊大小
|
||||
],
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
width: 280,
|
||||
height: Screen.setHeight(35),
|
||||
child: TabBar(
|
||||
unselectedLabelColor: ColorConfig.TextColor,
|
||||
labelColor: ColorConfig.ThemeColor,
|
||||
indicatorColor: ColorConfig.ThemeColor,
|
||||
controller: tabController,
|
||||
tabs: _tabValues
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => Tab(
|
||||
child: Text(
|
||||
_tabValues[e],
|
||||
style: TextStyle(fontSize: 18),
|
||||
)),
|
||||
)
|
||||
.toList(),
|
||||
onTap: (int i) {
|
||||
// 触摸收起键盘
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height:
|
||||
Screen.setHeight(300) - Screen.setHeight(35) - 20,
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: TabBarView(
|
||||
controller: tabController,
|
||||
children: <Widget>[login(), register()],
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget login() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 18, right: 18),
|
||||
child: Column(
|
||||
children: [
|
||||
new Form(
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
new TextFormField(
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
labelText: "手机号",
|
||||
hintText: "请输入手机号",
|
||||
prefixIcon: Icon(
|
||||
Icons.stay_current_portrait,
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
onChanged: (str) => {
|
||||
setState(() {
|
||||
this.loginPhpne = str;
|
||||
})
|
||||
},
|
||||
),
|
||||
new TextFormField(
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "密码",
|
||||
hintText: "请输入密码",
|
||||
prefixIcon: Icon(
|
||||
Icons.lock,
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
onChanged: (str) => {
|
||||
setState(() {
|
||||
this.logingPass = str;
|
||||
})
|
||||
},
|
||||
),
|
||||
// new TextFormField(
|
||||
// decoration: InputDecoration(
|
||||
// labelText: "验证码",
|
||||
// hintText: "请输入验证码",
|
||||
// prefixIcon:
|
||||
// Icon(Icons.lock, color: ColorConfig.ThemeColor),
|
||||
// suffixIcon: TextButton(
|
||||
// onPressed: () {},
|
||||
// child: Text(
|
||||
// '获取验证码',
|
||||
// style: TextStyle(color: ColorConfig.ThemeColor),
|
||||
// ),
|
||||
// ),
|
||||
// fillColor: ColorConfig.ThemeColor,
|
||||
// labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
// focusedBorder: UnderlineInputBorder(
|
||||
// //选中时下边框颜色
|
||||
// borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20, right: 20, top: 30),
|
||||
width: 280,
|
||||
height: 45.0,
|
||||
child: new ElevatedButton(
|
||||
style: ButtonStyle(backgroundColor:
|
||||
MaterialStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
return ColorConfig.ThemeOtherColor;
|
||||
}
|
||||
//默认不使用背景颜色
|
||||
return ColorConfig.ThemeColor;
|
||||
})),
|
||||
child: Text("登录", style: TextStyle(fontSize: 20)),
|
||||
onPressed: () {
|
||||
subLoging();
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
Widget register() {
|
||||
return Padding(
|
||||
padding: EdgeInsets.only(left: 18, right: 18),
|
||||
child: Column(
|
||||
children: [
|
||||
new Form(
|
||||
child: new Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
new TextFormField(
|
||||
keyboardType: TextInputType.text,
|
||||
decoration: InputDecoration(
|
||||
labelText: "用户名",
|
||||
hintText: "请输入用户名",
|
||||
prefixIcon: Icon(
|
||||
Icons.person,
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
onChanged: (str) => {
|
||||
setState(() {
|
||||
this.regName = str;
|
||||
})
|
||||
},
|
||||
),
|
||||
new TextFormField(
|
||||
keyboardType: TextInputType.number,
|
||||
decoration: InputDecoration(
|
||||
labelText: "手机号",
|
||||
hintText: "请输入手机号",
|
||||
prefixIcon: Icon(
|
||||
Icons.stay_current_portrait,
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
onChanged: (str) => {
|
||||
setState(() {
|
||||
this.regPhpne = str;
|
||||
})
|
||||
},
|
||||
),
|
||||
new TextFormField(
|
||||
obscureText: true,
|
||||
decoration: InputDecoration(
|
||||
labelText: "密码",
|
||||
hintText: "请输入密码",
|
||||
prefixIcon: Icon(
|
||||
Icons.lock,
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
fillColor: ColorConfig.ThemeColor,
|
||||
labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
//选中时下边框颜色
|
||||
borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
),
|
||||
),
|
||||
onChanged: (str) => {
|
||||
setState(() {
|
||||
this.regPass = str;
|
||||
})
|
||||
},
|
||||
),
|
||||
// new TextFormField(
|
||||
// decoration: InputDecoration(
|
||||
// labelText: "验证码",
|
||||
// hintText: "请输入验证码",
|
||||
// prefixIcon: Icon(Icons.lock, color: ColorConfig.ThemeColor),
|
||||
// suffixIcon: TextButton(
|
||||
// onPressed: () {},
|
||||
// child: Text(
|
||||
// '获取验证码',
|
||||
// style: TextStyle(color: ColorConfig.ThemeColor),
|
||||
// ),
|
||||
// ),
|
||||
// fillColor: ColorConfig.ThemeColor,
|
||||
// labelStyle: TextStyle(color: ColorConfig.ThemeColor),
|
||||
// focusedBorder: UnderlineInputBorder(
|
||||
// //选中时下边框颜色
|
||||
// borderSide: BorderSide(color: ColorConfig.ThemeColor),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
Container(
|
||||
margin: EdgeInsets.only(left: 20, right: 20, top: 30),
|
||||
width: 280,
|
||||
height: 45.0,
|
||||
child: new ElevatedButton(
|
||||
style: ButtonStyle(backgroundColor:
|
||||
MaterialStateProperty.resolveWith((states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
return ColorConfig.ThemeOtherColor;
|
||||
}
|
||||
//默认不使用背景颜色
|
||||
return ColorConfig.ThemeColor;
|
||||
})),
|
||||
child: Text("注册", style: TextStyle(fontSize: 20)),
|
||||
onPressed: () {
|
||||
subReg();
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
subLoging() async {
|
||||
LoginData res = await UserService.Login(
|
||||
{
|
||||
'user_phone': this.loginPhpne,
|
||||
'sms_code': this.logingPass,
|
||||
},
|
||||
);
|
||||
if (res != null) {
|
||||
BotToast.showText(text: "登录成功");
|
||||
await getUserInfo(res.userInfo.userId);
|
||||
// 这信息只会更新一次,所以调用UserInfo保证每次都更新
|
||||
await SPreferences().setString('userInfo', convert.jsonEncode(res.userInfo));
|
||||
await SPreferences().setString('token', res.userToken);
|
||||
await SPreferences().setBool("isLogin", true);
|
||||
Modular.to.pushReplacementNamed('/index');
|
||||
}
|
||||
// Navigator.of(context).pushNamed("/index");
|
||||
}
|
||||
|
||||
subReg() async {
|
||||
RegData res = await UserService.Reg({
|
||||
"user_nickname": this.regName,
|
||||
"user_phone": this.regPhpne,
|
||||
"sms_code": this.regPass
|
||||
});
|
||||
BotToast.showText(text: "注册成功请登录");
|
||||
this.setState(() {
|
||||
this.loginPhpne = this.regPhpne;
|
||||
this.regName = '';
|
||||
this.regPhpne = '';
|
||||
this.regPass = '';
|
||||
tabController.animateTo(0);
|
||||
});
|
||||
}
|
||||
|
||||
getUserInfo(int userId) async {
|
||||
UserInfoPersonalEntityData res =
|
||||
await UserService.UserInfo({"user_id": userId});
|
||||
await SPreferences().setString('onUserInfo', convert.jsonEncode(res));
|
||||
}
|
||||
}
|
||||
41
moehu/moehu_fontend/lib/views/Welcome.dart
Normal file
41
moehu/moehu_fontend/lib/views/Welcome.dart
Normal file
@@ -0,0 +1,41 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_modular/flutter_modular.dart';
|
||||
import 'package:intro_views_flutter/intro_views_flutter.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/utils/_.dart';
|
||||
import 'package:peach/views/App.dart';
|
||||
|
||||
/*
|
||||
* 启动欢迎页面
|
||||
*/
|
||||
class Welcome extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _Welcome();
|
||||
|
||||
Welcome({Key key}) : super(key: key);
|
||||
}
|
||||
|
||||
class _Welcome extends State<Welcome> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Builder(
|
||||
builder: (context) => IntroViewsFlutter(
|
||||
Config.pages,
|
||||
onTapDoneButton: () {
|
||||
Config.isLogin ?
|
||||
Modular.to.pushReplacementNamed('/signUp') :
|
||||
Modular.to.pushReplacementNamed('/index');
|
||||
},
|
||||
skipText: Text("跳过"),
|
||||
doneText: Text("进入"),
|
||||
pageButtonTextStyles: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: Screen.setFontSize(15.0),
|
||||
),
|
||||
), //IntroViewsFlutter
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
1
moehu/moehu_fontend/lib/views/WorksInfo/.pydio
Normal file
1
moehu/moehu_fontend/lib/views/WorksInfo/.pydio
Normal file
@@ -0,0 +1 @@
|
||||
6c0dfdc3-0abc-48da-b198-a3f6a3376322
|
||||
284
moehu/moehu_fontend/lib/views/WorksInfo/EditWorkLabel.dart
Normal file
284
moehu/moehu_fontend/lib/views/WorksInfo/EditWorkLabel.dart
Normal file
@@ -0,0 +1,284 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.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 'dart:convert' as convert;
|
||||
|
||||
/*
|
||||
* 编辑作品标签
|
||||
*/
|
||||
|
||||
//新的Stateful Widget 存放 Dialog Content
|
||||
class EditWorkLabel extends StatefulWidget {
|
||||
final int opusId;
|
||||
final int isEdit;
|
||||
|
||||
EditWorkLabel({this.opusId, this.isEdit});
|
||||
@override
|
||||
State<StatefulWidget> createState() =>
|
||||
_EditWorkLabel(opusId: this.opusId, isEdit: this.isEdit);
|
||||
}
|
||||
|
||||
class _EditWorkLabel extends State<EditWorkLabel> {
|
||||
String text = "";
|
||||
|
||||
final int opusId;
|
||||
|
||||
final int isEdit;
|
||||
|
||||
// 编辑标签的列表数据
|
||||
List<OpusTagEntityData> tag = [];
|
||||
|
||||
// 当前标签状态
|
||||
bool switchValue = false;
|
||||
|
||||
_EditWorkLabel({this.opusId, this.isEdit});
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
tagOpusTag(this.opusId);
|
||||
switchValue = this.isEdit == 1 ? true : false;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(12.0),
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Container(
|
||||
decoration: ShapeDecoration(
|
||||
color: Color(0xFFFFFFFF),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(8.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
margin: EdgeInsets.only(top: Screen.setFontSize(100),
|
||||
bottom: Screen.setFontSize(215), left: Screen.setFontSize(20), right: Screen.setFontSize(20)),
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
Text("编辑作品标签"),
|
||||
Container(
|
||||
margin: EdgeInsets.only(bottom: 5),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text("作品标签"),
|
||||
// Text("${tag != null ? tag.length : 0}/10")
|
||||
],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: Screen.setHeight(120),
|
||||
child: ListView(
|
||||
children: tag != null
|
||||
? tag.map((e) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: 10, bottom: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(e.tagsTitle),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
_openAlertDialog(e.tagsId);
|
||||
},
|
||||
child: Text(
|
||||
"删除",
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}).toList()
|
||||
: [],
|
||||
),
|
||||
),
|
||||
Container(
|
||||
color: ColorConfig.AshPlacement,
|
||||
height: Screen.setHeight(35),
|
||||
padding: EdgeInsets.all(5),
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Align(
|
||||
alignment: Alignment.center,
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 5),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
hintText: '请输入标签名',
|
||||
hintStyle: TextStyle(color: Colors.grey),
|
||||
hintMaxLines: 1,
|
||||
border: InputBorder.none,
|
||||
contentPadding:
|
||||
const EdgeInsets.symmetric(vertical: 11),
|
||||
),
|
||||
onChanged: (value) => {text = value},
|
||||
),
|
||||
),
|
||||
),
|
||||
Text("0/30")
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
tagOpusInfoCreatedTags(text);
|
||||
},
|
||||
child: Text(
|
||||
"确定",
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
)),
|
||||
Row(
|
||||
children: [
|
||||
Switch(
|
||||
value: switchValue,
|
||||
onChanged: (value) {
|
||||
tagUpdateTagsEditStatus(value);
|
||||
},
|
||||
),
|
||||
Text("允许其他会员添加标签")
|
||||
],
|
||||
),
|
||||
Container(
|
||||
width: Screen.width(context),
|
||||
height: 45,
|
||||
child: ElevatedButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.resolveWith(
|
||||
(states) {
|
||||
//设置按下时的背景颜色
|
||||
if (states.contains(MaterialState.pressed)) {
|
||||
return ColorConfig.ThemeOtherColor;
|
||||
}
|
||||
//默认不使用背景颜色
|
||||
return ColorConfig.ThemeColor;
|
||||
},
|
||||
),
|
||||
),
|
||||
child: Text("关闭", style: TextStyle(fontSize: 18)),
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 获取标签列表
|
||||
tagOpusTag(int opusId) async {
|
||||
List<OpusTagEntityData> res =
|
||||
await TagService.tagOpusTag({"opus_id": opusId});
|
||||
setState(() {
|
||||
tag = res;
|
||||
});
|
||||
}
|
||||
|
||||
// 新增标签
|
||||
tagOpusInfoCreatedTags(String title) async {
|
||||
if (title == null || title == '') {
|
||||
return BotToast.showText(text: "标签内容不能为空");
|
||||
}
|
||||
var userInfo = convert.jsonDecode(SPreferences().getString("userInfo"));
|
||||
Null res = await TagService.tagOpusInfoCreatedTags({
|
||||
"tags_title": title,
|
||||
"user_id": userInfo["user_id"],
|
||||
"opus_id": opusId
|
||||
});
|
||||
Navigator.pop(context);
|
||||
BotToast.showText(text: "新增标签成功");
|
||||
await tagOpusTag(opusId);
|
||||
Config.eventBus.fire(ClassInputEditEvent(true));
|
||||
}
|
||||
|
||||
// 删除标签
|
||||
tagDeleteTag(int tagsId) async {
|
||||
await TagService.tagDeleteTag({"tags_id": tagsId});
|
||||
Navigator.pop(context);
|
||||
BotToast.showText(text: "删除标签成功");
|
||||
await tagOpusTag(opusId);
|
||||
Config.eventBus.fire(ClassInputEditEvent(true));
|
||||
}
|
||||
|
||||
// 删除标签确认弹出层
|
||||
Future _openAlertDialog(int tagsId) async {
|
||||
final action = await showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false, //// user must tap button!
|
||||
builder: (BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(
|
||||
'提示',
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
content: Text('是否删除?'),
|
||||
actions: <Widget>[
|
||||
TextButton(
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, Action.Cancel);
|
||||
},
|
||||
),
|
||||
TextButton(
|
||||
child: Text(
|
||||
'确认',
|
||||
style: TextStyle(
|
||||
color: ColorConfig.ThemeColor,
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pop(context, Action.Ok);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
|
||||
switch (action) {
|
||||
case Action.Ok:
|
||||
tagDeleteTag(tagsId);
|
||||
break;
|
||||
case Action.Cancel:
|
||||
break;
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
tagUpdateTagsEditStatus(bool value) async {
|
||||
Null res = await TagService.tagUpdateTagsEditStatus(
|
||||
{"opus_id": opusId, "edit_status": value ? 1 : 0});
|
||||
setState(() {
|
||||
switchValue = value;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
enum Action { Ok, Cancel }
|
||||
570
moehu/moehu_fontend/lib/views/WorksInfo/WorksInfo.dart
Normal file
570
moehu/moehu_fontend/lib/views/WorksInfo/WorksInfo.dart
Normal file
@@ -0,0 +1,570 @@
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
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/Colors.dart';
|
||||
import 'package:peach/config/_.dart';
|
||||
import 'package:peach/entity/CommenListEntity.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/_.dart';
|
||||
import 'dart:convert';
|
||||
import 'dart:convert' as convert;
|
||||
|
||||
import 'EditWorkLabel.dart';
|
||||
|
||||
/*
|
||||
* 个人中心左边弹出层
|
||||
*/
|
||||
class WorksInfo extends StatefulWidget {
|
||||
final int opusId;
|
||||
|
||||
const WorksInfo({this.opusId});
|
||||
|
||||
@override
|
||||
_WorksInfo createState() => _WorksInfo(this.opusId);
|
||||
}
|
||||
|
||||
class _WorksInfo extends State<WorksInfo> with SingleTickerProviderStateMixin {
|
||||
final int opusId;
|
||||
|
||||
TextEditingController ctl = TextEditingController();
|
||||
EasyRefreshController _easyRefreshController;
|
||||
|
||||
// 详情数据
|
||||
OpusOpusInfoEntityData infoData;
|
||||
|
||||
// 回复框的节点信息
|
||||
FocusNode focusNode = FocusNode();
|
||||
|
||||
// 当前用户是否被我关注过
|
||||
bool isCheckUser;
|
||||
|
||||
// 当前用户是否被点赞
|
||||
bool isUpvote;
|
||||
|
||||
// 当前用户是否点赞
|
||||
bool isCollectionOpus;
|
||||
|
||||
UserInfo _userInfo =
|
||||
UserInfo.fromJson(jsonDecode(SPreferences().getString("userInfo")));
|
||||
|
||||
int _currentPageIndex = 0;
|
||||
|
||||
/*
|
||||
* 评论如果是艾特某人
|
||||
*/
|
||||
String hintText = "";
|
||||
|
||||
/*
|
||||
* 编辑tag
|
||||
*/
|
||||
bool edit = false;
|
||||
|
||||
int commentReplyId = 0;
|
||||
|
||||
PageEntity page = PageEntity();
|
||||
|
||||
CommenListEntityData commenList;
|
||||
|
||||
// 编辑标签的列表数据
|
||||
List<OpusTagEntityData> tagList = [];
|
||||
|
||||
// 当前标签状态
|
||||
bool switchValue = false;
|
||||
|
||||
bool loading = true;
|
||||
|
||||
_WorksInfo(this.opusId);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_easyRefreshController = EasyRefreshController();
|
||||
ctl.addListener(onValueChange);
|
||||
SPreferences.init();
|
||||
Config.eventBus.on<ClassInputEditEvent>().listen((event) async {
|
||||
if (event.update) {
|
||||
await getOpusOpusInfo();
|
||||
setState(() {});
|
||||
}
|
||||
});
|
||||
future();
|
||||
}
|
||||
|
||||
void dispose() {
|
||||
ctl.removeListener(onValueChange);
|
||||
ctl.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void onValueChange() {
|
||||
print("${ctl.text} +++++++");
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(commenList == null);
|
||||
if (loading) return Loading();
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
// 触摸收起键盘
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: Scaffold(
|
||||
bottomNavigationBar:
|
||||
Padding(padding: MediaQuery.of(context).viewInsets),
|
||||
appBar: AppBar(
|
||||
title: Text(infoData.opusTitle),
|
||||
toolbarHeight: Screen.setHeight(45),
|
||||
centerTitle: true,
|
||||
backgroundColor: ColorConfig.ThemeColor,
|
||||
),
|
||||
body: Container(
|
||||
height: Screen.height(context) - Screen.setHeight(45) - Config.top,
|
||||
margin: EdgeInsets.only(bottom: 100),
|
||||
child: easyRefresh(
|
||||
ListView(
|
||||
children: [
|
||||
...infoData.opusImgs
|
||||
.asMap()
|
||||
.keys
|
||||
.map(
|
||||
(e) => opusImgsView(e),
|
||||
)
|
||||
.toList(),
|
||||
ListTile(
|
||||
title: Container(
|
||||
margin: EdgeInsets.only(bottom: 10, top: 10),
|
||||
child: Text(
|
||||
infoData.opusTitle,
|
||||
style: TextStyle(fontSize: 20),
|
||||
),
|
||||
),
|
||||
subtitle: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
infoData.opusIntroduce,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: TopicView(
|
||||
tag: infoData.tags,
|
||||
edit: isEdit(),
|
||||
onTap: () {
|
||||
editDialog();
|
||||
}),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
width: Screen.width(context) / 1.5,
|
||||
child: WorkDataView(
|
||||
isUpvote: isUpvote,
|
||||
isCollectionOpus: isCollectionOpus,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
infoData: infoData,
|
||||
onUpvote: () {
|
||||
opusUpvoteOpus(infoData.opusId);
|
||||
},
|
||||
onOpusCollectionOpus: () {
|
||||
opusCollectionOpus(infoData.opusId);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 10),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
infoData.opusTime,
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Divider(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to
|
||||
.pushNamed("/personal/${infoData.userInfo.userId}");
|
||||
},
|
||||
child: Panel(
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
height: Screen.setWidth(40),
|
||||
width: Screen.setWidth(40),
|
||||
margin: EdgeInsets.only(right: Screen.setWidth(10)),
|
||||
child: ClipOval(
|
||||
child: Image.network(
|
||||
infoData.userInfo.userHeadImg,
|
||||
width: Screen.setWidth(45),
|
||||
height: Screen.setWidth(45),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
flex: 1,
|
||||
child: Text(
|
||||
infoData.userInfo.userNickname,
|
||||
),
|
||||
),
|
||||
_userInfo.userId != infoData.userId
|
||||
? FollowButton(
|
||||
isCheck: isCheckUser,
|
||||
onPressed: () {
|
||||
opusFollowUser(infoData.userId);
|
||||
},
|
||||
)
|
||||
: Container()
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
infoData.newsOpus.length > 0
|
||||
? Panel(
|
||||
child: Container(
|
||||
height: Screen.setHeight(120),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: GridView.builder(
|
||||
scrollDirection: Axis.horizontal,
|
||||
gridDelegate:
|
||||
SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: 1,
|
||||
mainAxisSpacing: 5.0,
|
||||
),
|
||||
itemBuilder: (context, index) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Modular.to.pushNamed(
|
||||
"/worksInfo/${infoData?.newsOpus[index].opusId}");
|
||||
},
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
child: Image.network(
|
||||
infoData?.newsOpus[index].opusImg,
|
||||
width: Screen.setWidth(120),
|
||||
height: Screen.setWidth(50),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: infoData.newsOpus.length,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: Text("暂无最新作品"),
|
||||
height: Screen.setHeight(120),
|
||||
alignment: Alignment.center,
|
||||
),
|
||||
infoData.newsOpus.length > 0
|
||||
? Container(
|
||||
margin: EdgeInsets.only(bottom: 5),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
"查看作品目录",
|
||||
style: TextStyle(
|
||||
color: ColorConfig.TextColor,
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
Divider(),
|
||||
commenList != null
|
||||
? CommentList(
|
||||
comment: commenList.result,
|
||||
reply: (String userNickname, int id) {
|
||||
hintText = userNickname;
|
||||
commentReplyId = id;
|
||||
Config.eventBus.fire(ClasshHntTextEvent("@${userNickname}"));
|
||||
FocusScope.of(context).requestFocus(focusNode);
|
||||
},
|
||||
)
|
||||
: Empty(height: 300, isShow: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
bottomSheet: Container(
|
||||
height: Screen.setHeight(80),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(color: ColorConfig.LineColor, width: 1),
|
||||
),
|
||||
),
|
||||
child: InputWidget(
|
||||
controller: ctl,
|
||||
extraWidget: DefaultExtraWidget(),
|
||||
onSend: (value) {
|
||||
commentAdd(value);
|
||||
},
|
||||
onFocusNode: (FocusNode node) {
|
||||
this.focusNode = node;
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget opusImgsView(int e) {
|
||||
List<ImagePickerEntity> arr = infoData.opusImgs
|
||||
.map((e) => ImagePickerEntity(netWorkPath: e.imgUrl))
|
||||
.toList();
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
new FadeRoute(
|
||||
page: PhotoViewGalleryScreen(
|
||||
images: arr,
|
||||
index: e,
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
width: Screen.width(context),
|
||||
height: processingImage(
|
||||
infoData?.opusImgs[e].imgHeight,
|
||||
infoData?.opusImgs[e].imgWidth,
|
||||
),
|
||||
// decoration: new BoxDecoration(
|
||||
// image: new DecorationImage(
|
||||
// fit: BoxFit.cover,
|
||||
// image: NetworkImage(infoData?.opusImgs[e].imgUrl),
|
||||
// ),
|
||||
// ),
|
||||
child: CachedNetworkImage(
|
||||
imageUrl: infoData?.opusImgs[e].imgUrl,
|
||||
placeholder: (context, url) => new Container(
|
||||
child: new Center(
|
||||
child: new CircularProgressIndicator(),
|
||||
),
|
||||
width: 160.0,
|
||||
height: 90.0,
|
||||
),
|
||||
errorWidget: (context, url, error) => new Icon(Icons.error),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
// 下拉刷新上啦加载
|
||||
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;
|
||||
page.isLoad = false;
|
||||
await getCommentList();
|
||||
setState(() {});
|
||||
_easyRefreshController.finishRefresh(success: true);
|
||||
},
|
||||
onLoad: () async {
|
||||
if (page.isLoad) {
|
||||
await getCommentList();
|
||||
} else {
|
||||
page.page += 1;
|
||||
await getCommentList();
|
||||
}
|
||||
_easyRefreshController.finishLoad();
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
future() async {
|
||||
await getOpusOpusInfo();
|
||||
await getCommentList();
|
||||
setState(() {
|
||||
loading = false;
|
||||
});
|
||||
}
|
||||
|
||||
/*
|
||||
* 获取作品详情
|
||||
*/
|
||||
getOpusOpusInfo() async {
|
||||
print(opusId);
|
||||
OpusOpusInfoEntityData res = await OpusService.getOpusOpusInfo({
|
||||
"opus_id": opusId,
|
||||
});
|
||||
await isCheckUserIsFollow(res.userId);
|
||||
await opusCheckOpusIsUpvote(res.opusId);
|
||||
await opusCheckOpusIsCollection(res.opusId);
|
||||
infoData = res;
|
||||
}
|
||||
|
||||
/*
|
||||
* 评论列表
|
||||
*/
|
||||
getCommentList() async {
|
||||
CommenListEntityData res = await CommentService.getCommentList({
|
||||
"opus_id": opusId,
|
||||
"page": page.page,
|
||||
"count": page.count,
|
||||
"comment_type": 1
|
||||
});
|
||||
// print(_arguments.getId);
|
||||
if (res == null) return;
|
||||
if (res.result.length < page.count) {
|
||||
page.isLoad = true;
|
||||
}
|
||||
|
||||
commenList = res;
|
||||
}
|
||||
|
||||
commentAdd(String str) async {
|
||||
print("commentAdd str ======= ${str}");
|
||||
print("commentAdd hintText ======= ${hintText}");
|
||||
if (str.trim().length <= 0) {
|
||||
BotToast.showText(text: "回复内容不能为空");
|
||||
return;
|
||||
}
|
||||
Null res = await CommentService.commentAdd({
|
||||
"opus_id": infoData.opusId,
|
||||
"comment_content": str,
|
||||
"comment_to_username": hintText,
|
||||
"comment_reply_id": commentReplyId,
|
||||
});
|
||||
await getCommentList();
|
||||
hintText = "";
|
||||
commentReplyId = 0;
|
||||
Config.eventBus.fire(ClasshHntTextEvent("回复"));
|
||||
BotToast.showText(text: "发送成功");
|
||||
this.setState(() {});
|
||||
}
|
||||
|
||||
isCheckUserIsFollow(int id) async {
|
||||
bool res = await OpusService.isCheckUserIsFollow({
|
||||
"user_to_id": id,
|
||||
});
|
||||
isCheckUser = res;
|
||||
}
|
||||
|
||||
opusFollowUser(int id) async {
|
||||
Null res = await OpusService.opusFollowUser({
|
||||
"user_to_id": id,
|
||||
});
|
||||
if (isCheckUser) {
|
||||
BotToast.showText(text: "取消关注");
|
||||
} else {
|
||||
BotToast.showText(text: "关注成功");
|
||||
}
|
||||
await isCheckUserIsFollow(id);
|
||||
this.setState(() {});
|
||||
}
|
||||
|
||||
opusCheckOpusIsUpvote(int id) async {
|
||||
bool res = await OpusService.opusCheckOpusIsUpvote({
|
||||
"opus_id": id,
|
||||
});
|
||||
isUpvote = res;
|
||||
}
|
||||
|
||||
opusUpvoteOpus(int id) async {
|
||||
Null res = await OpusService.opusUpvoteOpus({
|
||||
"opus_id": id,
|
||||
});
|
||||
await getOpusOpusInfo();
|
||||
this.setState(() {});
|
||||
if (isUpvote) {
|
||||
BotToast.showText(text: "点赞成功");
|
||||
} else {
|
||||
BotToast.showText(text: "取消点赞");
|
||||
}
|
||||
// await opusCheckOpusIsUpvote(id);
|
||||
}
|
||||
|
||||
// 检查作品是否被收藏
|
||||
opusCheckOpusIsCollection(int id) async {
|
||||
bool res = await OpusService.opusCheckOpusIsCollection({
|
||||
"opus_id": id,
|
||||
});
|
||||
isCollectionOpus = res;
|
||||
}
|
||||
|
||||
opusCollectionOpus(int id) async {
|
||||
Null res = await OpusService.opusCollectionOpus({
|
||||
"opus_id": id,
|
||||
});
|
||||
await getOpusOpusInfo();
|
||||
this.setState(() {});
|
||||
if (isCollectionOpus) {
|
||||
BotToast.showText(text: "收藏成功");
|
||||
} else {
|
||||
BotToast.showText(text: "取消收藏");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 是否可修改标签,如果是当前作品发布者可以修改,如果开启修改则可以修改
|
||||
*/
|
||||
isEdit() {
|
||||
var userInfo = convert.jsonDecode(SPreferences().getString("userInfo"));
|
||||
if (infoData.userId == userInfo["user_id"]) {
|
||||
return true;
|
||||
}
|
||||
return infoData.opusIsEdit == 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* 编辑当前的标签
|
||||
*/
|
||||
editDialog() {
|
||||
showDialog<Null>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (BuildContext context) {
|
||||
return EditWorkLabel(
|
||||
opusId: infoData.opusId,
|
||||
isEdit: infoData.opusIsEdit,
|
||||
);
|
||||
},
|
||||
).then((val) {
|
||||
print(val);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理图片宽高
|
||||
*/
|
||||
processingImage(int height, int width) {
|
||||
double w = Screen.width(context) / width;
|
||||
double h = height * w;
|
||||
return h;
|
||||
}
|
||||
}
|
||||
|
||||
enum Action { Ok, Cancel }
|
||||
Reference in New Issue
Block a user