parent
11f9ce371a
commit
ec5a042860
@ -1,168 +0,0 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:velocity_x/velocity_x.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/base/base_style.dart';
|
||||
import 'package:akuCommunity/pages/community/note_create_page.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
import 'widget/tab_list.dart';
|
||||
|
||||
//TODO CLEAN BOTTOM CODES.
|
||||
@Deprecated("sh*t community_index need to be cleaned.")
|
||||
class CommunityIndex extends StatefulWidget {
|
||||
CommunityIndex({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_CommunityIndexState createState() => _CommunityIndexState();
|
||||
}
|
||||
|
||||
class _CommunityIndexState extends State<CommunityIndex>
|
||||
with AutomaticKeepAliveClientMixin, SingleTickerProviderStateMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
TabController _tabController;
|
||||
|
||||
List tabs = [
|
||||
{'name': '最新', 'id': 'new'},
|
||||
{'name': '话题', 'id': 'new'},
|
||||
{'name': '我的', 'id': 'new'},
|
||||
];
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
// 创建Controller
|
||||
_tabController = TabController(length: tabs.length, vsync: this);
|
||||
}
|
||||
|
||||
void noteCreateRouter() {
|
||||
NoteCreatePage().to();
|
||||
}
|
||||
|
||||
List<Widget> _listActions() {
|
||||
return [
|
||||
FlatButton(
|
||||
minWidth: 48.w + 27.w * 2,
|
||||
onPressed: () {},
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.bell,
|
||||
size: 48.w,
|
||||
),
|
||||
'消息'.text.black.size(20.sp).make(),
|
||||
],
|
||||
))
|
||||
];
|
||||
}
|
||||
|
||||
// AppBar _appBar() {
|
||||
// return AppBar(
|
||||
// backgroundColor: Colors.white,
|
||||
// elevation: 0,
|
||||
// title: Text("社区"),
|
||||
// centerTitle: true,
|
||||
// actions: _listActions(),
|
||||
// bottom: PreferredSize(
|
||||
// preferredSize: Size.fromHeight(kToolbarHeight),
|
||||
// child: Align(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// child: TabBar(
|
||||
// controller: _tabController,
|
||||
// isScrollable: true,
|
||||
// indicatorColor: Color(0xffFFd000),
|
||||
// labelColor: Color(0xff000000),
|
||||
// unselectedLabelColor: Color(0xFF3A5160).withOpacity(0.5),
|
||||
// indicatorWeight: 2.0,
|
||||
// indicatorSize: TabBarIndicatorSize.label,
|
||||
// labelStyle: TextStyle(
|
||||
// fontSize: 28.sp,
|
||||
// color: Color(0xff333333),
|
||||
// fontWeight: FontWeight.w600,
|
||||
// ),
|
||||
// tabs: List.generate(
|
||||
// tabs.length,
|
||||
// (index) => Tab(
|
||||
// text: tabs[index]['name'],
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
|
||||
FloatingActionButton _floatingActionButton() {
|
||||
return FloatingActionButton(
|
||||
backgroundColor: Color(0xffffd000),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
),
|
||||
onPressed: noteCreateRouter,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return BeeScaffold(
|
||||
title: '社区',
|
||||
actions: _listActions(),
|
||||
body: Column(
|
||||
children: [
|
||||
Material(
|
||||
color: kForeGroundColor,
|
||||
child: PreferredSize(
|
||||
preferredSize: Size.fromHeight(kToolbarHeight),
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: TabBar(
|
||||
indicatorPadding: EdgeInsets.zero,
|
||||
controller: _tabController,
|
||||
isScrollable: true,
|
||||
indicatorColor: Color(0xffFFd000),
|
||||
indicatorWeight: 2.w,
|
||||
indicatorSize: TabBarIndicatorSize.label,
|
||||
unselectedLabelStyle: TextStyle(
|
||||
color: Color(0xFF333333),
|
||||
fontSize: 28.sp,
|
||||
),
|
||||
labelStyle: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff333333),
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
tabs: List.generate(
|
||||
tabs.length,
|
||||
(index) => Tab(
|
||||
text: tabs[index]['name'],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: TabBarView(
|
||||
controller: _tabController,
|
||||
children: List.generate(
|
||||
tabs.length,
|
||||
(index) => TabList(index: index),
|
||||
),
|
||||
),
|
||||
),
|
||||
// _floatingActionButton(),
|
||||
],
|
||||
),
|
||||
fab: _floatingActionButton(),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,269 +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/base/assets_image.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/bee_scaffold.dart';
|
||||
|
||||
class NoteCreatePage extends StatefulWidget {
|
||||
NoteCreatePage({Key key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_NoteCreatePageState createState() => _NoteCreatePageState();
|
||||
}
|
||||
|
||||
class _NoteCreatePageState extends State<NoteCreatePage> {
|
||||
TextEditingController _noteContent = new TextEditingController();
|
||||
|
||||
String hintText = '这一刻的想法...';
|
||||
|
||||
bool _isSelect = false;
|
||||
|
||||
List<Map<String, dynamic>> _themeList = [
|
||||
{'title': '选择话题:', 'isSelect': false},
|
||||
{'title': "#教师节", 'isSelect': false},
|
||||
{'title': "#快乐植树节", 'isSelect': false},
|
||||
{'title': "#关爱老人", 'isSelect': false},
|
||||
{'title': "#运动会", 'isSelect': false},
|
||||
];
|
||||
|
||||
|
||||
|
||||
Container _containerTextField() {
|
||||
return Container(
|
||||
child: TextFormField(
|
||||
cursorColor: Color(0xffffc40c),
|
||||
style: TextStyle(
|
||||
fontSize: 34.sp,
|
||||
),
|
||||
controller: _noteContent,
|
||||
onChanged: (String value) {},
|
||||
maxLines: 6,
|
||||
decoration: InputDecoration(
|
||||
isDense: true,
|
||||
contentPadding: EdgeInsets.only(
|
||||
top: 0.w,
|
||||
bottom: 0.w,
|
||||
),
|
||||
hintText: hintText,
|
||||
border: InputBorder.none, //去掉输入框的下滑线
|
||||
fillColor: Colors.white,
|
||||
filled: true,
|
||||
hintStyle: TextStyle(
|
||||
color: Color(0xff999999),
|
||||
fontSize: 34.sp,
|
||||
fontWeight: FontWeight.normal,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
InkWell _containerAddImage() {
|
||||
return InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
width: 196.w,
|
||||
height: 196.w,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
image: DecorationImage(
|
||||
image: AssetImage(AssetsImage.IMAGEADD), fit: BoxFit.fill),
|
||||
),
|
||||
// child: ,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
InkWell _inkWellSelect() {
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_isSelect = !_isSelect;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.symmetric(vertical: 30.w),
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
top: BorderSide(color: Color(0xffd8d8d8), width: 1),
|
||||
bottom: BorderSide(color: Color(0xffd8d8d8), width: 1),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Icon(
|
||||
AntDesign.message1,
|
||||
color: Color(0xff333333),
|
||||
size: 28.sp,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Text(
|
||||
'不可评论',
|
||||
style: TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
_isSelect
|
||||
? Icon(
|
||||
AntDesign.check,
|
||||
color: Color(0xffffd003),
|
||||
size: 40.sp,
|
||||
)
|
||||
: SizedBox(height: 40.sp),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Wrap _wrapThemeList() {
|
||||
return Wrap(
|
||||
spacing: 15.w,
|
||||
runSpacing: 20.w,
|
||||
children: _themeList
|
||||
.asMap()
|
||||
.keys
|
||||
.map((index) => index == 0
|
||||
? Container(
|
||||
padding: EdgeInsets.only(top: 10.w),
|
||||
width: 156.w,
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
_themeList[index]['title'],
|
||||
style: TextStyle(
|
||||
fontSize: 34.sp,
|
||||
color: Color(0xff333333),
|
||||
),
|
||||
),
|
||||
)
|
||||
: InkWell(
|
||||
onTap: () {
|
||||
_themeList.forEach((item) {
|
||||
item['isSelect'] = false;
|
||||
});
|
||||
setState(() {
|
||||
_themeList[index]['isSelect'] = true;
|
||||
});
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: _themeList[index]['isSelect']
|
||||
? Color(0xfffff8e4)
|
||||
: Color(0xffffffff),
|
||||
border: Border.all(
|
||||
color: _themeList[index]['isSelect']
|
||||
? Color(0xffffc40c)
|
||||
: Color(0xff979797),
|
||||
width: 0.5),
|
||||
borderRadius: BorderRadius.all(Radius.circular(36))),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 29.w,
|
||||
vertical: 13.w,
|
||||
),
|
||||
child: Text(
|
||||
_themeList[index]['title'],
|
||||
style: TextStyle(
|
||||
fontSize: 34.sp,
|
||||
color: _themeList[index]['isSelect']
|
||||
? Color(0xff333333)
|
||||
: Color(0xff999999),
|
||||
),
|
||||
),
|
||||
),
|
||||
))
|
||||
.toList());
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double _statusHeight = MediaQuery.of(context).padding.top;
|
||||
return BeeScaffold(
|
||||
title: '社区',
|
||||
leading: InkWell(
|
||||
onTap: () => Get.back(),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(left: 32.w),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'取消',
|
||||
style: TextStyle(
|
||||
fontSize: 34.sp,
|
||||
color: Color(0xff030303),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.only(right: 32.w),
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Container(
|
||||
height: 64.w,
|
||||
width: 116.w,
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xffffd000),
|
||||
borderRadius: BorderRadius.all(Radius.circular(4)),
|
||||
),
|
||||
child: Text(
|
||||
'发表',
|
||||
style: TextStyle(
|
||||
fontSize: 34.sp,
|
||||
color: Color(0xff030303),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
body: SingleChildScrollView(
|
||||
child: Container(
|
||||
height: MediaQuery.of(context).size.height -
|
||||
kToolbarHeight -
|
||||
_statusHeight,
|
||||
color: Colors.white,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.opaque,
|
||||
onTap: () {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(
|
||||
top: 49.w,
|
||||
left: 62.w,
|
||||
right: 62.w,
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_containerTextField(),
|
||||
_containerAddImage(),
|
||||
SizedBox(height: 202.w),
|
||||
_inkWellSelect(),
|
||||
SizedBox(height: 28.w),
|
||||
_wrapThemeList(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,147 +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';
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/pages/community/note_create_page.dart';
|
||||
import 'package:akuCommunity/routers/page_routers.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'widget/trend_card.dart';
|
||||
|
||||
class TopiceDetailPage extends StatefulWidget {
|
||||
final Bundle bundle;
|
||||
TopiceDetailPage({Key key, this.bundle}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TopiceDetailPageState createState() => _TopiceDetailPageState();
|
||||
}
|
||||
|
||||
class _TopiceDetailPageState extends State<TopiceDetailPage> {
|
||||
RefreshController _refreshController =
|
||||
RefreshController(initialRefresh: false);
|
||||
ScrollController _controller;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _onRefresh() async {
|
||||
await Future.delayed(Duration(milliseconds: 1500));
|
||||
|
||||
_refreshController.refreshCompleted();
|
||||
}
|
||||
|
||||
void _onLoading() async {
|
||||
await Future.delayed(Duration(milliseconds: 1500));
|
||||
|
||||
if (mounted) setState(() {});
|
||||
_refreshController.loadComplete();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_refreshController.dispose();
|
||||
}
|
||||
|
||||
SliverAppBar _sliverAppBar(String imagePath) {
|
||||
return SliverAppBar(
|
||||
expandedHeight: 500.w,
|
||||
pinned: true,
|
||||
floating: true,
|
||||
elevation: 0,
|
||||
backgroundColor: Colors.white,
|
||||
leading: IconButton(
|
||||
icon: Icon(AntDesign.left, size: 40.sp),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
flexibleSpace: FlexibleSpaceBar(
|
||||
title: Text('教师节'),
|
||||
background: Image.asset(
|
||||
imagePath,
|
||||
fit: BoxFit.fitHeight,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Positioned _positionedFloatActionButton() {
|
||||
return Positioned(
|
||||
bottom: 124.w,
|
||||
right: 32.w,
|
||||
child: FloatingActionButton(
|
||||
backgroundColor: Color(0xffffd000),
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
color: Colors.white,
|
||||
size: 40.sp,
|
||||
),
|
||||
onPressed: () {
|
||||
NoteCreatePage().to();
|
||||
}));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
double _statusHeight = MediaQuery.of(context).padding.top;
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
RefreshConfiguration(
|
||||
hideFooterWhenNotFull: true,
|
||||
maxOverScrollExtent: 100 + _statusHeight,
|
||||
child: SmartRefresher(
|
||||
controller: _refreshController,
|
||||
header: ClassicHeader(
|
||||
height: _statusHeight + 60,
|
||||
outerBuilder: (child) {
|
||||
return Container(
|
||||
padding: EdgeInsets.only(top: _statusHeight),
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
height: 60,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
footer: ClassicFooter(),
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
enablePullUp: true,
|
||||
child: CustomScrollView(
|
||||
controller: _controller,
|
||||
slivers: [
|
||||
_sliverAppBar(widget.bundle.getMap('topicMap')['imagePath']),
|
||||
SliverToBoxAdapter(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) => TrendCard(
|
||||
name: '秋森',
|
||||
content: '真的 很喜欢这个小区,保安也非常好',
|
||||
),
|
||||
itemCount: 6,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
_positionedFloatActionButton(),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,191 +0,0 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/circle_trend.dart';
|
||||
import 'topic_card.dart';
|
||||
import 'trend_card.dart';
|
||||
|
||||
class TabList extends StatefulWidget {
|
||||
final int index;
|
||||
TabList({Key key, this.index}) : super(key: key);
|
||||
|
||||
@override
|
||||
_TabListState createState() => _TabListState();
|
||||
}
|
||||
|
||||
class _TabListState extends State<TabList> with AutomaticKeepAliveClientMixin {
|
||||
@override
|
||||
bool get wantKeepAlive => true;
|
||||
|
||||
List<Map<String, dynamic>> _circleList = [
|
||||
{
|
||||
'title': '今天',
|
||||
'contentList': <Map<String, dynamic>>[
|
||||
{
|
||||
'subtitle': '智慧社区真方便',
|
||||
'imagePath':
|
||||
'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1107708528,2478822843&fm=26&gp=0.jpg'
|
||||
},
|
||||
{
|
||||
'subtitle': '打卡成功!每天都要美美哒',
|
||||
'imagePath':
|
||||
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=1635278618,744809538&fm=26&gp=0.jpg'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'title': '118月',
|
||||
'contentList': <Map<String, dynamic>>[
|
||||
{
|
||||
'subtitle': '健身完毕就去吃火锅,奖励自己一回,偶尔一顿应该没什么吧!',
|
||||
'imagePath':
|
||||
'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1771079224,2955282519&fm=26&gp=0.jpg'
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
'title': '217月',
|
||||
'contentList': <Map<String, dynamic>>[
|
||||
{
|
||||
'subtitle': '头疼非常头疼',
|
||||
'imagePath':
|
||||
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2951929786,3989144852&fm=26&gp=0.jpg'
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> _topicList = [
|
||||
{
|
||||
'title': '教师节到啦,你们有什么想对老师说的吗',
|
||||
'subtitle': '三尺讲台,三寸舌,三寸笔,三千桃李;十年树木,十载风,十载雨,十万栋梁。',
|
||||
'imagePath': 'assets/example/topic1.png',
|
||||
'hotNum': '197298'
|
||||
},
|
||||
{
|
||||
'title': '开展全民健身运动,全面建设小康社会',
|
||||
'subtitle': '生命在于运动,勇创辉煌',
|
||||
'imagePath': 'assets/example/topic2.png',
|
||||
'hotNum': '137128'
|
||||
},
|
||||
{
|
||||
'title': '端午品香粽,美味万家颂',
|
||||
'subtitle': '五月五过端午,包粽子赛龙舟,熏艾草挂荷包,家家户户齐欢乐',
|
||||
'imagePath': 'assets/example/topic3.png',
|
||||
'hotNum': '147128'
|
||||
}
|
||||
];
|
||||
|
||||
List<Map<String, dynamic>> _newsList = [
|
||||
{
|
||||
'name': '王管事',
|
||||
'content': '智慧社区真美丽',
|
||||
'imageUrl': <String>[
|
||||
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=129367535,2478805251&fm=26&gp=0.jpg',
|
||||
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=107966910,699677438&fm=26&gp=0.jpg',
|
||||
'https://ss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=3011269428,2056805718&fm=26&gp=0.jpg'
|
||||
],
|
||||
'isLike': false,
|
||||
'avatar': Image.asset('assets/example/touxiang1.png'),
|
||||
},
|
||||
{
|
||||
'name': '马泽鹏',
|
||||
'content': '真的 很喜欢这个小区,保安也非常好',
|
||||
'imageUrl': <String>[
|
||||
'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=3445658157,2379681095&fm=26&gp=0.jpg',
|
||||
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=3539674557,3804837870&fm=26&gp=0.jpg',
|
||||
],
|
||||
'isLike': true,
|
||||
'avatar': Image.asset('assets/example/touxiang2.png')
|
||||
},
|
||||
{
|
||||
'name': '王管事',
|
||||
'content': '智慧城市,共和社会',
|
||||
'imageUrl': <String>[
|
||||
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2446247351,2922660058&fm=26&gp=0.jpg',
|
||||
'https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1601274815221&di=3a50314a4d2c7188f6003f67d24177c2&imgtype=0&src=http%3A%2F%2Fimg1.cache.netease.com%2Fcatchpic%2F6%2F62%2F620DAF59053DF902F1D991EDBF14FD26.gif',
|
||||
],
|
||||
'isLike': false,
|
||||
'avatar': Image.asset('assets/example/touxiang3.jpeg')
|
||||
},
|
||||
];
|
||||
|
||||
RefreshController _refreshController =
|
||||
RefreshController(initialRefresh: false);
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
void _onRefresh() async {
|
||||
await Future.delayed(Duration(milliseconds: 1500));
|
||||
|
||||
_refreshController.refreshCompleted();
|
||||
}
|
||||
|
||||
void _onLoading() async {
|
||||
await Future.delayed(Duration(milliseconds: 1500));
|
||||
|
||||
if (mounted) setState(() {});
|
||||
_refreshController.loadComplete();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
_refreshController.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
super.build(context);
|
||||
return SmartRefresher(
|
||||
controller: _refreshController,
|
||||
header: WaterDropHeader(),
|
||||
footer: ClassicFooter(),
|
||||
onRefresh: _onRefresh,
|
||||
onLoading: _onLoading,
|
||||
enablePullUp: true,
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
itemBuilder: (context, index) => widget.index == 0
|
||||
? TrendCard(
|
||||
name: _newsList[index]['name'],
|
||||
content: _newsList[index]['content'],
|
||||
imageUrl: _newsList[index]['imageUrl'],
|
||||
isLike: _newsList[index]['isLike'],
|
||||
avatar: _newsList[index]['avatar'])
|
||||
: widget.index == 1
|
||||
? TopicCard(
|
||||
title: _topicList[index]['title'],
|
||||
subtitle: _topicList[index]['subtitle'],
|
||||
imagePath: _topicList[index]['imagePath'],
|
||||
hotNum: _topicList[index]['hotNum'],
|
||||
)
|
||||
: Container(
|
||||
margin: EdgeInsets.only(top: 32.w),
|
||||
child: CircleTrend(
|
||||
title: _circleList[index]['title'],
|
||||
contentList: _circleList[index]['contentList'],
|
||||
),
|
||||
),
|
||||
itemCount: widget.index == 0
|
||||
? _newsList.length
|
||||
: widget.index == 1
|
||||
? _topicList.length
|
||||
: _circleList.length,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,128 +0,0 @@
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
|
||||
// Project imports:
|
||||
import 'package:akuCommunity/pages/community/topice_detail_page.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
|
||||
class TopicCard extends StatefulWidget {
|
||||
final String title, subtitle, imagePath, hotNum;
|
||||
TopicCard({Key key, this.title, this.subtitle, this.imagePath, this.hotNum})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_TopicCardState createState() => _TopicCardState();
|
||||
}
|
||||
|
||||
class _TopicCardState extends State<TopicCard> {
|
||||
TextStyle _textStyleTitle() {
|
||||
return TextStyle(fontSize: 28.sp, color: Color(0xff333333));
|
||||
}
|
||||
|
||||
TextStyle _textStyleSubtitle() {
|
||||
return TextStyle(fontSize: 22.sp, color: Color(0xff666666));
|
||||
}
|
||||
|
||||
TextStyle _textStyleHot() {
|
||||
return TextStyle(fontSize: 22.sp, color: Color(0xff333333));
|
||||
}
|
||||
|
||||
void topiceDetailRouter(String subtitle, String imagePath) {
|
||||
TopiceDetailPage().to();
|
||||
}
|
||||
|
||||
Row _rowTopic(String title, String subtitle, String imagePath) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Image.asset(
|
||||
imagePath,
|
||||
height: 160.w,
|
||||
width: 250.w,
|
||||
),
|
||||
SizedBox(width: 12.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 383.w,
|
||||
height: 80.w,
|
||||
child: Text(
|
||||
title,
|
||||
maxLines: 2,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: _textStyleTitle(),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Container(
|
||||
width: 365.w,
|
||||
child: Text(
|
||||
subtitle,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: _textStyleSubtitle(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Positioned _positionedHot(String hotNum) {
|
||||
return Positioned(
|
||||
bottom: 0,
|
||||
right: 0,
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
MaterialIcons.whatshot,
|
||||
color: Color(0xffd4270a),
|
||||
size: 23.sp,
|
||||
),
|
||||
SizedBox(width: 10.w),
|
||||
Text(
|
||||
hotNum,
|
||||
style: _textStyleHot(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.white,
|
||||
margin: EdgeInsets.only(
|
||||
left: 32.w,
|
||||
right: 32.w,
|
||||
top: 20.w,
|
||||
),
|
||||
padding: EdgeInsets.all(20.w),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
topiceDetailRouter(
|
||||
widget.subtitle,
|
||||
widget.imagePath,
|
||||
);
|
||||
},
|
||||
child: Stack(
|
||||
children: [
|
||||
_rowTopic(
|
||||
widget.title,
|
||||
widget.subtitle,
|
||||
widget.imagePath,
|
||||
),
|
||||
_positionedHot(widget.hotNum),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -1,328 +0,0 @@
|
||||
// Dart imports:
|
||||
import 'dart:ui';
|
||||
|
||||
// Flutter imports:
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
// Package imports:
|
||||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:flutter_icons/flutter_icons.dart';
|
||||
import 'package:flutter_screenutil/flutter_screenutil.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/extensions/num_ext.dart';
|
||||
import 'package:akuCommunity/utils/headers.dart';
|
||||
import 'package:akuCommunity/widget/expandable_text.dart';
|
||||
import 'package:akuCommunity/widget/views/horizontal_image_view.dart';
|
||||
|
||||
class TrendCard extends StatefulWidget {
|
||||
final String name;
|
||||
final String content;
|
||||
final List<String> imageUrl;
|
||||
final bool isLike;
|
||||
final Image avatar;
|
||||
TrendCard(
|
||||
{Key key,
|
||||
this.name,
|
||||
this.content,
|
||||
this.imageUrl,
|
||||
this.isLike,
|
||||
this.avatar})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_TrendCardState createState() => _TrendCardState();
|
||||
}
|
||||
|
||||
class _TrendCardState extends State<TrendCard> {
|
||||
bool _isLike;
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_isLike = widget.isLike ?? false;
|
||||
}
|
||||
|
||||
TextStyle _textStyleName() {
|
||||
return TextStyle(
|
||||
fontSize: 36.sp,
|
||||
color: Color(0xff333333),
|
||||
);
|
||||
}
|
||||
|
||||
TextStyle _textStyleContent() {
|
||||
return TextStyle(
|
||||
fontSize: 32.sp,
|
||||
color: Color(0xff333333),
|
||||
);
|
||||
}
|
||||
|
||||
TextStyle _textStyleTag() {
|
||||
return TextStyle(
|
||||
fontSize: 28.sp,
|
||||
color: Color(0xff999999),
|
||||
);
|
||||
}
|
||||
|
||||
void _showDeletDialog() {
|
||||
showCupertinoDialog(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return CupertinoAlertDialog(
|
||||
title: '你确定删除吗?'.text.black.size(34.sp).isIntrinsic.make(),
|
||||
actions: <Widget>[
|
||||
CupertinoDialogAction(
|
||||
child: '取消'.text.black.size(34.sp).isIntrinsic.make(),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
CupertinoDialogAction(
|
||||
child: '确定'
|
||||
.text
|
||||
.color(Color(0xFFFF8200))
|
||||
.size(34.sp)
|
||||
.isIntrinsic
|
||||
.make(),
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
Widget _columnCard(String name, String content, Image avatar) {
|
||||
return Stack(
|
||||
children: [
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 86.w,
|
||||
height: 86.w,
|
||||
child: avatar,
|
||||
),
|
||||
SizedBox(width: 9.w),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 10.w),
|
||||
child: Text(
|
||||
name,
|
||||
style: _textStyleName(),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 6.w),
|
||||
Container(
|
||||
padding: EdgeInsets.only(left: 14.w),
|
||||
child: ExpandableText(
|
||||
text: content,
|
||||
maxLines: 2,
|
||||
style: _textStyleContent(),
|
||||
expand: false,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 20.w),
|
||||
Padding(
|
||||
padding: EdgeInsets.only(left: 95.w),
|
||||
child: Column(
|
||||
children: [
|
||||
HorizontalImageView(widget.imageUrl),
|
||||
SizedBox(height: 20.w),
|
||||
Stack(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'1分钟前',
|
||||
style: _textStyleTag(),
|
||||
),
|
||||
40.wb,
|
||||
InkWell(
|
||||
onTap: () {
|
||||
_showDeletDialog();
|
||||
},
|
||||
child: '删除'.text.black.size(28.sp).make()),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Positioned(
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: Builder(
|
||||
builder: (context) {
|
||||
return InkWell(
|
||||
onTap: () => BotToast.showAttachedWidget(
|
||||
attachedBuilder: (CancelFunc cancelFunc) {
|
||||
return Material(
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Color(0xFFD8D8D8),
|
||||
borderRadius: BorderRadius.circular(8.w),
|
||||
),
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: 15.w, horizontal: 30.w),
|
||||
width: 363.w,
|
||||
height: 78.w,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
_isLike = !_isLike;
|
||||
cancelFunc();
|
||||
setState(() {});
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
_isLike
|
||||
? AntDesign.heart
|
||||
: AntDesign.hearto,
|
||||
color: _isLike
|
||||
? Color(0xffff6666)
|
||||
: Colors.black,
|
||||
size: 32.w,
|
||||
),
|
||||
10.wb,
|
||||
'赞'
|
||||
.text
|
||||
.color(ktextPrimary)
|
||||
.size(28.sp)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: VerticalDivider(
|
||||
width: 0,
|
||||
thickness: 1.w,
|
||||
color: Color(0xFF979797),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: InkWell(
|
||||
onTap: () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.ellipses_bubble,
|
||||
color: Colors.black,
|
||||
size: 32.w,
|
||||
),
|
||||
10.wb,
|
||||
'评论'
|
||||
.text
|
||||
.color(ktextPrimary)
|
||||
.size(28.sp)
|
||||
.make(),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
preferDirection: PreferDirection.rightCenter,
|
||||
targetContext: context,
|
||||
),
|
||||
child: Icon(
|
||||
MaterialIcons.more,
|
||||
color: Color(0xffd8d8d8),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: PopupMenuButton<int>(
|
||||
onSelected: (value) {
|
||||
switch (value) {
|
||||
case 0:
|
||||
BotToast.showText(text: '举报成功');
|
||||
break;
|
||||
default:
|
||||
}
|
||||
},
|
||||
padding: EdgeInsets.zero,
|
||||
icon: Icon(
|
||||
CupertinoIcons.chevron_down,
|
||||
size: 25.w,
|
||||
),
|
||||
itemBuilder: (context) {
|
||||
return [
|
||||
PopupMenuItem(
|
||||
value: 0,
|
||||
child: Container(
|
||||
width: 150.w,
|
||||
height: 50.w,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
CupertinoIcons.exclamationmark_triangle,
|
||||
size: 50.w,
|
||||
),
|
||||
10.wb,
|
||||
'举报'.text.black.size(30.sp).make()
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
];
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
border: Border(
|
||||
bottom: BorderSide(
|
||||
width: 0.5, //宽度
|
||||
color: Color(0xffe5e5e5), //边框颜色
|
||||
),
|
||||
),
|
||||
),
|
||||
padding: EdgeInsets.only(
|
||||
top: 46.w,
|
||||
left: 32.w,
|
||||
bottom: 22.w,
|
||||
right: 32.w,
|
||||
),
|
||||
child: _columnCard(widget.name, widget.content, widget.avatar));
|
||||
}
|
||||
}
|
Loading…
Reference in new issue