stepwise 1.0.6 copy "stepwise: ^1.0.6" to clipboard
stepwise: ^1.0.6 copied to clipboard

A customizable stepper widget for Flutter that shows progress through steps with dotted line connectors and customizable styles.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:stepwise/stepwise.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: 'StepWise Example',
      theme: ThemeData(
        // This is the theme of your application.
        //
        // TRY THIS: Try running your application with "flutter run". You'll see
        // the application has a purple toolbar. Then, without quitting the app,
        // try changing the seedColor in the colorScheme below to Colors.green
        // and then invoke "hot reload" (save your changes or press the "hot
        // reload" button in a Flutter-supported IDE, or press "r" if you used
        // the command line to start the app).
        //
        // Notice that the counter didn't reset back to zero; the application
        // state is not lost during the reload. To reset the state, use hot
        // restart instead.
        //
        // This works for code too, not just values: Most code changes can be
        // tested with just a hot reload.
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const StepperExample(),
      debugShowCheckedModeBanner: false,
    );
  }
}

class StepperExample extends StatefulWidget {
  const StepperExample({super.key});

  @override
  State<StepperExample> createState() => _StepperExampleState();
}

class _StepperExampleState extends State<StepperExample> {
  int _currentStep = 1;
  final List<String> _steps = const [
    'Order Placed',
    'Processing',
    'Shipped',
    'Delivered',
  ];

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // TRY THIS: Try changing the color here to a specific color (to
        // Colors.amber, perhaps?) and trigger a hot reload to see the AppBar
        // change color while the other colors stay the same.
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: const Text('StepWise Example'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            StepWise(
              currentStep: _currentStep,
              steps: _steps,
              activeColor: Colors.deepPurple,
              inactiveColor: Colors.grey,
              textActiveColor: Colors.deepPurple,
              textInactiveColor: Colors.grey,
              circleRadius: 28,
              lineThickness: 2,
              fontSize: 14,
              fontWeight: FontWeight.w600,
            ),
            const SizedBox(height: 32),
            ElevatedButton(
              onPressed: () {
                setState(() {
                  if (_currentStep < _steps.length) {
                    _currentStep++;
                  } else {
                    _currentStep = 1;
                  }
                });
              },
              child: Text(
                _currentStep < _steps.length ? 'Next Step' : 'Start Over',
              ),
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
155
points
38
downloads

Publisher

unverified uploader

Weekly Downloads

A customizable stepper widget for Flutter that shows progress through steps with dotted line connectors and customizable styles.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on stepwise