首页 文章

颤振的透明粘性页脚

提问于
浏览
1

我是关注此 Stack Overflow 帖子制作粘性页脚。页脚按需要执行,但有没有办法添加透明度,以便页脚后面的列表中的项目可见?

坚实的页脚
在此输入图像描述

透明的页脚

在此输入图像描述

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

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

1 回答

  • 2

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

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

相关问题