Flutter:如何减小 ModalBottomSheet 中 CupertinoPicker 的大小?

Flutter: How to reduce size of CupertinoPicker in ModalBottomSheet?

每当我尝试在 ColumnRowContainer 中设置 CupertinoPicker 中的 ModalBottomSheet 时,它似乎占用最大可能的地方。

有没有把ModalBottomSheet的size/heigt限制在CupertinoPicker的实际大小,明显比ModalBottomSheet的高度小很多(通过其灰色背景颜色变得明显)。

这是我的代码:

import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: MyHomePage(),
    );
  }
}


class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(body:
    Center(child: RaisedButton(onPressed: () => showPicker(context),
        child: Text('Show Bottom Sheet')),)
    );
  }


  Widget showPicker(BuildContext context) {
    showModalBottomSheet(
        context: context,
        builder: (context) {
              return Container(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    Text('This is a picker'),
                    Expanded(
                      child: Row(
                        mainAxisSize: MainAxisSize.min,
                        children: <Widget>[
                          Expanded(
                            child: Container(
                              height: 100,
                              child: CupertinoPicker(
                                itemExtent: 30,
                                onSelectedItemChanged: (int index) {
                                  print(index);
                                },
                                children: <Widget>[
                                  Center(child: Text("Item 1")),
                                  Center(child: Text("Item 2")),
                                  Center(child: Text("Item 3")),
                                ],
                              ),
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              );

        });
  }

}

这是我得到的:

感谢您的任何提示、提示和建议!

  Widget showPicker(BuildContext context) {
    showModalBottomSheet(
        context: context,
        builder: (context) {
              return Container(
                child: Column(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    Text('This is a picker'),
                    Row(
                      mainAxisSize: MainAxisSize.min,
                      children: <Widget>[
                        Expanded(
                          child: Container(
                            height: 100,
                            child: CupertinoPicker(
                              itemExtent: 30,
                              onSelectedItemChanged: (int index) {
                                print(index);
                              },
                              children: <Widget>[
                                Center(child: Text("Item 1")),
                                Center(child: Text("Item 2")),
                                Center(child: Text("Item 3")),
                              ],
                            ),
                          ),
                        ),
                      ],
                    ),
                  ],
                ),
              );

        });
  }

这可以解决粘贴方法的问题,你会得到你想要的输出