radio_form_field 0.0.1
radio_form_field: ^0.0.1 copied to clipboard
Radio 的 FormField 组件实现.
radio 组件的 form_field 实现,提供行内Radio选择,支持嵌入Form组件中实现表单验证。
Features #
支持表单验证的radio组件
Getting started #
Usage #
示例文件位于在 /example/radio_form_field_example.dart.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
var data = RadioFormFieldOptions.fromJson({
"data": [
{
"label": "测试选择1",
"value": "1"
},{
"label": "测试选择2",
"value": "2"
},
]
});
return MaterialApp(
home: Scaffold(
body: Center(
child: RadioFormField(
values: data.options ?? [],
),
)
)
);
}
}
Additional information #
组件支持 void Function<String> onChanged 方法 以及 void Function(dynamic?)? onSaved 方法。
测试命令 #
fvm dart test