Как я могу использовать SingleChildScrollView в моем коде флаттера? - PullRequest
0 голосов
/ 30 марта 2020

привет Мой код для страницы такой. Мне нужно прокрутить часть ниже панели приложения.

_sheetController =
    _scaffoldKey.currentState.showBottomSheet<void>((BuildContext context) {
  return
  DecoratedBox(
    decoration: BoxDecoration(color: Theme.of(context).canvasColor),
    child: ClipRRect(
      borderRadius: BorderRadius.only(
          topLeft: Radius.circular(40.0), topRight: Radius.circular(40.0)),
      child:

      Container(
        child:
        ListView(
          children: <Widget>[
            Container(
              child: Stack(
                children: <Widget>[
                  Positioned(
                    left: 10,
                    top: 10,
                    child: IconButton(
                      onPressed: () {
                        _loading = false;
                        Navigator.of(context).pop();
                      },
                      icon: Icon(
                        Icons.close,
                        size: 30.0,
                        color: Theme.of(context).primaryColor,
                      ),
                    ),
                  )
                ],
              ),
              height: 50,
              width: 50,
            ),
                Form(
              key: _formKey,
              autovalidate: _autoValidate,
              child:SingleChildScrollView(child:

              Column(
                children: <Widget>[
                  Container(
                    width: MediaQuery.of(context).size.width,
                    height: 140,
                    child: Stack(
                      children: <Widget>[
                        Positioned(
                          child: Align(
                            child: Container(
                              width: 130,
                              height: 130,
                              decoration: BoxDecoration(
                                  shape: BoxShape.circle,
                                  color: Theme.of(context).primaryColor),
                            ),
                            alignment: Alignment.center,
                          ),
                        ),
                        Positioned(
                          child: Container(
                            child: AutoSizeText(
                              "LOGIN",
                              maxLines: 1,
                              minFontSize: 
                              MediaQuery.of(context).size.width/10.0,
                              maxFontSize: 
                              MediaQuery.of(context).size.width/5.0,

                              style: TextStyle(
                                fontWeight: FontWeight.bold,
                                color: Colors.white,
                              ),
                            ),
                            alignment: Alignment.center,

                          ),
                        ),
                      ],
                    ),
                  ),
                  Padding(
                      padding: EdgeInsets.only(bottom: 20, top: 60),
                      child: CustomTextField(
                        onSaved: (input) {
                          _Email = input;

                        },
                        keyboardType: TextInputType.emailAddress,
                        validator: emailValidator,
                        icon: Icon(Icons.email),
                        hint: "EMAIL",
                      )),
                  CustomTextField(
                    icon: Icon(Icons.lock),
                    obsecure: true,
                    onSaved: (input) => _Password = input,
                    validator: (input) =>
                        input.isEmpty ? "*Required" : null,
                    hint: "PASSWORD",
                  ),
                  Padding(
                    padding: EdgeInsets.only(right:  
                    MediaQuery.of(context).size.width/1.96),
                    child: Container(
                      width: MediaQuery.of(context).size.width/2.310160428,
                        height: 40.0,
                        child:
                        FlatButton(
                        onPressed: resetSheet,
                        child: AutoSizeText("FORGOT PASWORD !" ,maxFontSize: 
                        20.0,minFontSize: 10.0,maxLines: 1,),
                      ),

                    )
                  ),
                  SizedBox(
                    height: 10,
                  ),
                  Padding(
                    padding: EdgeInsets.only(
                        left: 20,
                        right: 20,
                        bottom: MediaQuery.of(context).viewInsets.bottom),
                    child: _loading == true
                        ? CircularProgressIndicator(
                            valueColor: new AlwaysStoppedAnimation<Color>(
                                Theme.of(context).primaryColor),
                          )
                        : Container(
                            child: filledButton(
                                "LOGIN",
                                Colors.white,
                                Theme.of(context).primaryColor,
                                Theme.of(context).primaryColor,
                                Colors.white,
                                _validateLoginInput),
                            height: 50,
                            width: MediaQuery.of(context).size.width,
                          ),
                  ),
                  SizedBox(
                    height: 20,
                  ),
                ],
              ),
             ),
            ),
          ],
        ),

        height: MediaQuery.of(context).size.height / 1.1,
        width: MediaQuery.of(context).size.width,
        color: Colors.white,
      ),



      ),
      );

});

Мой код для страницы такой. Мне нужно прокрутить часть под панелью приложений.

@override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(... ),
      body: new Stack(
        children: <Widget>[
          new Container(
            decoration: BoxDecoration(
                image: DecorationImage(...),
          new Column(children: [
            new Container(...),
            new Container(...... ),
            new Padding(
              child: SizedBox(
                child: RaisedButton(..),
            ),
            new Divider(),
            new Column(
              children: <Widget>[
                new Container(
                  child: new Row(
                    children: <Widget>[
                      new Expanded(
                        child: new Text(  ),
                      ),
                      new IconButton(
                        icon: IconButton(..),
                        onPressed: () {
                          _changed(true, "type");
                        },
                      ),
                    ],
                  ),
                ),
                visibilityPropertyType
                    ? new Container(
                        margin: EdgeInsets.all(24.0),
                        child: new Column(
                          children: <Widget>[
                            new Row(
                              children: <Widget>[
                                new Expanded(... ),
                                new RaisedButton(..)
                              ],
                            ),
                            new Padding(
                              padding: const EdgeInsets.only(top: 10.0),
                              child: new Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceEvenly,
                                children: <Widget>[
                                  new Column(
                                    children: <Widget>[
                                      new Row(  
                                        children: <Widget>[.. ]),
                                      new Row(
                                        children: <Widget>[]),
                                      new Row(
                                        children: <Widget>[]),
                                      new Row(
                                        children: <Widget>[],
                                  ),
                                  new Column(
                                    children: <Widget>[
                                      new Row(
                                        children: <Widget>[],
                                      ),
                                    ],
                                  ),
                                ],
                              ),
                            ),
                          ],
                        ))
                    : new Container(),
              ],
            ),
            new Divider(
              color: Colors.white,
            )
          ])
        ],
      ),
    );
  }

Мне нужно сделать прокручиваемую часть тела. Как я могу реализовать эту прокрутку.

Я думаю, что здесь должен работать SingleChildScrollView, но не могу ли я иметь проблемы в своем коде, я много раз пытаюсь найти ошибку, но не помогу?

...