From fd1079b8bb8f948938b4ab773d8ebc06ea6ddf65 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Wed, 27 Jan 2021 15:49:26 +0800 Subject: [PATCH] update deto create page add check box widget --- .../deto_create_page/deto_create_page.dart | 23 ++++++---- lib/widget/buttons/bee_check_box.dart | 44 +++++++++++++++++++ 2 files changed, 58 insertions(+), 9 deletions(-) create mode 100644 lib/widget/buttons/bee_check_box.dart 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 df0ffeb9..497056b9 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,6 +4,7 @@ import 'dart:io'; import 'package:akuCommunity/base/base_style.dart'; import 'package:akuCommunity/provider/user_provider.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:flutter/cupertino.dart'; @@ -115,17 +116,15 @@ class _DetoCreatePageState extends State { child: Container( padding: EdgeInsets.only(bottom: 24.w), child: Row( + mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.start, children: [ - Checkbox( - value: needMoveCompany, - activeColor: Color(0xffffc40c), - onChanged: (bool val) { - this.setState(() { - needMoveCompany=!needMoveCompany; - }); - }, - ), + BeeCheckBox( + onChange: (value) { + needMoveCompany=value; + }, + ), + 10.w.widthBox, Container( child: Text( '是否需要物业提供搬家公司联系方式', @@ -223,6 +222,12 @@ class _DetoCreatePageState extends State { ); } + Widget _itemPicker(){ + return Container( + + ); + } + @override Widget build(BuildContext context) { return BeeScaffold( diff --git a/lib/widget/buttons/bee_check_box.dart b/lib/widget/buttons/bee_check_box.dart new file mode 100644 index 00000000..669dc31d --- /dev/null +++ b/lib/widget/buttons/bee_check_box.dart @@ -0,0 +1,44 @@ +import 'package:akuCommunity/base/base_style.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.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 { + 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(), + ), + ); + } +}