as radio butoon 支持多选

as edit tile 支持隐藏输入内容
master
张萌 3 years ago
parent f2aceb5c55
commit aec558f54c

@ -5,7 +5,7 @@ import 'package:ansu_ui/extension/num_extension.dart';
class ASRadioButton<T> extends StatefulWidget {
///
final T? groupValue;
final dynamic groupValue;
///
final String? title;
@ -15,20 +15,37 @@ class ASRadioButton<T> extends StatefulWidget {
///
final Function(T value)? onTap;
///
final bool mulitpleChoice;
ASRadioButton({
Key? key,
this.groupValue,
this.title,
this.value,
this.onTap,
}) : super(key: key);
}) : this.mulitpleChoice = false,
super(key: key);
ASRadioButton.mult({
Key? key,
this.groupValue,
this.title,
this.value,
this.onTap,
}) : this.mulitpleChoice = true,
super(key: key);
@override
_ASRadioButtonState createState() => _ASRadioButtonState();
}
class _ASRadioButtonState extends State<ASRadioButton> {
bool get _selected => widget.value == widget.groupValue;
bool get _selected {
if (widget.mulitpleChoice) {
return (widget.groupValue as List).contains(widget.value);
} else {
return widget.value == widget.groupValue;
}
}
@override
Widget build(BuildContext context) {
return InkWell(

@ -15,6 +15,8 @@ class ASEditTile extends StatelessWidget {
final TextInputType? keyBoardType;
final TextStyle? hintTextStyle;
final Widget? suffix;
final bool? obscureText;
final String? obscuringCharacter;
ASEditTile({
Key? key,
this.title,
@ -27,6 +29,8 @@ class ASEditTile extends StatelessWidget {
this.keyBoardType,
this.hintTextStyle,
this.suffix,
this.obscureText,
this.obscuringCharacter,
}) : super(key: key);
@override
Widget build(BuildContext context) {
@ -55,6 +59,8 @@ class ASEditTile extends StatelessWidget {
onChanged: onChange,
inputFormatters: inputFormatters,
keyboardType: keyBoardType,
obscureText: obscureText ?? false,
obscuringCharacter: obscuringCharacter ?? '*',
onSubmitted: onSubmitted,
textAlign: TextAlign.end,
style: TextStyle(

Loading…
Cancel
Save