forked from lxm_flutter/FlutterUnit
🎨 优化展示组件代码的存在形式,stateless重构完毕
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020-03-25
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明:
|
||||
// {
|
||||
// "widgetId": 18,
|
||||
// "priority": 3,
|
||||
// "name": "SwitchListTile的密排属性",
|
||||
// "subtitle": "【dense】: 是否密排 【bool】",
|
||||
// }
|
||||
class DenseSwitchListTile extends StatefulWidget {
|
||||
@override
|
||||
_DenseSwitchListTileState createState() => _DenseSwitchListTileState();
|
||||
}
|
||||
|
||||
class _DenseSwitchListTileState extends State<DenseSwitchListTile> {
|
||||
var _value=false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.all(10),
|
||||
color: Colors.grey.withAlpha(22),
|
||||
child: SwitchListTile(
|
||||
value: _value,
|
||||
dense: true,
|
||||
selected: _value,
|
||||
activeColor: Colors.orangeAccent,
|
||||
secondary: Image.asset("assets/images/icon_head.png"),
|
||||
title: Text("张风捷特烈"),
|
||||
subtitle: Text("@万花过尽知无物"),
|
||||
onChanged: (v) => setState(() => _value = !_value),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user