-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dynamic height with scrollable for custom length of steps #31
Labels
question
Further information is requested
Comments
any solution? |
Hi @pratikbutani (cc @kevin4dhd) The height of each step with Below an example: class HomePage extends StatelessWidget {
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Box(height: 100),
Box(height: 200),
Box(height: 300),
Box(height: 400),
Box(height: 500),
],
),
),
);
}
}
class Box extends StatelessWidget {
final double height;
const Box({
Key? key,
required this.height,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.black,
width: 2,
),
),
width: 100,
height: height,
child: const Indicator(),
);
}
}
class Indicator extends StatelessWidget {
const Indicator({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return const StepProgressIndicator(
totalSteps: 10,
currentStep: 5,
size: 20,
direction: Axis.vertical,
);
}
} The principle is the same if your parent container is scrollable: class ScrollContainerSize extends StatelessWidget {
const ScrollContainerSize({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: SizedBox(
height: 300,
child: SingleChildScrollView(
scrollDirection: Axis.vertical,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: const [
Box(height: 500),
],
),
),
),
),
);
}
}
class Box extends StatelessWidget {
final double height;
const Box({
Key? key,
required this.height,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(
border: Border.all(
color: Colors.black,
width: 2,
),
),
width: 100,
height: height,
child: const Indicator(),
);
}
}
class Indicator extends StatelessWidget {
const Indicator({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return const StepProgressIndicator(
totalSteps: 10,
currentStep: 5,
size: 20,
direction: Axis.vertical,
);
}
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am using verticle StepProgressIndicator and I want to give dynamic height to it because I am generating steps based on the length of API.
Is there any way to give height dynamically with a scrollable list of indicators?
The text was updated successfully, but these errors were encountered: