-1

这是我的代码:

import 'dart:convert';

import 'package:flutter/material.dart';

class OverViewList extends StatefulWidget {
  OverViewList({Key key}) : super(key: key);

  @override
  _OverViewListState createState() => _OverViewListState();
}

class _OverViewListState extends State<OverViewList> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.blueGrey,
      body: Center(
        child: Container(
          child: FutureBuilder(
            builder: (context, snapshot) {
              var showData = json.decode(snapshot.data.toString());
              if (snapshot.hasData) {
                return ListView.builder(
                  itemCount: showData.length,
                  itemBuilder: (BuildContext context, int index) {
                    return Padding(
                      padding: EdgeInsets.fromLTRB(12, 0, 12, 0),
                      child: Card(
                        child: ListTile(
                          contentPadding: EdgeInsets.fromLTRB(8, 5, 5, 5),
                          title: Padding(
                            padding: const EdgeInsets.fromLTRB(0, 0, 0, 10),
                            child: Text(showData[index]["Product_Name"]),
                          ),
                          subtitle: Text("Vorhanden: " +
                              showData[index]["Stock"] +
                              "\n" +
                              "Verdirbt am " +
                              showData[index]["Expiry_date"]),
                        ),
                      ),
                    );
                  },
                );
              }

              return CircularProgressIndicator();
            },
            future: DefaultAssetBundle.of(context).loadString(
                "lib/global/Overview_Products/Overview_Product.json"),
          ),
        ),
      ),
    );
  }
}

我已经尝试了一些,但没有找到解决方案。使用 'row' 或 'columnß' 我也已经 gebeiotet。但是,这不适用于列表视图。该按钮应该在列表视图上方可见,浮动,在底部的一种栏中。它应该是这样的:它应该是什么样子 的一个例子

4

2 回答 2

0

您可以使用该列,将 shrinkWrap:true 添加到 listView 应该足以避免溢出

于 2020-12-12T23:32:01.653 回答
0

如果没有错,您需要一个浮动操作按钮,您应该检查该文章 => FloatingActionButton 类

于 2020-12-13T11:31:04.113 回答