Из моего понимания вашей проблемы у вас фактически есть две проблемы.
Первая проблема заключается в том, что вы не используете соответствующий виджет Flutter для выполнения своей задачи.
Вторая проблема заключается в том, что у вас есть ошибка в вашем примере кода Stepper.
Поскольку устранение проблемы № 2 не решит проблему № 1, я собираюсь предложить следующее в качестве решения:
Неявным образом, с помощью которого Флэттерс СтепперВиджет работает взаимно, исключая одновременное отображение всех шагов в активном состоянии.По сути, Stepper не предназначен для того, чтобы делать то, что вы хотитеВ вашем случае лучшим подходом может быть использование чего-то вроде ListBuilder:
import 'dart:io' as Io;
import 'package:flutter/material.dart';
class zListTileExample extends StatefulWidget {
zListTileExample({Key key}) : super(key: key);
@override
zListTileExampleState createState() => zListTileExampleState();
}
class zListTileExampleState extends State <zListTileExample> {
List<SampleStepTile> my_steps = [
new SampleStepTile(
title: new Text("Step 1"),
content: new Text("Hello 1!")),
new SampleStepTile(
title: new Text("Step 2"),
content: new Text("Hello 2!")
),
new SampleStepTile(
title: new Text("Step 3"),
content: new Text("Hello World!"),
)
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("My App Title"),
),
body:
ListView.builder(
itemCount: my_steps.length,
itemBuilder: (context, index) {
return
Column ( children: <Widget> [
ListTile(
title: my_steps[index].title ,
subtitle: my_steps[index].content
)
, Row ( children : <Widget> [
RaisedButton ( child: new Text ("Use")
, onPressed: () { print ("Step $index is ok");}),
RaisedButton ( child: new Text ("Cancel")
, onPressed: () { print ("Step $index is canceled");})
]
)
]
);
},
)
);
}
}
class SampleStepTile {
SampleStepTile({Key key, this.title, this.content });
Text title;
Text content;
}