Flutter中的Stack、Align、Positioned的使用
2024-08-22 20:04:29
import 'package:flutter/material.dart';
import 'package:flutter_testdemo001/res/listData.dart'; void main() {
runApp(MyApp());
} class MyApp extends StatelessWidget {
const MyApp({Key key}) : super(key: key); @override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text("flutter demo"),
),
body: HomeContent(),
),
);
}
} class HomeContent extends StatelessWidget {
@override
Widget build(BuildContext context) {
// return Center(
// child: Stack(
// alignment: Alignment.center,
// children: <Widget>[
// Container(
// height: 400,
// width: 300,
// color: Colors.red,
// ),
// Text("我是一个文本", style: TextStyle(fontSize: 20, color: Colors.white))
// ],
// ),
// ); return Center(
child: Container(
height: ,
width: ,
color: Colors.red,
child: Stack(
children: <Widget>[
Align(
alignment: Alignment.topLeft,
child: Icon(Icons.home,size:,color: Colors.white),
),
Align(
alignment: Alignment.center,
child: Icon(Icons.block,size:,color: Colors.white),
),
Align(
alignment: Alignment.bottomRight,
child: Icon(Icons.search,size:,color: Colors.white),
),
],
),
),
);
}
}
最新文章
- ELK分析IIS日志
- Elasticsearch使用备忘
- JAVA中protected的作用
- lucene分词器与搜索
- 70 sudo-用来以其他身份来执行命令
- 零件分组_DP
- jQuery live与bind的区别
- Highcharts20151130
- Android开发中如何强制横屏和强制竖屏设置
- Eyeshot Ultimate 学习笔记(1)
- 解决未能启动服务“VMware Authorization Service”
- python 实现cm批量上传
- 在Ubuntu 18.04系统上安装Systemback的方法(抄)
- RDKIT+postgresql做化合物数据存储与查找
- docker 基础之网络管理
- HMM拓扑与转移模型
- Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 1)D. Frequency of String
- mysql 表锁进程非常多的情况
- Lintcode: Unique Paths
- loj 诗歌