Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  update deto create page
  update deto create page
  update deto create page add check box widget
  rewrite deto create page
  remove some s**t code
hmxc
小赖 4 years ago
commit 26366ae719

@ -1,12 +1,30 @@
// Flutter imports:
// Dart imports:
import 'dart:io';
// Flutter imports: // Flutter imports:
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports:
import 'package:flustars/flustars.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
// Project imports: // Project imports:
import 'package:akuCommunity/base/assets_image.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/bottom_button.dart'; import 'package:akuCommunity/widget/buttons/bee_check_box.dart';
import 'package:akuCommunity/widget/buttons/bee_check_button.dart';
import 'package:akuCommunity/widget/buttons/bottom_button.dart';
import 'package:akuCommunity/widget/buttons/radio_button.dart';
import 'package:akuCommunity/widget/picker/bee_custom_picker.dart';
import 'package:akuCommunity/widget/picker/bee_date_picker.dart';
import 'package:akuCommunity/widget/picker/grid_image_picker.dart'; import 'package:akuCommunity/widget/picker/grid_image_picker.dart';
import 'widget/common_picker.dart'; import 'widget/common_picker.dart';
import 'widget/common_radio.dart'; import 'widget/common_radio.dart';
@ -19,18 +37,36 @@ class DetoCreatePage extends StatefulWidget {
} }
class _DetoCreatePageState extends State<DetoCreatePage> { class _DetoCreatePageState extends State<DetoCreatePage> {
List<Map<String, dynamic>> _listWeight = [ List<File> _files = [];
{'title': '< 50kg', 'isCheck': true}, UserProvider get userProvider => Provider.of<UserProvider>(context);
{'title': '50kg-100kg', 'isCheck': false}, String get firstEstateName {
{'title': '> 100kg', 'isCheck': false} return userProvider.userDetailModel.estateNames.isEmpty
? ''
: userProvider.userDetailModel.estateNames[0];
}
String _itemName;
DateTime _date;
int _selectWeight;
List<String> _listWeight = [
'< 50kg',
'50kg-100kg',
'> 100kg',
];
int _selectApproach;
List<String> _listMode = [
'自己搬运',
'搬家公司',
]; ];
List<Map<String, dynamic>> _listMode = [ List<String> _itemClass = [
{'title': '自己搬运', 'isCheck': true}, '全部',
{'title': '搬家公司', 'isCheck': false}, '家纺',
'家具',
'电器',
]; ];
bool isCheck = false; bool needMoveCompany = false;
Widget _houseAddress(String title, subtitle) { Widget _houseAddress(String title, subtitle) {
return Container( return Container(
@ -60,7 +96,7 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
Container( Container(
margin: EdgeInsets.only(right: 42.w), margin: EdgeInsets.only(right: 42.w),
child: Image.asset( child: Image.asset(
AssetsImage.HOUSEATTESTATION, R.ASSETS_IMAGES_HOUSE_ATTESTATION_PNG,
height: 59.w, height: 59.w,
width: 59.w, width: 59.w,
), ),
@ -99,17 +135,15 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
child: Container( child: Container(
padding: EdgeInsets.only(bottom: 24.w), padding: EdgeInsets.only(bottom: 24.w),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Checkbox( BeeCheckBox(
value: this.isCheck, onChange: (value) {
activeColor: Color(0xffffc40c), needMoveCompany = value;
onChanged: (bool val) {
this.setState(() {
this.isCheck = !this.isCheck;
});
}, },
), ),
10.w.widthBox,
Container( Container(
child: Text( child: Text(
'是否需要物业提供搬家公司联系方式', '是否需要物业提供搬家公司联系方式',
@ -125,82 +159,233 @@ class _DetoCreatePageState extends State<DetoCreatePage> {
); );
} }
Widget _checkCard(String title, List<Map<String, dynamic>> list) { Widget _getWeight() {
return Container( return Container(
height: 96.w, // margin: EdgeInsets.fromLTRB(0, 40.w, 0, 40.w),
padding: EdgeInsets.symmetric(vertical: 28.w), // child: Row(
decoration: BoxDecoration( // children: [
border: // Container(
Border(bottom: BorderSide(color: Color(0xffeeeeee), width: 0.5)), // margin: EdgeInsets.only(right: 30.w),
// child: Text(
// '物品重量',
// style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)),
// ),
// ),
// ...List.generate(
// _listWeight.length,
// (index) => GestureDetector(
// onTap: () {
// setState(() {
// _selectWeight = index;
// });
// },
// child: CommonRadio(
// size: 30.w,
// text: _listWeight[index]
// .text
// .color(ktextPrimary)
// .size(28.sp)
// .make(),
// value: index,
// groupValue: _selectWeight,
// ),
// )),
// ],
// ),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'物品重量'.text.color(ktextPrimary).size(28.sp).make(),
24.w.heightBox,
Wrap(
spacing: 40.w,
children: [
..._listWeight
.map((e) => BeeCheckButton(
title: e,
value: _listWeight.indexOf(e),
groupValue: _selectWeight,
onChange: (value) {
_selectWeight = value;
setState(() {});
},
))
.toList()
],
),
],
), ),
);
}
Widget _getApproach() {
return Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
'搬运方式'.text.color(ktextPrimary).size(28.sp).make(),
24.w.heightBox,
Wrap(
spacing: 40.w,
children: [
..._listMode
.map((e) => BeeCheckButton(
title: e,
value: _listMode.indexOf(e),
groupValue: _selectApproach,
onChange: (value) {
_selectApproach = value;
setState(() {});
},
))
.toList()
],
),
],
),
);
}
Widget _itemPicker(String title, String select, VoidCallback onTap) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
40.w.heightBox,
title.text.color(ktextPrimary).size(28.sp).make(),
16.w.widthBox,
Padding(
padding: EdgeInsets.symmetric(vertical: 30.w),
child: InkWell(
onTap: onTap,
child: Row( child: Row(
children: [ children: [
(select.isEmptyOrNull ? '请选择' : select)
.text
.color(select.isEmptyOrNull ? ktextSubColor : ktextPrimary)
.size(36.sp)
.fontWeight(select.isEmptyOrNull
? FontWeight.normal
: FontWeight.bold)
.make(),
Spacer(),
Icon(
CupertinoIcons.chevron_right,
size: 30.w,
),
],
),
),
),
BeeDivider.horizontal(),
],
);
}
_showItmePicker() async {
_itemName = await Get.bottomSheet(
SizedBox(
child: Material(
borderRadius: BorderRadius.vertical(
top: Radius.circular(20.w),
),
clipBehavior: Clip.antiAlias,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
..._itemClass
.map((e) => Material(
child: InkWell(
onTap: () {
Get.back(result: e);
},
child: Container(
alignment: Alignment.center,
height: 112.w,
width: double.infinity,
child: e.text
.color(ktextPrimary)
.isIntrinsic
.size(28.sp)
.make()),
),
))
.toList(),
Container( Container(
margin: EdgeInsets.only(right: 30.w), height: 16.w,
child: Text( color: Color(0xFFF7F7F7),
title, ),
style: TextStyle(fontSize: 28.sp, color: Color(0xff333333)), Material(
), child: InkWell(
), onTap: () {
CommonRadio( Get.back();
commonlist: list,
fun: (int index) {
setState(() {
list.forEach((item) {
item['isCheck'] = false;
});
list[index]['isCheck'] = true;
});
}, },
) child: Container(
alignment: Alignment.center,
height: 112.w,
width: double.infinity,
child: '取消'
.text
.color(ktextPrimary)
.isIntrinsic
.size(28.sp)
.make()),
),
),
], ],
), ),
),
),
); );
setState(() {});
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return BeeScaffold( return BeeScaffold(
title: '物品出户', title: '物品出户',
body: Container( body: ListView(
color: Colors.white, padding: EdgeInsets.all(32.w),
child: Stack(
children: [
Container(
padding: EdgeInsets.only(
left: 32.w,
right: 32.w,
top: 32.w,
),
child: ListView(
children: [ children: [
_houseAddress('宁波华茂悦峰', '1幢-1单元-702室'), _houseAddress(kEstateName, firstEstateName),
_checkCard('物品重量', _listWeight), _getWeight(),
CommonPicker(title: '出户时间'), _itemPicker(
CommonPicker(title: '物品名称'), '出户时间', DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"),
_checkCard('搬运方式', _listMode), () async {
_inkWellCheckbox(), _date = await BeeDatePicker.timePicker(DateTime.now());
setState(() {});
}),
_itemPicker('物品名称', _itemName, () {
_showItmePicker();
}),
_getApproach(),
_selectApproach == 0 ? SizedBox() : _inkWellCheckbox(),
Container( Container(
margin: EdgeInsets.only(top: 54.w, bottom: 24.w), margin: EdgeInsets.only(top: 54.w, bottom: 24.w),
child: Text( child: Text(
'添加图片信息(0/9)', '添加图片信息(${_files.length}/9)',
style: TextStyle( style: TextStyle(
fontSize: 28.sp, fontSize: 28.sp,
color: Color(0xff333333), color: Color(0xff333333),
), ),
), ),
), ),
GridImagePicker(onChange: (files) {}), GridImagePicker(onChange: (files) {
], _files = files;
), setState(() {});
), }),
Positioned(
bottom: 0,
child: BottomButton(title: '确认提交'),
)
], ],
), ),
bottomNavi: BottomButton(
child: '确认提交'.text.color(ktextPrimary).bold.make(),
onPressed: () {},
), ),
); );
// Positioned(
// bottom: 0,
// child: BottomButton(title: '确认提交'),
// )
// ],
// ),
} }
} }

