horizontal_stepper_step 0.0.5
horizontal_stepper_step: ^0.0.5 copied to clipboard
This is a package for a simple horizontal stepper ,this can be used to show the progress in form of steps.
import 'package:flutter/material.dart';
import 'package:horizontal_stepper_step/horizontal_stepper.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
int _totalSteps = 5;
void _incrementCounter() {
setState(() {
_counter < _totalSteps ? _counter++ : _counter--;
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Padding(
padding: const EdgeInsets.only(top: 40.0),
child: HorizontalStepper(
totalStep: _totalSteps,
completedStep: _counter,
selectedColor: Colors.red,
backGroundColor: Colors.blue,
),
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}