在 StreamBuilder 下或内部添加 ElevatedButton

Adding ElevatedButton under or inside StreamBuilder

我想在页面底部添加一个按钮,但我不知道如何在 StreamBuilder

内部或下方添加 ElevatedButton

我还想在此页面中的 StreamBuilder

之后添加一个 class
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

class OrderSuccessful extends StatefulWidget {
  @override
  _OrderSuccessfulState createState() => _OrderSuccessfulState();
}

class _OrderSuccessfulState extends State<OrderSuccessful>{
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: Text("Order Successful")),
      resizeToAvoidBottomInset: true,
      body: StreamBuilder(
        stream: FirebaseFirestore.instance.collection('personalinfo').snapshots(),
        builder: (BuildContext context, AsyncSnapshot<QuerySnapshot> snapshot){
          if (!snapshot.hasData){
            return Text("no value");
          }
          return ListView(
            children: snapshot.data!.docs.map((document){
              return Text(document['field1'] + " " + document['field2'] + " " + document['field3'] + " " + document['field4'], textAlign: TextAlign.center, style: TextStyle(color: Colors.black, fontWeight: FontWeight.bold, fontSize: 18));
            }).toList(),
          );
        },
      ),
    );
  }
}
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter/material.dart';

class OrderSuccessful extends StatefulWidget {
  @override
  _OrderSuccessfulState createState() => _OrderSuccessfulState();
}

class _OrderSuccessfulState extends State<OrderSuccessful> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: Text("Order Successful")),
        resizeToAvoidBottomInset: true,
        body: Column(
          children: [
            StreamBuilder(
              stream: FirebaseFirestore.instance
                  .collection('personalinfo')
                  .snapshots(),
              builder: (BuildContext context,
                  AsyncSnapshot<QuerySnapshot> snapshot) {
                if (!snapshot.hasData) {
                  return Text("no value");
                }
                return ListView(
                  shrinkWrap:true,
                  children: snapshot.data!.docs.map((document) {
                    return Text(
                        document['field1'] +
                            " " +
                            document['field2'] +
                            " " +
                            document['field3'] +
                            " " +
                            document['field4'],
                        textAlign: TextAlign.center,
                        style: TextStyle(
                            color: Colors.black,
                            fontWeight: FontWeight.bold,
                            fontSize: 18));
                  }).toList(),
                );
              },
            ),
          ],
        ));
  }
}