@ -11,6 +11,7 @@ import 'package:flutter_picker/flutter_picker.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/picker/bee_date_picker.dart'; import 'package:akuCommunity/widget/picker/bee_date_picker.dart';
@Deprecated('s**t code should be remove')
class CommonPicker extends StatefulWidget { class CommonPicker extends StatefulWidget {
final String title; final String title;
CommonPicker({Key key, this.title}) : super(key: key); CommonPicker({Key key, this.title}) : super(key: key);

@ -1,64 +1,67 @@
// Flutter imports: // Flutter imports:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Project imports: // Project imports:
import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/animated/animated_scale.dart';
class CommonRadio extends StatefulWidget { class CommonRadio<T> extends StatefulWidget {
final List<Map<String, dynamic>> commonlist; final T value;
final Function fun; final T groupValue;
CommonRadio({Key key, this.commonlist, this.fun}) : super(key: key); final Widget text;
final double size;
CommonRadio({Key key, this.value, this.groupValue, this.text, this.size})
: super(key: key);
@override @override
_CommonRadioState createState() => _CommonRadioState(); _CommonRadioState createState() => _CommonRadioState();
} }
class _CommonRadioState extends State<CommonRadio> { class _CommonRadioState extends State<CommonRadio> {
InkWell _inkWellRadio(String title, bool isCheck,int index, Function fun) { bool get _selected => widget.value == widget.groupValue;
return InkWell( double get smallSize {
onTap: () { return widget.size.isNull ? 24.w : (widget.size * 24 / 40);
fun(index); }
},
child: Container( @override
margin: EdgeInsets.only(left: 20.w), Widget build(BuildContext context) {
child: Row( return Row(
children: [ children: [
Icon( AnimatedContainer(
isCheck height: widget.size ?? 40.w,
? Icons.radio_button_checked width: widget.size ?? 40.w,
: Icons.radio_button_unchecked, decoration: BoxDecoration(
size: 32.w, border: Border.all(
color: isCheck ? BaseStyle.colorffc40c : BaseStyle.color979797, color: _selected ? kPrimaryColor : Color(0xFF979797),
width: 3.w,
), ),
SizedBox(width: 10.w), borderRadius: BorderRadius.circular(20.w),
Text(
title,
style: TextStyle(
fontSize: BaseStyle.fontSize28, color: ktextPrimary),
), ),
], duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
alignment: Alignment.center,
child: AnimatedOpacity(
duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic,
opacity: _selected ? 1 : 0,
child: AnimatedScale(
scale: _selected ? 1 : 0,
child: Container(
height: smallSize,
width: smallSize,
decoration: BoxDecoration(
color: kPrimaryColor,
borderRadius: BorderRadius.circular(12.w),
), ),
), ),
);
}
@override
Widget build(BuildContext context) {
return Container(
child: Row(
children: widget.commonlist
.asMap()
.keys
.map((index) => _inkWellRadio(
widget.commonlist[index]['title'],
widget.commonlist[index]['isCheck'],
index,
widget.fun
))
.toList(),
), ),
),
),
10.w.widthBox,
widget.text,
10.w.widthBox,
],
); );
} }
} }

@ -4,15 +4,16 @@ import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
// Project imports: // Project imports:
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/constants/api.dart'; import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/manager/goods_out_model.dart'; import 'package:akuCommunity/model/manager/goods_out_model.dart';
import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/deto_create_page.dart'; import 'package:akuCommunity/pages/goods_deto_page/deto_create_page/deto_create_page.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart'; import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/bottom_button.dart';
import 'widget/goods_info_card.dart'; import 'widget/goods_info_card.dart';
class GoodsDetoPage extends StatefulWidget { class GoodsDetoPage extends StatefulWidget {
@ -48,12 +49,14 @@ class _GoodsDetoPageState extends State<GoodsDetoPage> {
}, },
), ),
), ),
bottomNavi: BottomButton( bottomNavi: MaterialButton(
title: '新增', color: kPrimaryColor,
fun: () {
padding: EdgeInsets.only(top:26.w ,bottom: MediaQuery.of(context).padding.bottom+26.w),
child: '新增'.text.black.size(32.sp).bold.make(),
onPressed: () {
DetoCreatePage().to(); DetoCreatePage().to();
}, },),
),
); );
} }
} }

