You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/pages/community/note_create_page.dart

265 lines
7.8 KiB

4 years ago
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
4 years ago
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/base/assets_image.dart';
import 'package:flutter_icons/flutter_icons.dart';
4 years ago
import 'package:get/get.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},
];
4 years ago
Container _containerTextField() {
return Container(
child: TextFormField(
cursorColor: Color(0xffffc40c),
style: TextStyle(
4 years ago
fontSize: 34.sp,
),
controller: _noteContent,
onChanged: (String value) {},
maxLines: 6,
decoration: InputDecoration(
isDense: true,
contentPadding: EdgeInsets.only(
4 years ago
top: 0.w,
bottom: 0.w,
),
hintText: hintText,
border: InputBorder.none, //去掉输入框的下滑线
fillColor: Colors.white,
filled: true,
hintStyle: TextStyle(
color: Color(0xff999999),
4 years ago
fontSize: 34.sp,
fontWeight: FontWeight.normal,
),
),
),
);
}
InkWell _containerAddImage() {
return InkWell(
onTap: () {},
child: Container(
4 years ago
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(
4 years ago
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),
4 years ago
size: 28.sp,
),
4 years ago
SizedBox(width: 10.w),
Text(
'不可评论',
style: TextStyle(
4 years ago
fontSize: 28.sp,
color: Color(0xff333333),
),
),
],
),
_isSelect
? Icon(
AntDesign.check,
color: Color(0xffffd003),
4 years ago
size: 40.sp,
)
4 years ago
: SizedBox(height: 40.sp),
],
),
),
);
}
Wrap _wrapThemeList() {
return Wrap(
4 years ago
spacing: 15.w,
runSpacing: 20.w,
children: _themeList
.asMap()
.keys
.map((index) => index == 0
? Container(
4 years ago
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),
),
),
4 years ago
)
: 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(
4 years ago
horizontal: 29.w,
vertical: 13.w,
),
child: Text(
_themeList[index]['title'],
style: TextStyle(
4 years ago
fontSize: 34.sp,
color: _themeList[index]['isSelect']
? Color(0xff333333)
: Color(0xff999999),
),
),
),
))
.toList());
}
@override
Widget build(BuildContext context) {
double _statusHeight = MediaQuery.of(context).padding.top;
4 years ago
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(
4 years ago
top: 49.w,
left: 62.w,
right: 62.w,
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_containerTextField(),
_containerAddImage(),
4 years ago
SizedBox(height: 202.w),
_inkWellSelect(),
4 years ago
SizedBox(height: 28.w),
_wrapThemeList(),
],
),
),
),
),
),
);
}
}