forked from lxm_flutter/FlutterUnit
清除所有历史版本以减少仓库大小
This commit is contained in:
@@ -0,0 +1,71 @@
|
||||
import 'package:flutter/material.dart';
|
||||
// {
|
||||
// "widgetId": 80,
|
||||
// "name": 'BoxConstraints基本使用',
|
||||
// "priority": 1,
|
||||
// "subtitle":
|
||||
// "【child】 : 孩子组件 【Widget】\n"
|
||||
// "【minWidth】 : 最小宽 【double】\n"
|
||||
// "【minHeight】 : 最小高 【double】\n"
|
||||
// "【maxHeight】 : 最大高 【double】\n"
|
||||
// "【maxWidth】 : 最大宽 【double】",
|
||||
// }
|
||||
class CustomConstrainedBox extends StatefulWidget {
|
||||
@override
|
||||
_CustomConstrainedBoxState createState() => _CustomConstrainedBoxState();
|
||||
}
|
||||
|
||||
class _CustomConstrainedBoxState extends State<CustomConstrainedBox> {
|
||||
var _text = '';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
var child = Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.cyanAccent,
|
||||
width: 40,
|
||||
height: 40,
|
||||
child: Text("Static"),
|
||||
);
|
||||
|
||||
var box = ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: 50,
|
||||
minWidth: 20,
|
||||
maxHeight: 80,
|
||||
maxWidth: 150,
|
||||
),
|
||||
child: Container(color: Colors.orange, child: Text(_text)),
|
||||
);
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
color: Colors.grey.withAlpha(22),
|
||||
width: 300,
|
||||
height: 100,
|
||||
child: Row(
|
||||
children: <Widget>[child, UnconstrainedBox(child: box), child],
|
||||
),
|
||||
),
|
||||
_buildInput(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildInput() {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(18.0),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
hintText: '请输入',
|
||||
),
|
||||
onChanged: (v) {
|
||||
setState(() {
|
||||
_text = v;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user