@ -1,5 +1,4 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/base/base_style.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -8,6 +7,7 @@ import 'package:flutter_icons/flutter_icons.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart';
// Project imports: // Project imports:
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/routers/page_routers.dart'; import 'package:akuCommunity/routers/page_routers.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';

@ -38,7 +38,7 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
String reportText; String reportText;
List<String> _buttons = ['公区保修', '家庭维修']; List<String> _buttons = ['公区保修', '家庭维修'];
int _selectType; int _selectType;
List<File> _files=[]; List<File> _files = [];
@override @override
void initState() { void initState() {
super.initState(); super.initState();
@ -101,8 +101,8 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
int value, int value,
) { ) {
return FlatButton( return FlatButton(
minWidth: 200.w, // minWidth: 200.w,
height: 72.w, // height: 72.w,
onPressed: () { onPressed: () {
setState(() { setState(() {
_selectType = value; _selectType = value;
@ -182,16 +182,27 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
'添加图片信息(${0}/9)'.text.black.size(28.sp).make(), '添加图片信息(${_files.length}/9)'.text.black.size(28.sp).make(),
24.w.heightBox, 24.w.heightBox,
GridImagePicker(onChange: (files) { GridImagePicker(onChange: (files) {
_files = files; _files = files;
setState(() {});
}) })
], ],
), ),
); );
} }
bool _canSubmit(int seletType, String text) {
if (seletType.isNull) {
return false;
} else if (text.isEmpty) {
return false;
} else {
return true;
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
UserProvider userProvider = Provider.of<UserProvider>(context); UserProvider userProvider = Provider.of<UserProvider>(context);
@ -214,15 +225,19 @@ class _AddFixedSubmitPageState extends State<AddFixedSubmitPage> {
MaterialButton( MaterialButton(
minWidth: double.infinity, minWidth: double.infinity,
height: 98.w, height: 98.w,
onPressed: () async { onPressed: _canSubmit(_selectType, _textEditingController.text)
List<String> urls = ? () async {
await NetUtil().uploadFiles(_files, API.upload.uploadRepair); List<String> urls = await NetUtil()
.uploadFiles(_files, API.upload.uploadRepair);
BaseModel baseModel = await ManagerFunc.reportRepairInsert( BaseModel baseModel = await ManagerFunc.reportRepairInsert(
_selectType + 1, _textEditingController.text, urls); _selectType + 1, _textEditingController.text, urls);
if (baseModel.status) { if (baseModel.status) {
FinishFixedSubmitPage().to(); FinishFixedSubmitPage().to();
} else } else
BotToast.showText(text: baseModel.message); BotToast.showText(text: baseModel.message);
}
: () {
BotToast.showText(text: '请填写完整报修信息!');
}, },
child: '确认提交'.text.black.bold.size(32.sp).make(), child: '确认提交'.text.black.bold.size(32.sp).make(),
color: kPrimaryColor, color: kPrimaryColor,

@ -1,11 +1,9 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/pages/things_page/widget/fixed_evaluate_page.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -16,8 +14,10 @@ import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/model/manager/fixed_detail_model.dart'; import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/pages/manager_func.dart'; import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/pages/things_page/widget/fixed_evaluate_page.dart';
import 'package:akuCommunity/utils/bee_map.dart'; import 'package:akuCommunity/utils/bee_map.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/bee_divider.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:akuCommunity/widget/views/horizontal_image_view.dart'; import 'package:akuCommunity/widget/views/horizontal_image_view.dart';

@ -1,15 +1,20 @@
import 'package:akuCommunity/base/base_style.dart'; // Flutter imports:
import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports:
import 'package:bot_toast/bot_toast.dart';
import 'package:flutter_rating_bar/flutter_rating_bar.dart'; import 'package:flutter_rating_bar/flutter_rating_bar.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
// Project imports:
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/model/manager/fixed_detail_model.dart';
import 'package:akuCommunity/pages/manager_func.dart';
import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
class FixedEvaluatePage extends StatefulWidget { class FixedEvaluatePage extends StatefulWidget {
final FixedDetailModel model; final FixedDetailModel model;

@ -2,6 +2,7 @@ export 'package:flutter_screenutil/flutter_screenutil.dart';
export 'package:akuCommunity/extensions/page_router.dart'; export 'package:akuCommunity/extensions/page_router.dart';
export 'package:akuCommunity/extensions/num_ext.dart'; export 'package:akuCommunity/extensions/num_ext.dart';
export 'package:akuCommunity/extensions/widget_list_ext.dart'; export 'package:akuCommunity/extensions/widget_list_ext.dart';
export 'package:velocity_x/velocity_x.dart';
// class Screenutil { // class Screenutil {
// static double length(double lengthNum) => ScreenUtil().setWidth(lengthNum); // static double length(double lengthNum) => ScreenUtil().setWidth(lengthNum);

@ -0,0 +1,47 @@
// Flutter imports:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// Project imports:
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/utils/headers.dart';
class BeeCheckBox extends StatefulWidget {
final Function(bool) onChange;
BeeCheckBox({Key key, this.onChange}) : super(key: key);
@override
_BeeCheckBoxState createState() => _BeeCheckBoxState();
}
class _BeeCheckBoxState extends State<BeeCheckBox> {
bool _isSelect = false;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
_isSelect = !_isSelect;
setState(() {});
widget.onChange(_isSelect);
},
child: AnimatedContainer(
duration: Duration(milliseconds: 300),
decoration: BoxDecoration(
border: Border.all(
width: 1.w, color: _isSelect ? kPrimaryColor : kDarkSubColor),
color: _isSelect ? kPrimaryColor : Colors.transparent,
),
curve: Curves.easeInOutCubic,
width: 28.w,
height: 28.w,
child: _isSelect
? Icon(
CupertinoIcons.check_mark,
size: 25.w,
color: Colors.white,
)
: SizedBox(),
),
);
}
}

@ -0,0 +1,40 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Project imports:
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/utils/headers.dart';
class BeeCheckButton<T> extends StatefulWidget {
final Function(T value) onChange;
final T value;
final T groupValue;
final String title;
BeeCheckButton(
{Key key, this.onChange, this.value, this.groupValue, this.title})
: super(key: key);
@override
_BeeCheckButtonState createState() => _BeeCheckButtonState();
}
class _BeeCheckButtonState extends State<BeeCheckButton> {
bool get isSelect => widget.groupValue == widget.value;
@override
Widget build(BuildContext context) {
return FlatButton(
onPressed: () {
widget.onChange(widget.value);
},
child: widget.title.text
.color(isSelect ? ktextPrimary : Color(0xFF979797))
.size(32.sp)
.make(),
padding: EdgeInsets.symmetric(horizontal: 34.w, vertical: 14.w),
shape: RoundedRectangleBorder(
side: BorderSide(
color: isSelect ? kPrimaryColor : ktextSubColor, width: 3.w),
borderRadius: BorderRadius.circular(36.w)),
);
}
}

@ -0,0 +1,48 @@
// Flutter imports:
import 'package:flutter/material.dart';
// Package imports:
import 'package:get/get.dart';
// Project imports:
import 'package:akuCommunity/utils/headers.dart';
class BeeCustomPicker extends StatefulWidget {
final Widget body;
final VoidCallback onPressed;
BeeCustomPicker({Key key, this.body, this.onPressed}) : super(key: key);
@override
_BeeCustomPickerState createState() => _BeeCustomPickerState();
}
class _BeeCustomPickerState extends State<BeeCustomPicker> {
@override
Widget build(BuildContext context) {
return SizedBox(
child: Material(
borderRadius: BorderRadius.vertical(top: Radius.circular(10)),
child: Column(
children: [
SizedBox(
height: 48,
child: NavigationToolbar(
leading: TextButton(
onPressed: Get.back,
child: '取消'.text.black.make(),
),
trailing: TextButton(
onPressed: widget.onPressed,
child: '确定'.text.black.make(),
),
),
),
widget.body,
],
),
),
height: Get.height / 3,
);
}
}

@ -10,11 +10,31 @@ class BeeDatePicker {
static Future<DateTime> pick(DateTime initDate) async { static Future<DateTime> pick(DateTime initDate) async {
return await Get.bottomSheet(_BeeDatePicker(date: initDate)); return await Get.bottomSheet(_BeeDatePicker(date: initDate));
} }
static Future<DateTime> timePicker(DateTime initDate) async {
return await Get.bottomSheet(_BeeDatePicker(
date: initDate,
min: initDate,
max: initDate.add(Duration(days: 7)),
mode: CupertinoDatePickerMode.dateAndTime,
));
}
} }
class _BeeDatePicker extends StatefulWidget { class _BeeDatePicker extends StatefulWidget {
final DateTime date; final DateTime date;
_BeeDatePicker({Key key, @required this.date}) : super(key: key); final bool use24H;
final DateTime max;
final DateTime min;
final CupertinoDatePickerMode mode;
_BeeDatePicker(
{Key key,
@required this.date,
this.use24H = false,
this.max,
this.min,
this.mode})
: super(key: key);
@override @override
__BeeDatePickerState createState() => __BeeDatePickerState(); __BeeDatePickerState createState() => __BeeDatePickerState();
@ -49,9 +69,12 @@ class __BeeDatePickerState extends State<_BeeDatePicker> {
), ),
), ),
CupertinoDatePicker( CupertinoDatePicker(
use24hFormat: widget.use24H,
maximumDate: widget.max,
minimumDate: widget.min,
initialDateTime: _date, initialDateTime: _date,
onDateTimeChanged: (date) => _date = date, onDateTimeChanged: (date) => _date = date,
mode: CupertinoDatePickerMode.date, mode:widget.mode?? CupertinoDatePickerMode.date,
).expand(), ).expand(),
], ],
), ),

Loading…
Cancel
Save