Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/vba/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 整体身体单视图_Flutter - Fatal编程技术网

Flutter 整体身体单视图

Flutter 整体身体单视图,flutter,Flutter,我想将主体包装在SingleChildScrollView小部件中,但由于某些原因,它无法工作。当我将容器包装在SingleChildScrollView小部件中时,一切都消失了。有解决办法吗 Scaffold( body: Container( padding: const EdgeInsets.all(20), child: Column( crossAxisAlignment: CrossAxisAlignment.start

我想将主体包装在SingleChildScrollView小部件中,但由于某些原因,它无法工作。当我将容器包装在SingleChildScrollView小部件中时,一切都消失了。有解决办法吗

Scaffold(
      body: Container(
        padding: const EdgeInsets.all(20),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Spacer(),
            DisplayText(),
            Spacer(),
            Form(
              child: Column(
                children: [
                  TextFormField(
                    decoration: InputDecoration(
                      border: UnderlineInputBorder(),
                      labelText: 'Enter your username',
                    ),
                    textInputAction: TextInputAction.next,
                  ),
                  TextFormField(
                    decoration: InputDecoration(
                      border: UnderlineInputBorder(),
                      labelText: 'Enter your password',
                    ),
                  ),
                ],
              ),
            ),
            .
            .
            .
            .

          ],
        ),
      ),
    );


您可以使用
包装整个布局,并使用
展开的
小部件展开子项,然后添加
SingleChildScrollView
。请删除
Spacer
,如果您需要小部件之间的空间,请使用
SizedBox

Scaffold(
      body: Column(
        children: [
          Expanded(
            child: SingleChildScrollView(
              child: Container(
                padding: const EdgeInsets.all(20),
                child: Column(
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    SizedBox(height: 10,),
                    DisplayText(),
                    SizedBox(height: 10,),
                    Form(
                      child: Column(
                        children: [
                          TextFormField(
                            decoration: InputDecoration(
                              border: UnderlineInputBorder(),
                              labelText: 'Enter your username',
                            ),
                            textInputAction: TextInputAction.next,
                          ),
                          TextFormField(
                            decoration: InputDecoration(
                              border: UnderlineInputBorder(),
                              labelText: 'Enter your password',
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        ],
      ),
    );

你的主意很管用。但是我有一个问题,为什么不使用Spacer()?