diff --git a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart index 497056b9..da500cde 100644 --- a/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart +++ b/lib/pages/goods_deto_page/deto_create_page/deto_create_page.dart @@ -4,9 +4,13 @@ import 'dart:io'; import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/provider/user_provider.dart'; +import 'package:akuCommunity/widget/bee_divider.dart'; import 'package:akuCommunity/widget/buttons/bee_check_box.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:flustars/flustars.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -14,6 +18,7 @@ import 'package:flutter/material.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; import 'package:akuCommunity/widget/picker/grid_image_picker.dart'; +import 'package:get/get.dart'; import 'package:provider/provider.dart'; import 'widget/common_picker.dart'; import 'widget/common_radio.dart'; @@ -35,6 +40,8 @@ class _DetoCreatePageState extends State { : userProvider.userDetailModel.estateNames[0]; } + String _itemName; + DateTime _date; int _selectWeight; List _listWeight = [ '< 50kg', @@ -47,6 +54,13 @@ class _DetoCreatePageState extends State { '搬家公司', ]; + List _itemClass = [ + '全部', + '家纺', + '家具', + '电器', + ]; + bool needMoveCompany = false; Widget _houseAddress(String title, subtitle) { @@ -119,12 +133,12 @@ class _DetoCreatePageState extends State { mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ - BeeCheckBox( - onChange: (value) { - needMoveCompany=value; - }, - ), - 10.w.widthBox, + BeeCheckBox( + onChange: (value) { + needMoveCompany = value; + }, + ), + 10.w.widthBox, Container( child: Text( '是否需要物业提供搬家公司联系方式', @@ -222,10 +236,94 @@ class _DetoCreatePageState extends State { ); } - Widget _itemPicker(){ - return Container( + Widget _itemPicker(String title, String select, VoidCallback onTap) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 28.w), + child: InkWell( + onTap: onTap, + child: Row( + children: [ + title.text.color(ktextPrimary).size(28.sp).make(), + 36.w.widthBox, + (select.isEmptyOrNull ? '请选择' : select) + .text + .color(select.isEmptyOrNull ? ktextSubColor : ktextPrimary) + .size(28.sp) + .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( + height: 16.w, + color: Color(0xFFF7F7F7), + ), + Material( + child: InkWell( + onTap: () { + Get.back(); + }, + child: Container( + alignment: Alignment.center, + height: 112.w, + width: double.infinity, + child: '取消' + .text + .color(ktextPrimary) + .isIntrinsic + .size(28.sp) + .make()), + ), + ), + ], + ), + ), + ), ); + setState(() {}); } @override @@ -237,10 +335,17 @@ class _DetoCreatePageState extends State { children: [ _houseAddress(kEstateName, firstEstateName), _getWeight(), - CommonPicker(title: '出户时间'), - CommonPicker(title: '物品名称'), + _itemPicker( + '出户时间', DateUtil.formatDate(_date, format: "yyyy-MM-dd HH:mm:ss"), + () async { + _date = await BeeDatePicker.timePicker(DateTime.now()); + setState(() {}); + }), + _itemPicker('物品名称', _itemName, () { + _showItmePicker(); + }), _getApproach(), - _selectApproach==0?SizedBox(): _inkWellCheckbox(), + _selectApproach == 0 ? SizedBox() : _inkWellCheckbox(), Container( margin: EdgeInsets.only(top: 54.w, bottom: 24.w), child: Text( diff --git a/lib/pages/things_page/widget/add_fixed_submit_page.dart b/lib/pages/things_page/widget/add_fixed_submit_page.dart index aeb44e0b..8195fe3b 100644 --- a/lib/pages/things_page/widget/add_fixed_submit_page.dart +++ b/lib/pages/things_page/widget/add_fixed_submit_page.dart @@ -101,8 +101,8 @@ class _AddFixedSubmitPageState extends State { int value, ) { return FlatButton( - minWidth: 200.w, - height: 72.w, + // minWidth: 200.w, + // height: 72.w, onPressed: () { setState(() { _selectType = value; diff --git a/lib/widget/picker/bee_date_picker.dart b/lib/widget/picker/bee_date_picker.dart index 0f45facc..3f28f62d 100644 --- a/lib/widget/picker/bee_date_picker.dart +++ b/lib/widget/picker/bee_date_picker.dart @@ -10,11 +10,31 @@ class BeeDatePicker { static Future pick(DateTime initDate) async { return await Get.bottomSheet(_BeeDatePicker(date: initDate)); } + + static Future 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 { 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 __BeeDatePickerState createState() => __BeeDatePickerState(); @@ -49,9 +69,12 @@ class __BeeDatePickerState extends State<_BeeDatePicker> { ), ), CupertinoDatePicker( + use24hFormat: widget.use24H, + maximumDate: widget.max, + minimumDate: widget.min, initialDateTime: _date, onDateTimeChanged: (date) => _date = date, - mode: CupertinoDatePickerMode.date, + mode:widget.mode?? CupertinoDatePickerMode.date, ).expand(), ], ),