update button

update check tag
master
张萌 4 years ago
parent e9314cf399
commit f2aceb5c55

@ -64,7 +64,7 @@ class _ExampaleTagState extends State<ExampleTag> {
), ),
ListTile( ListTile(
onTap: () => setState(() => _checked = !_checked), onTap: () => setState(() => _checked = !_checked),
title: Text('ASCheckedTag'), title: Text('ASCheckTag'),
trailing: ASCheckTag( trailing: ASCheckTag(
checked: _checked, checked: _checked,
text: 'TAG'.text.make(), text: 'TAG'.text.make(),

@ -21,7 +21,7 @@ class ASLongButton extends StatelessWidget {
final TextStyle? textStyle; final TextStyle? textStyle;
/// ///
final Padding? padding; final EdgeInsetsGeometry? padding;
/// ///
final bool outline; final bool outline;
@ -98,10 +98,10 @@ class ASLongButton extends StatelessWidget {
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: onPressed, onPressed: onPressed,
child: title is String child: title is String
? Text(title, ? Text(title, style: textStyle ?? TextStyle(fontSize: 20.sp))
style: textStyle ?? TextStyle(fontSize: 20.sp))
: title, : title,
padding: padding as EdgeInsetsGeometry? ?? EdgeInsets.symmetric(vertical: 8.w), padding:
padding as EdgeInsetsGeometry? ?? EdgeInsets.symmetric(vertical: 8.w),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
side: outline side: outline
? BorderSide(color: outlineColor!, width: 1.w) ? BorderSide(color: outlineColor!, width: 1.w)

@ -5,11 +5,11 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
class ASCheckTag extends StatelessWidget { class ASCheckTag extends StatelessWidget {
final bool checked; final bool checked;
final Widget text; final Widget? text;
const ASCheckTag({ const ASCheckTag({
Key? key, Key? key,
this.checked = false, this.checked = false,
required this.text, this.text,
}) : super(key: key); }) : super(key: key);
@override @override
@ -39,14 +39,15 @@ class ASCheckTag extends StatelessWidget {
), ),
), ),
), ),
6.wb, if (text != null) 6.wb,
if (text != null)
AnimatedDefaultTextStyle( AnimatedDefaultTextStyle(
duration: Duration(milliseconds: 300), duration: Duration(milliseconds: 300),
curve: Curves.easeInOutCubic, curve: Curves.easeInOutCubic,
style: TextStyle( style: TextStyle(
color: checked ? Color(0xFF00BF44) : Color(0xFFFF0000), color: checked ? Color(0xFF00BF44) : Color(0xFFFF0000),
), ),
child: text, child: text!,
), ),
], ],
); );

Loading…
Cancel
Save