Merge branch 'master' of http://192.168.2.201:8099/laiiihz/akuCommunity
# Conflicts: # lib/pages/event_activity/voting_detail_page.dart # lib/pages/manager_func.darthmxc
commit
331f5ab3a8
@ -1,154 +1,54 @@
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/model/common/img_model.dart';
|
||||
|
||||
class CommunityTopicModel {
|
||||
int id;
|
||||
int createId;
|
||||
int isComment;
|
||||
int isLike;
|
||||
String createName;
|
||||
String title;
|
||||
String summary;
|
||||
String content;
|
||||
String gambitTitle;
|
||||
String createDate;
|
||||
List<LikeNames> likeNames;
|
||||
List<ImgModel> imgUrls;
|
||||
List<ImgModel> headSculptureImgUrl;
|
||||
List<GambitThemeCommentVoList> gambitThemeCommentVoList;
|
||||
List<ImgModel> imgUrl;
|
||||
int activityNum;
|
||||
|
||||
String get firstImg {
|
||||
var firstImg = '';
|
||||
if (imgUrls?.isNotEmpty ?? false) {
|
||||
firstImg = imgUrls?.first?.url ?? '';
|
||||
}
|
||||
return firstImg;
|
||||
if (imgUrl.isEmpty)
|
||||
return '';
|
||||
else
|
||||
return imgUrl.first.url;
|
||||
}
|
||||
|
||||
CommunityTopicModel(
|
||||
{this.id,
|
||||
this.createId,
|
||||
this.isComment,
|
||||
this.isLike,
|
||||
this.createName,
|
||||
this.title,
|
||||
this.summary,
|
||||
this.content,
|
||||
this.gambitTitle,
|
||||
this.createDate,
|
||||
this.likeNames,
|
||||
this.imgUrls,
|
||||
this.headSculptureImgUrl,
|
||||
this.gambitThemeCommentVoList});
|
||||
this.imgUrl,
|
||||
this.activityNum});
|
||||
|
||||
CommunityTopicModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
createId = json['createId'];
|
||||
isComment = json['isComment'];
|
||||
isLike = json['isLike'];
|
||||
createName = json['createName'];
|
||||
title = json['title'];
|
||||
summary = json['summary'];
|
||||
content = json['content'];
|
||||
gambitTitle = json['gambitTitle'];
|
||||
createDate = json['createDate'];
|
||||
if (json['likeNames'] != null) {
|
||||
likeNames = new List<LikeNames>();
|
||||
json['likeNames'].forEach((v) {
|
||||
likeNames.add(new LikeNames.fromJson(v));
|
||||
});
|
||||
}
|
||||
if (json['imgUrls'] != null) {
|
||||
imgUrls = new List<ImgModel>();
|
||||
json['imgUrls'].forEach((v) {
|
||||
imgUrls.add(new ImgModel.fromJson(v));
|
||||
if (json['imgUrl'] != null) {
|
||||
imgUrl = new List<ImgModel>();
|
||||
json['imgUrl'].forEach((v) {
|
||||
imgUrl.add(new ImgModel.fromJson(v));
|
||||
});
|
||||
} else
|
||||
imgUrls = [];
|
||||
if (json['headSculptureImgUrl'] != null) {
|
||||
headSculptureImgUrl = new List<ImgModel>();
|
||||
json['headSculptureImgUrl'].forEach((v) {
|
||||
headSculptureImgUrl.add(new ImgModel.fromJson(v));
|
||||
});
|
||||
} else
|
||||
headSculptureImgUrl = [];
|
||||
if (json['gambitThemeCommentVoList'] != null) {
|
||||
gambitThemeCommentVoList = new List<GambitThemeCommentVoList>();
|
||||
json['gambitThemeCommentVoList'].forEach((v) {
|
||||
gambitThemeCommentVoList.add(new GambitThemeCommentVoList.fromJson(v));
|
||||
});
|
||||
}
|
||||
imgUrl = [];
|
||||
activityNum = json['activityNum'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['createId'] = this.createId;
|
||||
data['isComment'] = this.isComment;
|
||||
data['isLike'] = this.isLike;
|
||||
data['createName'] = this.createName;
|
||||
data['title'] = this.title;
|
||||
data['summary'] = this.summary;
|
||||
data['content'] = this.content;
|
||||
data['gambitTitle'] = this.gambitTitle;
|
||||
data['createDate'] = this.createDate;
|
||||
if (this.likeNames != null) {
|
||||
data['likeNames'] = this.likeNames.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.imgUrls != null) {
|
||||
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.headSculptureImgUrl != null) {
|
||||
data['headSculptureImgUrl'] =
|
||||
this.headSculptureImgUrl.map((v) => v.toJson()).toList();
|
||||
if (this.imgUrl != null) {
|
||||
data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList();
|
||||
}
|
||||
if (this.gambitThemeCommentVoList != null) {
|
||||
data['gambitThemeCommentVoList'] =
|
||||
this.gambitThemeCommentVoList.map((v) => v.toJson()).toList();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class LikeNames {
|
||||
int id;
|
||||
String name;
|
||||
|
||||
LikeNames({this.id, this.name});
|
||||
|
||||
LikeNames.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
name = json['name'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['name'] = this.name;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
class GambitThemeCommentVoList {
|
||||
int id;
|
||||
String parentName;
|
||||
String content;
|
||||
String createName;
|
||||
String createDate;
|
||||
|
||||
GambitThemeCommentVoList(
|
||||
{this.id,
|
||||
this.parentName,
|
||||
this.content,
|
||||
this.createName,
|
||||
this.createDate});
|
||||
|
||||
GambitThemeCommentVoList.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
parentName = json['parentName'];
|
||||
content = json['content'];
|
||||
createName = json['createName'];
|
||||
createDate = json['createDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['parentName'] = this.parentName;
|
||||
data['content'] = this.content;
|
||||
data['createName'] = this.createName;
|
||||
data['createDate'] = this.createDate;
|
||||
data['activityNum'] = this.activityNum;
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
// Package imports:
|
||||
import 'package:flustars/flustars.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/model/common/img_model.dart';
|
||||
|
||||
class MyEventItemModel {
|
||||
int id;
|
||||
String content;
|
||||
List<ImgModel> imgUrl;
|
||||
String createDate;
|
||||
|
||||
String get firstImg {
|
||||
String img = '';
|
||||
if (imgUrl.isNotEmpty) img = imgUrl.first.url;
|
||||
return img;
|
||||
}
|
||||
|
||||
DateTime get date => DateUtil.getDateTime(createDate);
|
||||
|
||||
MyEventItemModel({this.id, this.content, this.imgUrl, this.createDate});
|
||||
|
||||
MyEventItemModel.fromJson(Map<String, dynamic> json) {
|
||||
id = json['id'];
|
||||
content = json['content'];
|
||||
if (json['imgUrl'] != null) {
|
||||
imgUrl = new List<ImgModel>();
|
||||
json['imgUrl'].forEach((v) {
|
||||
imgUrl.add(new ImgModel.fromJson(v));
|
||||
});
|
||||
} else
|
||||
imgUrl = [];
|
||||
createDate = json['createDate'];
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final Map<String, dynamic> data = new Map<String, dynamic>();
|
||||
data['id'] = this.id;
|
||||
data['content'] = this.content;
|
||||
if (this.imgUrl != null) {
|
||||
data['imgUrl'] = this.imgUrl.map((v) => v.toJson()).toList();
|
||||
}
|
||||
data['createDate'] = this.createDate;
|
||||
return data;
|
||||
}
|
||||
}
|
@ -1,338 +0,0 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/base/assets_image.dart';
|
||||
import 'package:akuCommunity/pages/activities_page/activities_page.dart';
|
||||
import 'package:akuCommunity/pages/convenient_phone/convenient_phone_page.dart';
|
||||
import 'package:akuCommunity/pages/fitup_manage/fitup_manage_page.dart';
|
||||
import 'package:akuCommunity/pages/goods_deto_page/goods_deto_page.dart';
|
||||
import 'package:akuCommunity/pages/goods_manage_page/goods_manage_page.dart';
|
||||
import 'package:akuCommunity/pages/industry_committee/industry_committee_page.dart';
|
||||
import 'package:akuCommunity/pages/life_pay/life_pay_page.dart';
|
||||
import 'package:akuCommunity/pages/market/market_detail_page/market_detail_page.dart';
|
||||
import 'package:akuCommunity/pages/one_alarm/widget/alarm_page.dart';
|
||||
import 'package:akuCommunity/pages/open_door_page/open_door_page.dart';
|
||||
import 'package:akuCommunity/pages/opening_code_page/opening_code_page.dart';
|
||||
import 'package:akuCommunity/pages/questionnaire_page/questionnaire_page.dart';
|
||||
import 'package:akuCommunity/pages/things_page/fixed_submit_page.dart';
|
||||
import 'package:akuCommunity/pages/visitor_access_page/visitor_access_page.dart';
|
||||
import 'package:akuCommunity/routers/page_routers.dart';
|
||||
import 'package:akuCommunity/ui/manager/advice/advice_page.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'widget/applications_bar.dart';
|
||||
|
||||
class TotalApplicationsPage extends StatefulWidget {
|
||||
TotalApplicationsPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TotalApplicationsPageState createState() => _TotalApplicationsPageState();
|
||||
}
|
||||
|
||||
class _TotalApplicationsPageState extends State<TotalApplicationsPage> {
|
||||
int _currentIndex = 0;
|
||||
bool isEdit = false;
|
||||
List<String> _leftNav = ['为您推荐', '智慧管家'];
|
||||
|
||||
Widget _myApp() {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(
|
||||
top: 32.w,
|
||||
left: 32.w,
|
||||
right: 32.w,
|
||||
),
|
||||
padding: EdgeInsets.only(bottom: 16.w),
|
||||
decoration: BoxDecoration(
|
||||
border:
|
||||
Border(bottom: BorderSide(color: Color(0xffd8d8d8), width: 0.5)),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'我的应用',
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
isEdit = !isEdit;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
width: 90.w,
|
||||
padding: EdgeInsets.symmetric(vertical: 6.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffffd000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(2)),
|
||||
),
|
||||
child: Text(
|
||||
isEdit ? '完成' : '编辑',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _myAppGrid(List<Map<String, dynamic>> gridList, int count) {
|
||||
return Container(
|
||||
child: GridView.builder(
|
||||
padding: EdgeInsets.zero,
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemCount: gridList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return InkWell(
|
||||
onTap: isEdit
|
||||
? () {
|
||||
setState(() {
|
||||
switch (count) {
|
||||
case 3:
|
||||
if ((!AssetsImage.mineAppList.any((item) =>
|
||||
item['title'] == gridList[index]['title'])) &&
|
||||
AssetsImage.mineAppList.length < 8) {
|
||||
AssetsImage.mineAppList.add(gridList[index]);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
gridList.removeAt(index);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
});
|
||||
}
|
||||
: () {
|
||||
switch (gridList[index]['title']) {
|
||||
case '居家生活':
|
||||
case '数码家电':
|
||||
case '休闲副食':
|
||||
case '滋补保健':
|
||||
case '彩妆香水':
|
||||
case '服饰箱包':
|
||||
case '母婴玩具':
|
||||
case '饮料酒水':
|
||||
MarketDetailPage(
|
||||
bundle: Bundle()
|
||||
..putString('title', gridList[index]['title']),
|
||||
).to;
|
||||
break;
|
||||
case '一键开门':
|
||||
OpenDoorPage().to();
|
||||
break;
|
||||
case '开门码':
|
||||
OpeningCodePage().to();
|
||||
break;
|
||||
case '访客通行':
|
||||
case '我的访客':
|
||||
VisitorAccessPage().to();
|
||||
break;
|
||||
case '报事报修':
|
||||
FixedSubmitPage().to();
|
||||
break;
|
||||
case '生活缴费':
|
||||
case '我的缴费':
|
||||
LifePayPage().to();
|
||||
break;
|
||||
case '业委会':
|
||||
IndustryCommitteePage().to();
|
||||
break;
|
||||
case '建议咨询':
|
||||
AdvicePage(type: AdviceType.SUGGESTION).to();
|
||||
break;
|
||||
case '便民电话':
|
||||
ConvenientPhonePage().to();
|
||||
break;
|
||||
case '活动投票':
|
||||
ActivitiesPage().to();
|
||||
break;
|
||||
case '社区活动':
|
||||
ActivitiesPage().to();
|
||||
break;
|
||||
case '物品出户':
|
||||
GoodsDetoPage().to();
|
||||
break;
|
||||
case '投诉表扬':
|
||||
AdvicePage(type: AdviceType.COMPLAIN).to();
|
||||
break;
|
||||
case '问卷调查':
|
||||
QuestionnairePage().to();
|
||||
break;
|
||||
case '装修管理':
|
||||
FitupManagePage().to();
|
||||
break;
|
||||
case '借还管理':
|
||||
GoodsManagePage().to();
|
||||
break;
|
||||
case '一键报警':
|
||||
AlarmPage().to();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
},
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Stack(
|
||||
children: [
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
gridList[index]['imagePath'],
|
||||
height: 75.w,
|
||||
width: 75.w,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
SizedBox(height: 8.w),
|
||||
Text(
|
||||
gridList[index]['title'],
|
||||
style: TextStyle(
|
||||
fontSize: 24.sp,
|
||||
color: Color(0xff4a4b51),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
isEdit
|
||||
? Positioned(
|
||||
right: 0,
|
||||
top: 24.w,
|
||||
child: Image.asset(
|
||||
count == 3
|
||||
? AssetsImage.APPADD
|
||||
: AssetsImage.APPREDUCE,
|
||||
height: 24.w,
|
||||
width: 24.w,
|
||||
),
|
||||
)
|
||||
: SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
||||
crossAxisCount: count,
|
||||
childAspectRatio: 1.0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _leftInkWellNav(int index) {
|
||||
return InkWell(
|
||||
child: Stack(
|
||||
children: [
|
||||
Container(
|
||||
height: 88.w,
|
||||
alignment: Alignment.center,
|
||||
color: _currentIndex == index ? Colors.white : Colors.transparent,
|
||||
padding: EdgeInsets.symmetric(vertical: 24.w),
|
||||
child: Text(
|
||||
_leftNav[index],
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
),
|
||||
_currentIndex == index
|
||||
? Positioned(
|
||||
top: 24.w,
|
||||
left: 1,
|
||||
child: SizedBox(
|
||||
width: 4.w,
|
||||
height: 40.w,
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(color: Color(0xffffd000)),
|
||||
),
|
||||
),
|
||||
)
|
||||
: SizedBox(),
|
||||
],
|
||||
),
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: PreferredSize(
|
||||
child: ApplicationsBar(),
|
||||
preferredSize: Size.fromHeight(kToolbarHeight),
|
||||
),
|
||||
body: ListView(
|
||||
children: [
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: _myApp(),
|
||||
),
|
||||
Container(
|
||||
color: Colors.white,
|
||||
child: _myAppGrid(AssetsImage.mineAppList, 4),
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.only(top: 32.w),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 172.w,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
itemCount: _leftNav.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _leftInkWellNav(index);
|
||||
}),
|
||||
),
|
||||
Container(
|
||||
width: 578.w,
|
||||
color: Colors.white,
|
||||
child: ListView(
|
||||
shrinkWrap: true,
|
||||
children: [
|
||||
Builder(builder: (_) {
|
||||
switch (_currentIndex) {
|
||||
case 0:
|
||||
return _myAppGrid(AssetsImage.recommendGridList, 3);
|
||||
break;
|
||||
case 1:
|
||||
return _myAppGrid(AssetsImage.propertyGridList, 3);
|
||||
break;
|
||||
case 2:
|
||||
return _myAppGrid(AssetsImage.shopGridList, 3);
|
||||
break;
|
||||
default:
|
||||
return SizedBox();
|
||||
}
|
||||
}),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/search_bar_delegate.dart';
|
||||
|
||||
class ApplicationsBar extends StatelessWidget {
|
||||
const ApplicationsBar({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
child: AppBar(
|
||||
elevation: 0,
|
||||
titleSpacing: 0,
|
||||
backgroundColor: Colors.white,
|
||||
leading: InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Icon(
|
||||
AntDesign.left,
|
||||
size: 45.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
centerTitle: true,
|
||||
title: InkWell(
|
||||
onTap: () {
|
||||
showSearch(context: context, delegate: SearchBarDelegate());
|
||||
},
|
||||
child: Container(
|
||||
margin: EdgeInsets.only(right: 32.w),
|
||||
padding: EdgeInsets.only(
|
||||
left: 40.w,
|
||||
top: 15.w,
|
||||
bottom: 15.w),
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xfff3f3f3),
|
||||
borderRadius: BorderRadius.all(Radius.circular(36)),
|
||||
),
|
||||
child: Row(children: [
|
||||
Icon(
|
||||
AntDesign.search1,
|
||||
size: 28.sp,
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
SizedBox(width: 5),
|
||||
Text(
|
||||
'搜索商品、活动、帖子、应用',
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff999999),
|
||||
),
|
||||
)
|
||||
]),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
// Dart imports:
|
||||
import 'dart:io';
|
||||
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/base/base_style.dart';
|
||||
import 'package:akuCommunity/constants/api.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/utils/network/base_model.dart';
|
||||
import 'package:akuCommunity/utils/network/net_util.dart';
|
||||
import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
|
||||
|
||||
class AddNewEventPage extends StatefulWidget {
|
||||
AddNewEventPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AddNewEventPageState createState() => _AddNewEventPageState();
|
||||
}
|
||||
|
||||
class _AddNewEventPageState extends State<AddNewEventPage> {
|
||||
bool _commentable = true;
|
||||
List<File> _files = [];
|
||||
TextEditingController _textEditingController = TextEditingController();
|
||||
|
||||
///发表动态
|
||||
_addEvent() async {
|
||||
VoidCallback cancel = BotToast.showLoading();
|
||||
final String content = _textEditingController.text;
|
||||
List<String> imgs;
|
||||
if (_files.isNotEmpty) {
|
||||
imgs = await NetUtil().uploadFiles(_files, API.upload.uploadEvent);
|
||||
}
|
||||
|
||||
Map<String, dynamic> params = {
|
||||
//TODO 话题ID
|
||||
'gambitId': -1,
|
||||
'content': content,
|
||||
'isComment': _commentable ? 1 : 0,
|
||||
'isPublic': 1,
|
||||
'imgUrls': imgs,
|
||||
};
|
||||
|
||||
BaseModel baseModel = await NetUtil().post(
|
||||
API.community.addEvent,
|
||||
params: params,
|
||||
showMessage: true,
|
||||
);
|
||||
cancel();
|
||||
if (baseModel.status) {
|
||||
Get.back(result: true);
|
||||
}
|
||||
}
|
||||
|
||||
_buildSelectable() {
|
||||
return MaterialButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_commentable = !_commentable;
|
||||
});
|
||||
},
|
||||
height: 96.w,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.bubble_left,
|
||||
size: 32.w,
|
||||
),
|
||||
8.wb,
|
||||
'不可评论'.text.size(28.sp).make(),
|
||||
Spacer(),
|
||||
AnimatedOpacity(
|
||||
opacity: _commentable ? 0 : 1,
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOutCubic,
|
||||
child: Icon(
|
||||
Icons.check_rounded,
|
||||
color: Colors.black,
|
||||
size: 40.w,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
leading: MaterialButton(
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: Get.back,
|
||||
child: '取消'.text.size(34.sp).make(),
|
||||
),
|
||||
leadingWidth: 108.w,
|
||||
centerTitle: true,
|
||||
title: '社区'.text.make(),
|
||||
actions: [
|
||||
Hero(
|
||||
tag: 'event_add',
|
||||
child: MaterialButton(
|
||||
elevation: 0,
|
||||
minWidth: 116.w,
|
||||
padding: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(4.w),
|
||||
),
|
||||
color: kPrimaryColor,
|
||||
onPressed: _addEvent,
|
||||
child: '发表'.text.size(34.sp).make(),
|
||||
).centered(),
|
||||
),
|
||||
32.wb,
|
||||
],
|
||||
),
|
||||
body: ListView(
|
||||
padding: EdgeInsets.symmetric(horizontal: 64.w, vertical: 32.w),
|
||||
children: [
|
||||
TextField(
|
||||
minLines: 3,
|
||||
maxLines: 99,
|
||||
controller: _textEditingController,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
border: InputBorder.none,
|
||||
hintText: '这一刻的想法',
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xFF999999),
|
||||
fontSize: 34.sp,
|
||||
),
|
||||
),
|
||||
),
|
||||
GridImagePicker(onChange: (files) => _files = files),
|
||||
100.hb,
|
||||
Divider(height: 1.w),
|
||||
_buildSelectable(),
|
||||
Divider(height: 1.w),
|
||||
28.hb,
|
||||
//TODO 选择话题
|
||||
],
|
||||
).material(color: Colors.white),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
|
||||
class EventDetailPage extends StatefulWidget {
|
||||
EventDetailPage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_EventDetailPageState createState() => _EventDetailPageState();
|
||||
}
|
||||
|
||||
class _EventDetailPageState extends State<EventDetailPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BeeScaffold(
|
||||
title: '详情',
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:get/get.dart';
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/const/resource.dart';
|
||||
import 'package:akuCommunity/constants/api.dart';
|
||||
import 'package:akuCommunity/model/community/my_event_item_model.dart';
|
||||
import 'package:akuCommunity/utils/bee_date_util.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/picker/bee_image_preview.dart';
|
||||
|
||||
class MyEventCard extends StatelessWidget {
|
||||
final MyEventItemModel model;
|
||||
final MyEventItemModel preModel;
|
||||
const MyEventCard({
|
||||
Key key,
|
||||
@required this.model,
|
||||
@required this.preModel,
|
||||
}) : super(key: key);
|
||||
|
||||
bool get isFirst => preModel == null;
|
||||
|
||||
bool get notSameYear => model.date.year != (preModel?.date?.year ?? 0);
|
||||
|
||||
BeeDateUtil get beeDate => BeeDateUtil(model.date);
|
||||
|
||||
Widget title() {
|
||||
if (beeDate.sameDay) return '今天'.text.size(52.sp).bold.make();
|
||||
if (beeDate.isYesterday)
|
||||
return '昨天'.text.size(52.sp).bold.make();
|
||||
else
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
model.date.day.toString().text.size(52.sp).bold.make(),
|
||||
'${model.date.month}月'.text.size(36.sp).make(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
(notSameYear && model.date.year != DateTime.now().year)
|
||||
? '${model.date.year}年'
|
||||
.text
|
||||
.bold
|
||||
.size(52.sp)
|
||||
.make()
|
||||
.paddingOnly(left: 32.w, top: isFirst ? 0 : 64.w, bottom: 32.w)
|
||||
: SizedBox(),
|
||||
MaterialButton(
|
||||
onPressed: () {},
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 200.w,
|
||||
padding: EdgeInsets.only(left: 32.w),
|
||||
alignment: Alignment.topLeft,
|
||||
child: beeDate.sameDay ? SizedBox() : title(),
|
||||
),
|
||||
model.imgUrl.length == 0
|
||||
? SizedBox(height: 152.w)
|
||||
: GestureDetector(
|
||||
onTap: () {
|
||||
Get.to(
|
||||
BeeImagePreview.path(path: model.imgUrl.first.url),
|
||||
opaque: false,
|
||||
);
|
||||
},
|
||||
child: Hero(
|
||||
tag: model.imgUrl.first.url,
|
||||
child: Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black12,
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
child: FadeInImage.assetNetwork(
|
||||
placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP,
|
||||
image: API.image(model.imgUrl.first.url),
|
||||
width: 152.w,
|
||||
height: 152.w,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
10.wb,
|
||||
model.content.text.make().expand(),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue