Flutter - Listview超出容器borderradius

Flutter - Listview out of the container borderradius

任何人都知道如何解决这个问题。 我希望我的列表视图在我的容器中只有半径顶部。问题是我的列表视图显示在我的容器半径之外。: like this

这是我的代码:

import 'package:flutter/material.dart';

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

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

class _InfoScreenState extends State<InfoScreen>
    with AutomaticKeepAliveClientMixin {
  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).primaryColor,
        shadowColor: Colors.transparent,
        title: Text(
          'Informasi',
          style: TextStyle(color: Colors.white),
        ),
        centerTitle: true,
      ),
      body: Stack(
        children: [
          LayoutBuilder(
            builder: (BuildContext context, BoxConstraints constraints) {
              final double maxHeight = constraints.maxHeight;
              final double maxWidth = constraints.maxWidth;
              return Container(
                color: Theme.of(context).primaryColor,
                width: maxWidth,
                height: maxHeight,
              );
            },
          ),
          Container(
            decoration: BoxDecoration(
              color: Colors.white,
              borderRadius: BorderRadius.only(
                topLeft: Radius.circular(50),
                topRight: Radius.circular(50),
              ),
            ),
            child: ListView.builder(
              itemCount: 100,
              itemBuilder: (context, index) {
                return TextField(
                  decoration: InputDecoration(hintText: 'Try me'),
                );
              },
            ),
          ),
        ],
      ),
    );
  }

  @override
  bool get wantKeepAlive => true;
}

你们能帮我解决这个问题吗? 我是新手。谢谢你

padding 是你的朋友,将项目包装在 padding 小部件中或在容器内设置 padding 以将项目推到右侧以适合你的 UI