Flutter 步进器的内容不会滚动

Flutter 步进器的内容不会滚动,flutter,flutter-animation,Flutter,Flutter Animation,我目前正在开发一个应用程序。 为此,我使用了颤振步进器,但我有一个问题,即内部内容不可滚动,我已经尝试了几种可能性,但没有成功。 我插入了图像+代码 我希望你能帮助我 图片: 步进电机: 主体:容器( 孩子:步进机( 物理:弹跳CrollPhysics(), 步骤:stepsStammdaten(), currentStep:currentStep, onStepContinue:下一步, onStepTapped:(步骤)=>转到(步骤), onStepCancel:取消, ), 台阶( 状

我目前正在开发一个应用程序。 为此,我使用了颤振步进器,但我有一个问题,即内部内容不可滚动,我已经尝试了几种可能性,但没有成功。 我插入了图像+代码 我希望你能帮助我

图片:

步进电机:

主体:容器(
孩子:步进机(
物理:弹跳CrollPhysics(),
步骤:stepsStammdaten(),
currentStep:currentStep,
onStepContinue:下一步,
onStepTapped:(步骤)=>转到(步骤),
onStepCancel:取消,
),
台阶(
状态:StepState.index,
是的,
标题:常量文本(“Rejkla”),
内容:ListView.builder(
收缩膜:对,
itemCount:this.index,
itemBuilder:(上下文,索引)=>this.\u buildRow(索引),
)
),´´´
方法buildRow()包含一个ListView
返回列表视图(
物理:常量AlwaysScrollablePhysics(),
收缩膜:对,
儿童:[
//下面是一些文本输入
]);

这个
代码
非常适合我。 通过替换下面的代码

physics: BouncingScrollPhysics(),
用这个

physics : ClampingScrollPhysics(),

它应该能够完美地滚动。

多亏了你们两位Mukul和CodOg。我也遇到了同样的问题,我读了你们的对话,这对我解决问题有很大帮助。我尝试了这个。这个很有效

import 'package:flutter/material.dart';

class AddMember extends StatefulWidget {
  @override
  _AddMemberState createState() => _AddMemberState();
}

class _AddMemberState extends State<AddMember> {
  int _currentStep = 0;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('ADD MEMBERS'),
        backgroundColor: Colors.orange,
      ),
      body: Theme(
        data: ThemeData(primaryColor: Colors.orange),
        child: Form(
          child: new Stepper(
            physics: ClampingScrollPhysics(),
            steps: _myStep(),
            currentStep: this._currentStep,
            onStepTapped: (step) {
              setState(() {
                this._currentStep = step;
              });
            },
            onStepContinue: () {
              setState(() {
                if (this._currentStep < this._myStep().length - 1) {
                  this._currentStep = this._currentStep + 1;
                } else {
                  print('Completed, Check the Filed');
                }
              });
            },
            onStepCancel: () {
              setState(() {
                if (this._currentStep > 0) {
                  this._currentStep = this._currentStep - 1;
                } else {
                  this._currentStep = 0;
                }
              });
            },
          ),
        ),
      ),
    );
  }

  List<Step> _myStep() {
    List<Step> _steps = [
      Step(
        title: Text('Personal Details'),
        content: new Container(
          height: 500,
          child: SingleChildScrollView(
              child: Column(
                children: <Widget>[
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                ],
              )
          ),
        ),
        isActive: _currentStep >= 0,
      ),
      Step(
        title: Text('Residence Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 1,
      ),
      Step(
        title: Text('Office Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 2,
      ),
      Step(
        title: Text('Native Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 3,
      ),
      Step(
        title: Text('Others Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 4,
      ),
    ];
    return _steps;
  }
}
导入“包装:颤振/材料.省道”;
类AddMember扩展StatefulWidget{
@凌驾
_AddMemberState createState()=>\u AddMemberState();
}
类_AddMemberState扩展了状态{
int _currentStep=0;
@凌驾
小部件构建(构建上下文){
归还新脚手架(
appBar:新的appBar(
标题:新文本(“添加成员”),
背景颜色:Colors.orange,
),
正文:主题(
数据:主题数据(原色:Colors.orange),
孩子:表格(
孩子:新的步进器(
物理:ClampingScrollPhysics(),
步骤:_myStep(),
currentStep:此。\ u currentStep,
步骤:(步骤){
设置状态(){
这是。_currentStep=步骤;
});
},
onStepContinue:(){
设置状态(){
if(this.\u currentStep0){
此._currentStep=此._currentStep-1;
}否则{
这一点。_currentStep=0;
}
});
},
),
),
),
);
}
列表_myStep(){
列表_步骤=[
台阶(
标题:文本(“个人详细信息”),
内容:新容器(
身高:500,
子:SingleChildScrollView(
子:列(
儿童:[
新TextFormField(
自动对焦:对,
装饰:输入装饰(
hintText:“名字”,
边框:大纲输入边框(
边界半径:边界半径。圆形(5.0),
边界边(
颜色:颜色。橙色,
样式:BorderStyle.solid,
)),
),
),
新TextFormField(
自动对焦:对,
装饰:输入装饰(
hintText:“名字”,
边框:大纲输入边框(
边界半径:边界半径。圆形(5.0),
边界边(
颜色:颜色。橙色,
样式:BorderStyle.solid,
)),
),
),
新TextFormField(
自动对焦:对,
装饰:输入装饰(
hintText:“名字”,
边框:大纲输入边框(
边界半径:边界半径。圆形(5.0),
边界边(
颜色:颜色。橙色,
样式:BorderStyle.solid,
)),
),
),
新TextFormField(
自动对焦:对,
装饰:输入装饰(
hintText:“名字”,
边框:大纲输入边框(
边界半径:边界半径。圆形(5.0),
边界边(
颜色:颜色。橙色,
样式:BorderStyle.solid,
)),
),
),
],
)
),
),
isActive:_currentStep>=0,
),
台阶(
标题:文本(“居住详情”),
内容:表单(子项:TextField()),
isActive:_currentStep>=1,
),
台阶(
标题:文本(“办公室详细信息”),
内容:表单(子项:TextField()),
isActive:_currentStep>=2,
),
台阶(
标题:文本(“本机详细信息”),
内容:表单(子项:TextField()),
isActive:_currentStep>=3,
),
台阶(
标题:文本(“其他详细信息”),
内容:表单(子项:TextField()),
isActive:_currentStep>=4,
),
];
返回步骤;
}
}

嘿,是的,滚动可以工作,但我会
import 'package:flutter/material.dart';

class AddMember extends StatefulWidget {
  @override
  _AddMemberState createState() => _AddMemberState();
}

class _AddMemberState extends State<AddMember> {
  int _currentStep = 0;

  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      appBar: new AppBar(
        title: new Text('ADD MEMBERS'),
        backgroundColor: Colors.orange,
      ),
      body: Theme(
        data: ThemeData(primaryColor: Colors.orange),
        child: Form(
          child: new Stepper(
            physics: ClampingScrollPhysics(),
            steps: _myStep(),
            currentStep: this._currentStep,
            onStepTapped: (step) {
              setState(() {
                this._currentStep = step;
              });
            },
            onStepContinue: () {
              setState(() {
                if (this._currentStep < this._myStep().length - 1) {
                  this._currentStep = this._currentStep + 1;
                } else {
                  print('Completed, Check the Filed');
                }
              });
            },
            onStepCancel: () {
              setState(() {
                if (this._currentStep > 0) {
                  this._currentStep = this._currentStep - 1;
                } else {
                  this._currentStep = 0;
                }
              });
            },
          ),
        ),
      ),
    );
  }

  List<Step> _myStep() {
    List<Step> _steps = [
      Step(
        title: Text('Personal Details'),
        content: new Container(
          height: 500,
          child: SingleChildScrollView(
              child: Column(
                children: <Widget>[
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                  new TextFormField(
                    autofocus: true,
                    decoration: InputDecoration(
                      hintText: "First Name",
                      border: OutlineInputBorder(
                          borderRadius: BorderRadius.circular(5.0),
                          borderSide: BorderSide(
                            color: Colors.orange,
                            style: BorderStyle.solid,
                          )),
                    ),
                  ),
                ],
              )
          ),
        ),
        isActive: _currentStep >= 0,
      ),
      Step(
        title: Text('Residence Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 1,
      ),
      Step(
        title: Text('Office Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 2,
      ),
      Step(
        title: Text('Native Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 3,
      ),
      Step(
        title: Text('Others Details'),
        content: Form(child: TextField()),
        isActive: _currentStep >= 4,
      ),
    ];
    return _steps;
  }
}