gpt4 book ai didi

dart - Flutter 中的透明粘性页脚

转载 作者:IT王子 更新时间:2023-10-29 06:38:50 24 4
gpt4 key购买 nike

我是 following this Stack Overflow post用于制作粘性页脚。页脚按需要执行,但有没有办法增加透明度,使页脚后面的列表中的项目可见?

实心页脚 enter image description here

透明页脚

enter image description here

这是制作实体页脚的所有代码

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,
),
],
),
);
}
}

最佳答案

您可以使用 Stack 将小部件显示在彼此的顶部。

new Scaffold(
body: new Stack(
alignment: Alignment.bottomCenter,
children: [
new ListView(...),
new Container(height: 40.0, color: Colors.red),
],
),
),

关于dart - Flutter 中的透明粘性页脚,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49935009/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com