|
|
|
@ -3,8 +3,10 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
|
|
|
|
|
|
|
class ASCheckBox extends StatefulWidget {
|
|
|
|
|
final bool value;
|
|
|
|
|
|
|
|
|
|
///控制选中时的样式
|
|
|
|
|
final bool checkStyle;
|
|
|
|
|
|
|
|
|
|
///选中时颜色
|
|
|
|
|
final Color color;
|
|
|
|
|
ASCheckBox({Key key, this.value = false, this.color})
|
|
|
|
@ -38,7 +40,8 @@ class _ASCheckBoxState extends State<ASCheckBox> {
|
|
|
|
|
height: widget.value ? 13.w : 5.w,
|
|
|
|
|
width: widget.value ? 13.w : 5.w,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color:widget.color?? Color(0xFFF69A2D).withOpacity(widget.value ? 1 : 0),
|
|
|
|
|
color: (widget.color ?? Color(0xFFF69A2D))
|
|
|
|
|
.withOpacity(widget.value ? 1 : 0),
|
|
|
|
|
borderRadius: BorderRadius.circular(13.w),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
@ -58,16 +61,20 @@ class _ASCheckBoxState extends State<ASCheckBox> {
|
|
|
|
|
width: widget.value ? 0 : 1.w,
|
|
|
|
|
),
|
|
|
|
|
borderRadius: BorderRadius.circular(27.w),
|
|
|
|
|
color:widget.color?? Color(0xFFFFBD32).withOpacity(widget.value ? 1 : 0),
|
|
|
|
|
color: (widget.color ?? Color(0xFFFFBD32))
|
|
|
|
|
.withOpacity(widget.value ? 1 : 0),
|
|
|
|
|
),
|
|
|
|
|
child: AnimatedOpacity(
|
|
|
|
|
duration: Duration(milliseconds: 300),
|
|
|
|
|
curve: Curves.fastOutSlowIn,
|
|
|
|
|
opacity: widget.value ? 1 : 0,
|
|
|
|
|
child: FittedBox(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: EdgeInsets.all(5.w),
|
|
|
|
|
child: Icon(
|
|
|
|
|
Icons.check,
|
|
|
|
|
size: 18.w,
|
|
|
|
|
color: widget.color != null ? Colors.white : Colors.black,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|