我是following this Stack Overflow post用于制作粘性页脚。页脚按需要执行,但有没有办法添加透明度,以便页脚后面的列表中的项目可见?
透明页脚
以下是制作实体页脚的所有代码
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage();
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
body: new Column(
children: <Widget>[
new Expanded(
child: new ListView.builder(
itemCount: 200,
itemBuilder: (context, index) {
return new ListTile(
title: new Text("title $index"),
);
},
),
),
new Container(
height: 40.0,
color: Colors.red,
),
],
),
);
}
}
答案 0 :(得分:2)
您可以使用Stack
在彼此的顶部显示小部件。
new Scaffold(
body: new Stack(
alignment: Alignment.bottomCenter
children: [
new ListView(...),
new Container(height: 40.0, color: Colors.red),
],
),
),