mirror of
https://github.com/alibaba/flutter-go.git
synced 2025-08-06 17:48:43 +08:00

1.views 文件夹里面分类,页面相关文件;2.公共组件全部放在components里;3.创建resources文件夹放置资源dart文件4.修改二级菜单文字大小 BREAKING CHANGE: 重构,建议删除本地db,再编译
94 lines
2.7 KiB
Dart
94 lines
2.7 KiB
Dart
import 'package:flutter/material.dart';
|
||
import 'package:flutter_go/components/widget_demo.dart';
|
||
import './demo.dart';
|
||
|
||
const String _stackText0 = """### **简介**
|
||
> 用于将多个childs相对于其框的边缘定位,多用于以简单方式重叠children
|
||
- 当第一个child置于底部时,堆栈按顺序绘制其子项。如果更改子项绘制顺序,可以使用新顺序重新建立堆栈
|
||
- 注意:stack的每一个子节点都已定位或未定位,定位子项必须至少一个非null属性的定位。
|
||
|
||
""";
|
||
const String _stackText1 = """### **基本用法**
|
||
> 1.alignment → AlignmentGeometry
|
||
- 对齐方式,默认是右上角,详情请点击Layout-row页面,类似
|
||
- 多个positioned叠加图层,Alignment.center事例
|
||
""";
|
||
const String _stackText2 = """###
|
||
> fit → StackFit
|
||
- loose:放开了子节点宽高的约束,可以让子节点从0到最大尺寸
|
||
- expand: 子节点最大可能的占用空间,允许最大大小
|
||
- passthrough:不改变子节点约束
|
||
|
||
>textDirection → TextDirection
|
||
- 文本方向
|
||
|
||
> overflow → Overflow
|
||
- 超过的部分是否裁剪掉
|
||
- overflow: Overflow.clip/visible
|
||
""";
|
||
|
||
class Demo extends StatefulWidget {
|
||
static const String routeName = '/element/Frame/Stack/Stack';
|
||
|
||
@override
|
||
State<StatefulWidget> createState() => _DemoState();
|
||
}
|
||
|
||
class _DemoState extends State<Demo> {
|
||
|
||
@override
|
||
Widget build(BuildContext context) {
|
||
return WidgetDemo(
|
||
title: 'Stack',
|
||
codeUrl:
|
||
'elements/Frame/Stack/Stack/demo.dart',
|
||
docUrl: 'https://docs.flutter.io/flutter/widgets/Stack-class.html',
|
||
contentList: [
|
||
_stackText0,
|
||
_stackCreate(),
|
||
_stackText1,
|
||
new Container(
|
||
width: 300.0,
|
||
height: 100.0,
|
||
margin: new EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||
color: new Color(0xffe91e63),
|
||
child: StackPositioned(),
|
||
),
|
||
_stackText2,
|
||
new Container(
|
||
width: 200.0,
|
||
height: 200.0,
|
||
color: new Color(0xffe91e63),
|
||
child: StackLayout(),
|
||
),
|
||
],
|
||
);
|
||
}
|
||
|
||
Column _stackCreate() {
|
||
return new Column(
|
||
children: <Widget>[
|
||
Column(
|
||
children: <Widget>[
|
||
new Container(
|
||
margin: new EdgeInsets.only(top: 10.0, bottom: 10.0),
|
||
width: 300.0,
|
||
height: 100.0,
|
||
color: Color(0xffe91e63),
|
||
child: StackDefault(),
|
||
),
|
||
new Container(
|
||
width: 300.0,
|
||
height: 100.0,
|
||
color: Color(0xffe91e63),
|
||
//堆栈顺序替换掉
|
||
child: StackDefault2(),
|
||
)
|
||
],
|
||
),
|
||
SizedBox(height: 10.0),
|
||
],
|
||
);
|
||
}
|
||
}
|