-
Notifications
You must be signed in to change notification settings - Fork 99
/
main.19-Stack Align 组件.dart
50 lines (46 loc) · 1.33 KB
/
main.19-Stack Align 组件.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import 'package:flutter/material.dart';
const TITLE = '标题标题标题标题标题标题标题';
const SUB_TITLE = '二级标题二级标题二级标题二级标题二级标题二级标题二级标题二级标题二';
const IMAGE_SRC =
'http://cms-bucket.ws.126.net/2019/06/20/68fa7f186ffe4479ab27efabd4d94246.png';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('Stack Align Widget'),
backgroundColor: Colors.pink,
),
body: HomeContent(),
),
);
}
}
class HomeContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Center(
child: Container(
child: Stack(
children: <Widget>[
Align(
child: Icon(Icons.home, size: 40, color: Colors.white),
alignment: Alignment.topCenter),
Align(
child: Icon(Icons.search, size: 40, color: Colors.pink),
alignment: Alignment.bottomLeft),
Icon(Icons.settings, size: 40, color: Colors.blue),
],
alignment: Alignment.center,
),
height: 400,
width: 300,
color: Colors.yellow,
),
);
}
}