Files
xiaojia22326@163.com 69c4d5efe6 modify some description
2019-01-12 15:23:17 +08:00

92 lines
3.3 KiB
Dart
Raw 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.

import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import '../../../../../common/widget_demo.dart';
import './demo.dart';
const String _flatText0 = """
### **简介**
> Align控件即对齐控件能将子控件所指定方式对齐并根据子控件的大小调整自己的大小。
- 根据自己需求,进行控件对齐
### **基本用法**
> alignment → AlignmentGeometry
- 要对齐右下方的框那么对这个框对要求会比对子控件更加严肃的约束使用Alignment.bottomRight
- 同理Alignment.centerAlignment.bottomLeftAlignment.topLeft等
""";
const String _flatText1 = """
> widthFactor / heightFactor → double
- 如果widthFactor / heightFactor 为空并且外部无任何约束child控件大小默认那么这个控件将根据自身尺寸最大化
- 如果widthFactor / heightFactor 不为空并且外部无约束align将匹配对应的child尺寸
- exwidthFactor/ heightFactor 为2.0那么widget的宽高为child宽高的两倍
- 如果widthFactor / heightFactor 为空并且外部无约束child控件将会设置自身大小
""";
class Demo extends StatefulWidget {
static const String routeName = '/element/Frame/Align/Align';
@override
State<StatefulWidget> createState() => _DemoState();
}
class _DemoState extends State<Demo> {
@override
Widget build(BuildContext context) {
return WidgetDemo(
title: 'Align',
codeUrl: "elements/Frame/Align/Align/demo.dart",
docUrl: 'https://docs.flutter.io/flutter/widgets/Align-class.html',
contentList: [_flatText0, _alignCreate()],
);
}
Column _alignCreate() {
return new Column(
children: <Widget>[
SizedBox(height: 10.0),
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
AlignAlignment(Alignment.center, 'center'),
AlignAlignment(Alignment.centerLeft, 'centerLeft'),
],
),
SizedBox(height: 10.0),
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
AlignAlignment(Alignment.centerRight, 'centerRight'),
AlignAlignment(Alignment.bottomCenter, 'btCenter'),
AlignAlignment(Alignment.topCenter, 'topCenter'),
],
),
SizedBox(height: 10.0),
new Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
AlignAlignment(Alignment.topLeft, 'topLeft'),
AlignAlignment(Alignment.topRight, 'topRight'),
AlignAlignment(Alignment.bottomLeft, 'bottomLeft'),
],
),
SizedBox(height: 10.0),
MarkdownBody(data: _flatText1),
Container(
margin: new EdgeInsets.only(top: 20.0, bottom: 20.0),
color: Color(0xffe91e63),
child: new Align(
alignment: Alignment.topLeft,
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'),
],
);
}
}