mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-06-01 23:43:54 +08:00
Merge branch 'develop' into dev/yisheng
# Conflicts: # lib/common/widget_demo.dart # lib/widgets/components/Bar/SnackBar/demo.dart # lib/widgets/components/Navigation/BottomNavigationBarItem/demo.dart
This commit is contained in:
@ -1,8 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import '../../../../../common/widget_demo.dart';
|
||||
import './demo.dart' ;
|
||||
|
||||
import './demo.dart';
|
||||
|
||||
const String _flatText0 = """
|
||||
### **简介**
|
||||
@ -10,18 +9,16 @@ const String _flatText0 = """
|
||||
- 根据自己需求,进行控件对齐
|
||||
### **基本用法**
|
||||
> alignment → AlignmentGeometry
|
||||
- 要对齐右下方的框,您将通过此框一个比子的自然大小更大的严格约束,并且对齐Alignment.bottomRight
|
||||
- 要对齐右下方的框,那么对这个框对要求会比对子控件更加严肃的约束,使用:Alignment.bottomRight
|
||||
- 同理:Alignment.center,Alignment.bottomLeft,Alignment.topLeft等
|
||||
""";
|
||||
|
||||
const String _flatText1 = """
|
||||
> widthFactor / heightFactor → double
|
||||
- 如果widthFactor / heightFactor 为空,并且外部无任何约束,child控件大小默认,那么这个控件将根据自身尺寸最大化
|
||||
|
||||
- 如果widthFactor / heightFactor 不为空,并且外部无约束,align将匹配对应的child尺寸
|
||||
- ex:widthFactor/ heightFactor 为2.0;那么widget的宽高为child宽高的两倍
|
||||
- 如果widthFactor / heightFactor 为空,并且外部无约束,child控件设置自身大小
|
||||
- Alignment部分标签失效
|
||||
- 如果widthFactor / heightFactor 为空,并且外部无约束,child控件将会设置自身大小
|
||||
""";
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
@ -36,13 +33,9 @@ class _DemoState extends State<Demo> {
|
||||
Widget build(BuildContext context) {
|
||||
return WidgetDemo(
|
||||
title: 'Align',
|
||||
codeUrl:"elements/Frame/Align/Align/demo.dart",
|
||||
codeUrl: "elements/Frame/Align/Align/demo.dart",
|
||||
docUrl: 'https://docs.flutter.io/flutter/widgets/Align-class.html',
|
||||
contentList: [
|
||||
_flatText0,
|
||||
_flatText1,
|
||||
_alignCreate()
|
||||
],
|
||||
contentList: [_flatText0, _alignCreate()],
|
||||
);
|
||||
}
|
||||
|
||||
@ -55,7 +48,6 @@ class _DemoState extends State<Demo> {
|
||||
children: <Widget>[
|
||||
AlignAlignment(Alignment.center, 'center'),
|
||||
AlignAlignment(Alignment.centerLeft, 'centerLeft'),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.0),
|
||||
@ -65,7 +57,6 @@ class _DemoState extends State<Demo> {
|
||||
AlignAlignment(Alignment.centerRight, 'centerRight'),
|
||||
AlignAlignment(Alignment.bottomCenter, 'btCenter'),
|
||||
AlignAlignment(Alignment.topCenter, 'topCenter'),
|
||||
|
||||
],
|
||||
),
|
||||
SizedBox(height: 10.0),
|
||||
@ -84,13 +75,13 @@ class _DemoState extends State<Demo> {
|
||||
color: Color(0xffe91e63),
|
||||
child: new Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: new Text("Align",style:
|
||||
TextStyle(color: Color(0xffffffff)),),
|
||||
child: new Text(
|
||||
"Align",
|
||||
style: TextStyle(color: Color(0xffffffff)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
AlignFactor(Alignment.topLeft, 2.0, 2.0, 'topleft'),
|
||||
|
||||
AlignFactor(Alignment.topRight, null, null, 'topleft'),
|
||||
AlignFactor(Alignment.center, null, null, 'center'),
|
||||
AlignFactor(Alignment.bottomLeft, null, null, 'bottomLeft'),
|
||||
|
@ -8,12 +8,17 @@ import 'package:flutter/widgets.dart';
|
||||
* LastUpdateTime: 2018/11/22
|
||||
* LastUpdateBy: xj.deng
|
||||
*
|
||||
* Describle:Align描述
|
||||
* Describle:ConstrainedBox描述
|
||||
*/
|
||||
class ConstracubedBox extends StatelessWidget {
|
||||
class ConstrainedBoxCreate extends StatelessWidget {
|
||||
final double currWidth;
|
||||
final String describe;
|
||||
|
||||
const ConstrainedBoxCreate({Key key,this.currWidth,this.describe}):
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Column(
|
||||
children: <Widget>[
|
||||
ConstrainedBox(
|
||||
@ -21,20 +26,22 @@ class ConstracubedBox extends StatelessWidget {
|
||||
constraints: const BoxConstraints(
|
||||
minWidth: 100.0,
|
||||
minHeight: 20.0,
|
||||
maxWidth: 500.0,
|
||||
maxWidth: 300.0,
|
||||
maxHeight: 50.0,
|
||||
),
|
||||
child: new Container(
|
||||
margin: const EdgeInsets.only(left: 20.0, right: 20.0),
|
||||
//child 宽高超过制定限制范围失效,效果宽/高=100/20区域
|
||||
width: 600.0,
|
||||
width: currWidth,
|
||||
height: 250.0,
|
||||
child: new Text('ConstrainedBox',style: TextStyle(color: Colors.white),),
|
||||
color: Colors.red,
|
||||
child: new Text(
|
||||
describe,
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
color: Color(0xfff8bbd0),
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,11 @@ const String _Text = '''
|
||||
const String _Text1 = '''
|
||||
### **基本用法**
|
||||
> 添加额外的限制条件到child上
|
||||
- 比如说,你限制child最小高度为50.0像素,就可以用constraints: const BoxConstraints(minHeight:50)
|
||||
- ex:添加ConstrainedBox约束如下,传入不同Width约束的Container效果
|
||||
minWidth: 100.0,
|
||||
minHeight: 20.0,
|
||||
maxWidth: 300.0,
|
||||
maxHeight: 50.0
|
||||
|
||||
''';
|
||||
|
||||
@ -36,7 +40,27 @@ class _DemoState extends State<Demo> {
|
||||
contentList: [
|
||||
_Text,
|
||||
_Text1,
|
||||
ConstracubedBox(),
|
||||
// maxWidth: 300.0,
|
||||
ConstrainedBoxCreate(currWidth: 500, describe: "currWidth>maxWidth"),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ConstrainedBoxCreate(currWidth: 300, describe: "currWidth=maxWidth"),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ConstrainedBoxCreate(currWidth: 200, describe: "currWidth<maxWidth"),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
|
||||
// minWidth: 100.0,
|
||||
ConstrainedBoxCreate(currWidth: 150, describe: "currWidth>minWidth"),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
ConstrainedBoxCreate(currWidth: 100, describe: "currWidth=minWidth"),
|
||||
|
||||
],
|
||||
docUrl:
|
||||
'https://docs.flutter.io/flutter/widgets/ConstrainedBox-class.html',
|
||||
|
@ -17,15 +17,65 @@ class DecoratedBoxCreate extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DecoratedBox(
|
||||
position: DecorationPosition.foreground,
|
||||
position: DecorationPosition.background,
|
||||
decoration: BoxDecoration(
|
||||
gradient: RadialGradient(
|
||||
center: const Alignment(-0.5, -0.6),
|
||||
radius: 0.15,
|
||||
colors: <Color>[const Color(0xFFEEEEEE), Colors.pink.shade600],
|
||||
stops: <double>[0.9, 1.0],
|
||||
color: const Color(0xff7c94b6),
|
||||
//设置图片内容
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: ExactAssetImage('assets/images/food01.jpeg')),
|
||||
//外宽边框,可以不设置
|
||||
border: Border.all(
|
||||
color: Colors.blue.shade50,
|
||||
width: 10.0,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DecoratedBoxCreateTwo extends StatelessWidget {
|
||||
DecoratedBoxCreateTwo({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DecoratedBox(
|
||||
position: DecorationPosition.background,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xff7c94b6),
|
||||
//设置图片内容
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: ExactAssetImage('assets/images/food01.jpeg')),
|
||||
//根据传入的不同大小,呈现图片效弧度不同,
|
||||
borderRadius: BorderRadius.circular(90.0),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class DecoratedBoxCreateShape extends StatelessWidget {
|
||||
DecoratedBoxCreateShape({
|
||||
Key key,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return DecoratedBox(
|
||||
position: DecorationPosition.background,
|
||||
decoration: BoxDecoration(
|
||||
color: const Color(0xff7c94b6),
|
||||
image: new DecorationImage(
|
||||
fit: BoxFit.cover,
|
||||
image: ExactAssetImage('assets/images/food01.jpeg')),
|
||||
border: Border.all(
|
||||
color: Colors.blue.shade50,
|
||||
width: 5.0,
|
||||
),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -6,15 +6,21 @@
|
||||
*/
|
||||
import 'package:flutter/material.dart';
|
||||
import '../../../../../common/widget_demo.dart';
|
||||
import './demo.dart' as decoratedBox;
|
||||
import './demo.dart';
|
||||
|
||||
const String _Text = """### **简介**
|
||||
> 在绘制前或绘制后,添加额外的限制条件到child上的widget
|
||||
> 在child绘制前或绘制后,添加额外的限制条件到child上的widget
|
||||
- 根据边界的宽高,对其child进行插入绘制
|
||||
""";
|
||||
|
||||
const String _Text1 = """### **基本用法**
|
||||
> 常用于BoxDecoration
|
||||
> decoration → Decoration
|
||||
- 常用于BoxDecoration
|
||||
- BoxDecoration提供多种方式来绘制以一个框
|
||||
- 盒子形状可以是圆形也可以是矩形,用borderRadius属性来绘制角度
|
||||
|
||||
> position → DecorationPosition
|
||||
- position: DecorationPosition.foreground,
|
||||
""";
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
@ -42,9 +48,25 @@ class _DemoState extends State<Demo> {
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: 200.0,
|
||||
width: 200.0,
|
||||
child: decoratedBox.DecoratedBoxCreate(),
|
||||
height: 100.0,
|
||||
width: 100.0,
|
||||
child: DecoratedBoxCreate(),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 100.0,
|
||||
child: DecoratedBoxCreateTwo(),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10.0,
|
||||
),
|
||||
Container(
|
||||
height: 100.0,
|
||||
width: 100.0,
|
||||
child: DecoratedBoxCreateShape(),
|
||||
)
|
||||
],
|
||||
);
|
||||
|
@ -25,16 +25,14 @@ class FittedBoxDefault extends StatelessWidget {
|
||||
//外部有位置约束,内部大小设定失效,保持和外部约束一致
|
||||
height: 100.0,
|
||||
width: 100.0,
|
||||
color: Colors.yellow,
|
||||
color: Color(0xfff8bbd0),
|
||||
child: FittedBox(
|
||||
fit: curfit,
|
||||
// 修改child写入布局时期分配的空间
|
||||
alignment: Alignment.center,
|
||||
//alignment修改child于父空间对齐方式,默认:Alignment.center,
|
||||
child: Container(
|
||||
// height: 50.0,
|
||||
// width: 50.0,
|
||||
color: Colors.red,
|
||||
color: Color(0xfff48fb1),
|
||||
child: Text(
|
||||
'fittedBox',
|
||||
style: TextStyle(color: Colors.white),
|
||||
|
@ -22,7 +22,7 @@ const String Text1 = """
|
||||
> 根据外部约束,调整child
|
||||
- 如果外部没有约束,按照child的大小。
|
||||
- 如果外部有约束,按照外部约束调整自身大小,然后缩放调整child,根据条件进行放置
|
||||
- BoxFix 属性,修改child写入布局时期分配的空间
|
||||
- BoxFix 属性,可修改child写入布局时期分配的空间
|
||||
- alignment修改child于父空间对齐方式,默认:Alignment.center,
|
||||
""";
|
||||
|
||||
|
@ -4,14 +4,69 @@ import 'package:flutter/material.dart';
|
||||
class LimitedBoxDemo extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return LimitedBox(
|
||||
maxWidth: 50.0,
|
||||
maxHeight: 150.0,
|
||||
child: Container(
|
||||
width: 250.0,
|
||||
height: 150.0,
|
||||
color: Colors.red,
|
||||
),
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
color: Color(0xfff8bbd0),
|
||||
child: Text(
|
||||
"100 * 100",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
LimitedBox(
|
||||
maxWidth: 100,
|
||||
maxHeight: 100,
|
||||
child: Container(
|
||||
width: 250,
|
||||
height: 300,
|
||||
child: Text(
|
||||
"250 * 300",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
color: Color(0xfff48fb1),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class LimitedBoxColumnDemo extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
SizedBox(
|
||||
child: Text("Column 列表下效果"),
|
||||
),
|
||||
Container(
|
||||
width: 100,
|
||||
height: 100,
|
||||
color: Color(0xfff8bbd0),
|
||||
child: Text(
|
||||
"100 * 100",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.0),
|
||||
LimitedBox(
|
||||
maxWidth: 100,
|
||||
maxHeight: 100,
|
||||
child: Container(
|
||||
width: 250,
|
||||
height: 300,
|
||||
child: Text(
|
||||
"250 * 300",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
color: Color(0xfff48fb1),
|
||||
),
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -10,15 +10,17 @@ import './demo.dart';
|
||||
|
||||
const String Text0 = """
|
||||
### **LimitedBox**
|
||||
> 对最大宽高进行限制的控件
|
||||
- 即:将child限制在指定的最大宽高中,如果LimitedBox外部没有约束,那么最大宽高不受限制,child的宽高受到LimitedBox最大宽高限制
|
||||
> 对最大宽高进行限制的控件(前提是LimitedBox不受约束)
|
||||
- 即:将child限制在指定的最大宽高中
|
||||
- 这就使得child自身没有约束大小的时候具有了外部约束,依然控制了其大小
|
||||
- 例如:通过给LimitedBox最大高度(maxHeight),widget通常会调整其自身的大小去适应父窗体,但是,当放置在竖直(cloumn)列表中时,它将采用给定的高度
|
||||
""";
|
||||
|
||||
const String Text1 = """
|
||||
### **基本用法**
|
||||
> widget 限制child最大宽高,如下:
|
||||
- maxHeight限制最大高度
|
||||
- maxWidth限制最大宽
|
||||
- 如果LimitedBox外部宽度没有被约束,child的宽受到LimitedBox最大宽度(maxWidth)属性限制
|
||||
- 同理,LimitedBox外部高度没有约束,child的高受到LimitedBox最大高度(maxHeight)属性限制
|
||||
|
||||
|
||||
""";
|
||||
@ -40,6 +42,8 @@ class _DemoState extends State<Demo> {
|
||||
Text0,
|
||||
Text1,
|
||||
LimitedBoxDemo(),
|
||||
SizedBox(height: 30),
|
||||
LimitedBoxColumnDemo(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ class OverflowBoxDefault extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return OverflowBox(
|
||||
minHeight: 50.0,
|
||||
minWidth: 50.0,
|
||||
minHeight: 80.0,
|
||||
minWidth: 80.0,
|
||||
//设置最大宽,高
|
||||
maxWidth: curmaxWidth,
|
||||
maxHeight: curmaxHeight,
|
||||
@ -36,7 +36,8 @@ class OverflowBoxDefault extends StatelessWidget {
|
||||
* * */
|
||||
height: curHeight,
|
||||
width: curWidth,
|
||||
color: Colors.red,
|
||||
child: Text("$curmaxWidth * $curmaxHeight",style: TextStyle(color: Colors.white),),
|
||||
color: Color(0xfff48fb1),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import '../../../../../common/widget_demo.dart';
|
||||
import './demo.dart' as overflowBox;
|
||||
|
||||
const String Text0 = """### **OverflowBox简介**
|
||||
> 它对子进程施加的约束不同于从其父进程获得的约束,可能允许子进程溢出父进程.
|
||||
> 它对child施加的约束不同于从其父控件获得的约束,可能允许child溢出父控件的空间.
|
||||
- 当OverflowBox的最大尺寸大于child的时候,child可以完整显示,当其小于child的时候,则以最大尺寸为基准,当然,这个尺寸都是可以突破父节点的
|
||||
""";
|
||||
|
||||
@ -43,46 +43,54 @@ class _DemoState extends State<Demo> {
|
||||
);
|
||||
}
|
||||
|
||||
Row _overflowBoxCreate() {
|
||||
return Row(
|
||||
Column _overflowBoxCreate() {
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: <Widget>[
|
||||
Text("宽高都小于最小限制"),
|
||||
Container(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
color: Colors.yellow,
|
||||
child: overflowBox.OverflowBoxDefault(
|
||||
curmaxHeight: 50.0,
|
||||
curmaxWidth: 50.0,
|
||||
curHeight: 100.0,
|
||||
curWidth: 100.0,
|
||||
curalignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
color: Colors.yellow,
|
||||
color: Color(0xfff8bbd0),
|
||||
child: overflowBox.OverflowBoxDefault(
|
||||
curmaxHeight: 150.0,
|
||||
curmaxWidth: 150.0,
|
||||
//宽高都小于最小限制
|
||||
curHeight: 50.0,
|
||||
curWidth: 50.0,
|
||||
curalignment: Alignment.bottomLeft,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
Text("在限制之内"),
|
||||
Container(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
color: Colors.yellow,
|
||||
color: Color(0xfff8bbd0),
|
||||
child: overflowBox.OverflowBoxDefault(
|
||||
curmaxHeight: 150.0,
|
||||
curmaxWidth: 150.0,
|
||||
curHeight: 40.0,
|
||||
curWidth: 40.0,
|
||||
curHeight: 80.0,
|
||||
curWidth: 80.0,
|
||||
curalignment: Alignment.topRight,
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
SizedBox(height: 50,child: Text("宽高都大于最大限制"),),
|
||||
Container(
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
color: Color(0xfff8bbd0),
|
||||
child: overflowBox.OverflowBoxDefault(
|
||||
curmaxHeight: 150.0,
|
||||
curmaxWidth: 150.0,
|
||||
//宽高大于最大限制
|
||||
curHeight: 200.0,
|
||||
curWidth: 200.0,
|
||||
curalignment: Alignment.center,
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
|
@ -9,19 +9,16 @@ class UnconstrainedBoxDemo extends StatelessWidget {
|
||||
child: new Row(
|
||||
children: <Widget>[
|
||||
Container(
|
||||
width: 200.0,
|
||||
height: 200.0,
|
||||
color: Colors.red,
|
||||
width: 100.0,
|
||||
height: 100.0,
|
||||
color: Color(0xfff48fb1),
|
||||
child: Text(
|
||||
"data",
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
// child: Text(
|
||||
// 'This allows a child to render at the size it would render '
|
||||
// 'if it were alone on an infinite canvas with no constraints. '
|
||||
// 'This container will then attempt to adopt the same size, within'
|
||||
// ' the limits of its own constraints. If it ends up with a different size, '
|
||||
// 'it will align the child based on alignment. If the box cannot expand enough '
|
||||
// 'to accommodate the entire child, the child will be clipped'),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -11,19 +11,15 @@ import './demo.dart';
|
||||
const String Text0 = """### **简介**
|
||||
> 跟ConstrainedBox相反,是不添加任何约束条件到child上,让child按照其原始的尺寸渲染
|
||||
- 它的作用就是给child一个尽可能大的空间,不加约束的让其显示。
|
||||
- 如果该widget不能扩展到到足够容纳整个child的空间,child将被裁剪
|
||||
""";
|
||||
|
||||
const String Text1 = """
|
||||
### **基本用法**
|
||||
mainAxisSize 属性
|
||||
- 一行的高度是有mainAxisSize属性控制,默认是max
|
||||
- alignment 属性:控制child对齐方式
|
||||
- textDirection 属性:控制文本对齐
|
||||
- constrainedAxis 属性:如果有,就使用
|
||||
|
||||
mainAxisAlignment属性
|
||||
- 将children放置在主轴某位置
|
||||
|
||||
CrossAxisAlignment 属性
|
||||
- crossAxisAlignment: crossAxisAlignment.center/end/start,
|
||||
- 即,根据设定的位置交叉对齐
|
||||
""";
|
||||
|
||||
class Demo extends StatefulWidget {
|
||||
@ -44,6 +40,7 @@ class _DemoState extends State<Demo> {
|
||||
'https://docs.flutter.io/flutter/widgets/UnconstrainedBox-class.html',
|
||||
contentList: [
|
||||
Text0,
|
||||
Text1,
|
||||
UnconstrainedBoxDemo(),
|
||||
],
|
||||
);
|
||||
|
@ -5,8 +5,8 @@ import './demo.dart';
|
||||
const String Text0 = """### **简介**
|
||||
> 一个常用的widget,它结合了常见的绘画,定位和大小调整
|
||||
- 该容器首先让child填充绘制,然后再将其他的约束应用于填充范围。
|
||||
- 在绘画过程中,容器先应用给定的转换,在绘制装饰以填充的范围,然后绘制child,最后绘制前景,同时填充需要填充的范围
|
||||
- 没有child的容器试图尽可能的大,除非传入的约束是无限制的。child的大小会被width,height等约束覆盖。
|
||||
- 在绘画过程中,容器先应用给定的转换,再绘制装饰以填充的范围,然后绘制child,最后绘制前景,同时填充需要填充的范围
|
||||
- 没有child的容器将尽可能的大,除非传入的约束是无限制的。child的大小会被width,height等约束覆盖。
|
||||
""";
|
||||
|
||||
const String Text1 = """
|
||||
|
@ -34,9 +34,7 @@ class RowMainAxisAlignment extends StatelessWidget {
|
||||
|
||||
final CrossAxisAlignment crossStatus;
|
||||
|
||||
const RowMainAxisAlignment(
|
||||
this.status, this.crossStatus)
|
||||
: super();
|
||||
const RowMainAxisAlignment(this.status, this.crossStatus) : super();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -63,8 +61,8 @@ class RowMainAxisAlignment extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class RowLayout extends StatelessWidget {
|
||||
const RowLayout() : super();
|
||||
class RowLayoutCreate extends StatelessWidget {
|
||||
const RowLayoutCreate() : super();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
@ -3,10 +3,10 @@ import '../../../../../common/widget_demo.dart';
|
||||
import './demo.dart';
|
||||
|
||||
const String Text0 = """### **简介**
|
||||
> Row 是一个将其child显示在水平数组的小部件
|
||||
> Row 是一个将其child显示在水平数组的widget
|
||||
- 将其child填充可用的横向水平空间,一行高度是childs的最大高度(即:总是满足传入的垂直约束)
|
||||
- 如果你只有一个child,只需要考虑使用对其或者中间位置,如果多个child,注意扩展水平空间(Expanded),可以将child封装在一个扩展部件里面
|
||||
- 当我们看到行有黄色和黑色条纹警告时候,说明行已经溢出,当行溢出,行之间当空间将没有任何空间可供扩展。
|
||||
- 当我们看到行有黄色和黑色条纹警告时候,说明行已经溢出,当行溢出,行之间空间将没有任何空间可供扩展。
|
||||
|
||||
""";
|
||||
|
||||
@ -51,7 +51,7 @@ class _DemoState extends State<Demo> {
|
||||
Column _rowCreate() {
|
||||
return new Column(
|
||||
children: <Widget>[
|
||||
RowLayout(),
|
||||
RowLayoutCreate(),
|
||||
Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
|
@ -3,8 +3,9 @@ import '../../../../../common/widget_demo.dart';
|
||||
import './demo.dart';
|
||||
|
||||
const String _stackText0 = """### **简介**
|
||||
> 显示来自子项列表的单个子项。
|
||||
- 只显示指定位置的窗口小部件,其他的位置的窗口小部件不会显示,所以indexedStack的尺寸永远和最大的子节点一样。
|
||||
> 显示一个子项列表的单个子项。
|
||||
- 只显示指定位置的widget,其他的位置的widget不会显示,所以indexedStack的尺寸永远和最大的子节点一样。
|
||||
- 显示的子项widget是给到了具体的索引选择出来的widget
|
||||
- 如果value 为null,将不显示任何内容
|
||||
""";
|
||||
const String _stackText1 = """### **基本用法**
|
||||
|
@ -3,9 +3,9 @@ import '../../../../../common/widget_demo.dart';
|
||||
import './demo.dart';
|
||||
|
||||
const String _stackText0 = """### **简介**
|
||||
> 用于将多个子级相对于其框的边缘定位,多用于以简单方式重叠children
|
||||
> 用于将多个childs相对于其框的边缘定位,多用于以简单方式重叠children
|
||||
- 当第一个child置于底部时,堆栈按顺序绘制其子项。如果更改子项绘制顺序,可以使用新顺序重新建立堆栈
|
||||
- 注意:stack的每一个子节点都已定位或为定位,定位子项必须至少一个非null属性的定位。
|
||||
- 注意:stack的每一个子节点都已定位或未定位,定位子项必须至少一个非null属性的定位。
|
||||
|
||||
""";
|
||||
const String _stackText1 = """### **基本用法**
|
||||
|
Reference in New Issue
Block a user