flutterdartbuttonflutter2.0

Add a button to a Container


This is my Code:

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

I have already tried a bit around, but have not found a solution. With 'row' or 'columnß' I have also already gebeiotet. However, this does not quite work with the listview. The button should be visible above the listview, floating, in a kind of bar at the bottom. It should be look like this: An example of what it should look like


Solution

  • You could use the column, adding shrinkWrap:true to the listView should be enough to avoid overflow