forked from lxm_flutter/FlutterUnit
⚡ 优化详情
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020/5/3
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明:
|
||||
|
||||
// {
|
||||
// "widgetId": 74,
|
||||
// "name": 'Padding四面等边距',
|
||||
// "priority": 1,
|
||||
// "subtitle":
|
||||
// "【child】 : 孩子组件 【Widget】\n"
|
||||
// "【padding】 : 内四边距 【EdgeInsetsGeometry】"
|
||||
// "EdgeInsets.all用来限定相同的四边边距",
|
||||
// }
|
||||
class PaddingAll extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.grey.withAlpha(22),
|
||||
width: 200,
|
||||
height: 150,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(20),
|
||||
child: _buildChild(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildChild() {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.cyanAccent,
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: Text("孩子"),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020/5/3
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明:
|
||||
|
||||
// {
|
||||
// "widgetId": 74,
|
||||
// "name": 'Padding单独边距边距',
|
||||
// "priority": 2,
|
||||
// "subtitle":
|
||||
// "EdgeInsets.only用来限定相同的四边边距",
|
||||
// }
|
||||
class PaddingOnly extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.grey.withAlpha(22),
|
||||
width: 200,
|
||||
height: 150,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(top:10,left: 10),
|
||||
child: _buildChild(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildChild() {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.cyanAccent,
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: Text("孩子"),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
/// create by 张风捷特烈 on 2020/5/3
|
||||
/// contact me by email 1981462002@qq.com
|
||||
/// 说明:
|
||||
|
||||
// {
|
||||
// "widgetId": 74,
|
||||
// "name": 'Padding方向边距',
|
||||
// "priority": 3,
|
||||
// "subtitle":
|
||||
// "EdgeInsets.symmetric用来限定水平和竖直方向的边距",
|
||||
// }
|
||||
class PaddingSymmetric extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
color: Colors.grey.withAlpha(22),
|
||||
width: 200,
|
||||
height: 150,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 30,horizontal: 10),
|
||||
child: _buildChild(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildChild() {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
color: Colors.cyanAccent,
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: Text("孩子"),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user