Files
FlutterUnit/lib/views/widgets/StatelessWidget/ChoiceChip/node1_base.dart
2021-04-03 19:41:09 +08:00

46 lines
1.4 KiB
Dart
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/// create by 张风捷特烈 on 2020/4/25
/// contact me by email 1981462002@qq.com
/// 说明:
// {
// "widgetId": 12,
// "priority": 1,
// "name": "ChoiceChip的普通表现如下",
// "subtitle": "【selectedColor】: 选中时颜色 【Color】\n"
// "【selectedShadowColor】: 选中时阴影颜色 【Color】\n"
// "【onSelected】: 选中事件 【Fuction(bool)】\n"
// " 其他属性同Chip组件无右侧组件。",
// }
import 'package:flutter/material.dart';
class CustomChoiceChip extends StatefulWidget {
@override
_CustomChoiceChipState createState() => _CustomChoiceChipState();
}
class _CustomChoiceChipState extends State<CustomChoiceChip> {
bool _select = false;
@override
Widget build(BuildContext context) {
return ChoiceChip(
selected: _select,
padding: EdgeInsets.all(5),
labelPadding: EdgeInsets.all(5),
label: Text(
_select ?
"You are selected it." :
"This is a ChoiceChip.",
style: TextStyle(fontSize: 16),
),
backgroundColor: Colors.grey.withAlpha(66),
avatar: Image.asset("assets/images/icon_head.webp"),
selectedColor: Colors.orangeAccent.withAlpha(44),
selectedShadowColor: Colors.blue,
shadowColor: Colors.orangeAccent,
elevation: 3,
onSelected: (value) => setState(() => _select = value),
);
}
}