使用带有列和卡片的ListView

问题描述 投票:0回答:1

i底部有x像素溢出的问题。我希望页面是一个带有几张包含列的卡片的ListView。

代码

return ListView(
      shrinkWrap: true,
      children: <Widget>[
        Card(
          child: Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: Text(
                    'Please follow the following steps to sign your  document.',
                    style: _textTheme.body1),
              ),
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: Text(
                  'Step 1: Download, read and review the attached document.',
                  style: _textTheme.body1,
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: RaisedButton(
                  onPressed: () {
                    Util.launchURL('${_service.client.document}');
                  },
                  color: Colors.blueGrey,
                  child: ListTile(
                    leading: Icon(
                      Icons.file_download,
                      color: Colors.white,
                    ),
                    title: Center(
                      child: Text(
                        'DOWNLOAD',
                        style: TextStyle(
                          color: Colors.white,
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
        Card(
          child: Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: Text(
                  'Step 2: Sign (make your signature) in the gray box below.',
                  style: _textTheme.body1,
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: Text(
                  '${_service.client.firstName} ${_service.client.lastName}',
                  style: _textTheme.subtitle,
                ),
              ),
              Container(
                width: MediaQuery.of(context).size.width,
                height: MediaQuery.of(context).size.height * .2,
                child: _signatureView,
              ),
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: ButtonTheme(
                  height: 25.0,
                  child: RaisedButton(
                    onPressed: () {
                      _signatureView.clear();
                    },
                    color: Colors.blue,
                    child: ListTile(
                      leading: Icon(
                        Icons.edit,
                        color: Colors.white,
                      ),
                      title: Center(
                        child: Text(
                          'CLEAR',
                          style: TextStyle(
                            color: Colors.white,
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        ),
        _service.client.jointApplication
            ? Card(
                child: Column(
                  children: <Widget>[
                    Padding(
                      padding: const EdgeInsets.all(5.0),
                      child: Text(
                        '${_service.client.spouseFirstName} ${_service.client.spouseLastName}',
                        style: _textTheme.subtitle,
                      ),
                    ),
                    Container(
                      width: MediaQuery.of(context).size.width,
                      height: MediaQuery.of(context).size.height * .2,
                      child: _spouseSignature,
                    ),
                    Padding(
                      padding: const EdgeInsets.all(5.0),
                      child: ButtonTheme(
                        height: 25.0,
                        child: RaisedButton(
                          onPressed: () {
                            _spouseSignature.clear();
                          },
                          color: Colors.blue,
                          child: ListTile(
                            leading: Icon(
                              Icons.edit,
                              color: Colors.white,
                            ),
                            title: Center(
                              child: Text(
                                'CLEAR',
                                style: TextStyle(
                                  color: Colors.white,
                                ),
                              ),
                            ),
                          ),
                        ),
                      ),
                    ),
                  ],
                ),
              )
            : null,
        Card(
          child: Column(
            children: <Widget>[
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: Text(
                  'Step 3: Submit your signature, by clicking on the Save button.',
                  style: _textTheme.body1,
                ),
              ),
              Padding(
                padding: const EdgeInsets.all(5.0),
                child: ButtonTheme(
                  height: 25.0,
                  child: RaisedButton(
                    onPressed: () async {
                      if (_signatureView.isEmpty) {
                        Scaffold.of(context).showSnackBar(
                          SnackBar(
                            content: Text(
                                'Error could not save signed document. Please sign before saving'),
                            duration: Duration(seconds: 3),
                          ),
                        );
                      } else {
                        _service.setSignature(
                            Uint8List.fromList(currentSignatureData.codeUnits));
                        await _service.submitSignature();
                      }
                    },
                    color: Colors.green,
                    child: ListTile(
                      leading: Icon(
                        Icons.check,
                        color: Colors.white,
                      ),
                      title: Center(
                        child: Text(
                          'Save',
                          style: TextStyle(
                            color: Colors.white,
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
              ),
            ],
          ),
        )
      ],
    );

发行图片

Image of issue

flutter
1个回答
0
投票

尝试一下:

return  Expanded( child: ListView(
  shrinkWrap: true,
  children: <Widget>[
    Card(
      child: Column(
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: Text(
                'Please follow the following steps to sign your  document.',
                style: _textTheme.body1),
          ),
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: Text(
              'Step 1: Download, read and review the attached document.',
              style: _textTheme.body1,
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: RaisedButton(
              onPressed: () {
                Util.launchURL('${_service.client.document}');
              },
              color: Colors.blueGrey,
              child: ListTile(
                leading: Icon(
                  Icons.file_download,
                  color: Colors.white,
                ),
                title: Center(
                  child: Text(
                    'DOWNLOAD',
                    style: TextStyle(
                      color: Colors.white,
                    ),
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    ),
    Card(
      child: Column(
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: Text(
              'Step 2: Sign (make your signature) in the gray box below.',
              style: _textTheme.body1,
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: Text(
              '${_service.client.firstName} ${_service.client.lastName}',
              style: _textTheme.subtitle,
            ),
          ),
          Container(
            width: MediaQuery.of(context).size.width,
            height: MediaQuery.of(context).size.height * .2,
            child: _signatureView,
          ),
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: ButtonTheme(
              height: 25.0,
              child: RaisedButton(
                onPressed: () {
                  _signatureView.clear();
                },
                color: Colors.blue,
                child: ListTile(
                  leading: Icon(
                    Icons.edit,
                    color: Colors.white,
                  ),
                  title: Center(
                    child: Text(
                      'CLEAR',
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    ),
    _service.client.jointApplication
        ? Card(
            child: Column(
              children: <Widget>[
                Padding(
                  padding: const EdgeInsets.all(5.0),
                  child: Text(
                    '${_service.client.spouseFirstName} ${_service.client.spouseLastName}',
                    style: _textTheme.subtitle,
                  ),
                ),
                Container(
                  width: MediaQuery.of(context).size.width,
                  height: MediaQuery.of(context).size.height * .2,
                  child: _spouseSignature,
                ),
                Padding(
                  padding: const EdgeInsets.all(5.0),
                  child: ButtonTheme(
                    height: 25.0,
                    child: RaisedButton(
                      onPressed: () {
                        _spouseSignature.clear();
                      },
                      color: Colors.blue,
                      child: ListTile(
                        leading: Icon(
                          Icons.edit,
                          color: Colors.white,
                        ),
                        title: Center(
                          child: Text(
                            'CLEAR',
                            style: TextStyle(
                              color: Colors.white,
                            ),
                          ),
                        ),
                      ),
                    ),
                  ),
                ),
              ],
            ),
          )
        : null,
    Card(
      child: Column(
        children: <Widget>[
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: Text(
              'Step 3: Submit your signature, by clicking on the Save button.',
              style: _textTheme.body1,
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(5.0),
            child: ButtonTheme(
              height: 25.0,
              child: RaisedButton(
                onPressed: () async {
                  if (_signatureView.isEmpty) {
                    Scaffold.of(context).showSnackBar(
                      SnackBar(
                        content: Text(
                            'Error could not save signed document. Please sign before saving'),
                        duration: Duration(seconds: 3),
                      ),
                    );
                  } else {
                    _service.setSignature(
                        Uint8List.fromList(currentSignatureData.codeUnits));
                    await _service.submitSignature();
                  }
                },
                color: Colors.green,
                child: ListTile(
                  leading: Icon(
                    Icons.check,
                    color: Colors.white,
                  ),
                  title: Center(
                    child: Text(
                      'Save',
                      style: TextStyle(
                        color: Colors.white,
                      ),
                    ),
                  ),
                ),
              ),
            ),
          ),
        ],
      ),
    )
  ],
 )
);
热门问题
推荐问题
最新问题