【发布时间】:2021-02-13 01:51:29
【问题描述】:
我想在 Flutter 中创建这种类型的步进器
到目前为止我已经尝试了这两种方法
Widget get stepper =>
Container(
padding: EdgeInsets.all(15),
color: Colors.white,
child: ListView.builder(
itemCount: stepperLIst.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return IntrinsicHeight(
child: Container(
margin: const EdgeInsets.only(bottom: 20),
child: Row(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisSize: MainAxisSize.min,
children: [
Column(
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.down,
children: [
Image.asset(stepperLIst[position].iconName),
SizedBox(height: 10),
CustomPaint(painter: LineDashedPainter(lineColor: Colors.grey))
],
),
SizedBox(width: 10),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
stepperLIst[position].tittle,
style: BaseStyles.textStyle.copyWith(fontFamily: BaseFonts.bold),
),
SizedBox(height: 10),
Text(
stepperLIst[position].value,
style: BaseStyles.textStyle,
)
],
),
)
]),
),
);
}));
也使用堆栈
Widget get stepper2 =>
Container(
padding: EdgeInsets.all(15),
color: Colors.white,
child: ListView.builder(
itemCount: stepperLIst.length,
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return Stack(
children: <Widget>[
Positioned(
left: 0,
top: 0,
bottom: 0,
child: Column(
mainAxisSize: MainAxisSize.min,
verticalDirection: VerticalDirection.down,
children: [
Image.asset(stepperLIst[position].iconName),
SizedBox(height: 10),
CustomPaint(painter: LineDashedPainter(lineColor: Colors.grey))
],
), // replace with your image
),
Padding(
padding: const EdgeInsets.only(left: 40),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
stepperLIst[position].tittle,
style: BaseStyles.textStyle.copyWith(fontFamily: BaseFonts.bold),
),
SizedBox(height: 10),
Text(
stepperLIst[position].value,
style: BaseStyles.textStyle,
)
],
),
)
],
);
}));
使用上面的代码我没有得到准确的输出
谁能帮我制作这种类型的步进器
如果需要更多信息,请告诉我。提前致谢。您的努力将不胜感激。
【问题讨论】:
标签: android ios flutter dart flutter-layout