Listview 带有3个以上项目的步进式收割台不能在颤振中滚动 #目标
我想要一个颤振步进与它的步骤列表在标题滚动 #发行 但是我用这个代码得到这个,请看附件中的图片 #努力 我在Stepper类中看到行小部件不可滚动,我试图将其更改为ListView,但它破坏了一切 #希望 我希望Flutter社区能够积极响应,帮助我走得更远Listview 带有3个以上项目的步进式收割台不能在颤振中滚动 #目标,listview,flutter,row,stepper,Listview,Flutter,Row,Stepper,我想要一个颤振步进与它的步骤列表在标题滚动 #发行 但是我用这个代码得到这个,请看附件中的图片 #努力 我在Stepper类中看到行小部件不可滚动,我试图将其更改为ListView,但它破坏了一切 #希望 我希望Flutter社区能够积极响应,帮助我走得更远 import 'package:provider/provider.dart'; import 'package:easy_cons/models/FormStep.dart'; class HomeScreen extends Stat
import 'package:provider/provider.dart';
import 'package:easy_cons/models/FormStep.dart';
class HomeScreen extends StatelessWidget {
final List<Step> steps = <Step>[
Step(
isActive: true,
title: Text('Title 1'),
subtitle: Text("Constructor"),
content: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: [
TextFormField(
decoration: InputDecoration(labelText: 'Email Address'),
),
],
),
state: StepState.editing),
Step(
isActive: true,
title: Text('Title2'),
content: Text('Title2'),
subtitle: Text("Constructor"),
),
Step(
title: Text('Title3'),
content: Text('Title3'),
subtitle: Text("Constructor"),
),
Step(
title: Text('Choc'),
content: Text('Title4'),
subtitle: Text("Constructor"),
),
Step(
title: Text('Choc'),
content: Text('Title5'),
subtitle: Text("Constructor"),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('MyApp'),
),
body: Stepper(
physics: ClampingScrollPhysics(),
currentStep: Provider.of<FormStep>(context).formStep,
type: StepperType.horizontal,
onStepContinue: () {
print(Provider.of<FormStep>(context).formStep);
Provider.of<FormStep>(context).incrementStep(this.steps.length);
print(Provider.of<FormStep>(context).formStep);
print(this.steps.length);
},
onStepCancel: () {
Provider.of<FormStep>(context).decrementStep(this.steps.length);
},
onStepTapped: (index) {
Provider.of<FormStep>(context).formStep = index;
},
steps: steps),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
floatingActionButton: Container(
width: 70.0,
height: 70.0,
child: Material(
shape: CircleBorder(),
elevation: 16.0,
child: FloatingActionButton(child: Icon(Icons.add), onPressed: () {}),
),
),
bottomNavigationBar: BottomAppBar(
shape: CircularNotchedRectangle(),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Row(
children: <Widget>[
IconButton(
icon: Icon(Icons.description),
onPressed: () {},
),
Text(
'MES CONSTATS',
style: TextStyle(fontWeight: FontWeight.bold),
),
],
),
Row(
children: <Widget>[
Text(
'PARAMETRES',
style: TextStyle(fontWeight: FontWeight.bold),
),
IconButton(
icon: Icon(
Icons.person,
size: 30.0,
),
onPressed: () {},
),
],
),
],
),
),
);
}
}```
[enter image description here][1]
[1]: https://i.stack.imgur.com/aJG5B.png
导入“包:provider/provider.dart”;
导入“包:easy_cons/models/FormStep.dart”;
类主屏幕扩展无状态小部件{
最终列表步骤=[
台阶(
是的,
标题:文本(“标题1”),
字幕:文本(“构造器”),
内容:专栏(
mainAxisAlignment:mainAxisAlignment.start,
儿童:[
TextFormField(
装饰:输入装饰(标签文本:“电子邮件地址”),
),
],
),
状态:StepState.editing),
台阶(
是的,
标题:文本(“标题2”),
内容:文本(“标题2”),
字幕:文本(“构造器”),
),
台阶(
标题:文本(“标题3”),
内容:正文(“标题3”),
字幕:文本(“构造器”),
),
台阶(
标题:文本(“Choc”),
内容:正文(“标题4”),
字幕:文本(“构造器”),
),
台阶(
标题:文本(“Choc”),
内容:正文(“标题5”),
字幕:文本(“构造器”),
),
];
@凌驾
小部件构建(构建上下文){
返回脚手架(
appBar:appBar(
标题:对,
标题:文本(“MyApp”),
),
机身:步进电机(
物理:ClampingScrollPhysics(),
currentStep:Provider.of(context).formStep,
类型:StepperType.horizontal,
onStepContinue:(){
打印(Provider.of(context.formStep);
Provider.of(context.incrementStep)(this.steps.length);
打印(Provider.of(context.formStep);
打印(此。步数。长度);
},
onStepCancel:(){
Provider.of(context).decrementStep(this.steps.length);
},
步骤:(索引){
Provider.of(context).formStep=索引;
},
步骤:步骤),
floatingActionButtonLocation:floatingActionButtonLocation.centerDocked,
浮动操作按钮:容器(
宽度:70.0,
身高:70.0,
儿童:材料(
形状:CircleBorder(),
标高:16.0,
child:FloatingActionButton(child:Icon(Icons.add),on按下:(){}),
),
),
bottomNavigationBar:BottomAppBar(
形状:CircularNotchedRectangle(),
孩子:排(
mainAxisSize:mainAxisSize.max,
mainAxisAlignment:mainAxisAlignment.spaceBetween,
儿童:[
划船(
儿童:[
图标按钮(
图标:图标(图标.说明),
按下:(){},
),
正文(
“MES CONSTATS”,
样式:TextStyle(fontWeight:fontWeight.bold),
),
],
),
划船(
儿童:[
正文(
“参数”,
样式:TextStyle(fontWeight:fontWeight.bold),
),
图标按钮(
图标:图标(
一个人,
尺寸:30.0,
),
按下:(){},
),
],
),
],
),
),
);
}
}```
[在此处输入图像描述][1]
[1]: https://i.stack.imgur.com/aJG5B.png
这里有一个图像链接,用SingleScrollChild将标题行包装起来。它将使它可以滚动。不要忘记将方向设置为水平。此外,行的子级应具有指定的宽度HKS@OMI Shah。此更改必须在Stepper文件内完成,但如果查看它,则无法指定子级的宽度,因为它是一个没有宽度属性的步骤列表。我会再看一次。这是图像链接,用SingleScrollChild包装标题行。它将使它可以滚动。不要忘记将方向设置为水平。此外,行的子级应具有指定的宽度HKS@OMI Shah。此更改必须在Stepper文件内完成,但如果查看它,则无法指定子级的宽度,因为它是一个没有宽度属性的步骤列表。我再看看。