• fkutter Stepper步骤指示器


    一个Material Design 步骤指示器,显示一系列步骤的过程

    import 'package:flutter/material.dart';
    
    class StepperDemo extends StatefulWidget {
      @override
      _StepperDemoState createState() => _StepperDemoState();
    }
    
    class _StepperDemoState extends State<StepperDemo> {
    
      int _currentStep = 0;
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('StepperDemo'),
            elevation: 0.0,
          ),
          body: Container(
            padding: EdgeInsets.all(16.0),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: <Widget>[
                Theme(
                  data: Theme.of(context).copyWith(
                    primaryColor: Colors.black,
                  ),
                  child: Stepper(
                    currentStep: _currentStep,
                    onStepTapped: (int value) {
                      setState(() {
                        _currentStep = value;
                      });
                    },
                    onStepContinue: () {
                      setState(() {
                        _currentStep < 2 ? _currentStep += 1 : _currentStep = 0;
                      });
                    },
                    onStepCancel: () {
                      setState(() {
                        _currentStep > 0 ? _currentStep -= 1 : _currentStep = 0;
                      });
                    },
                    steps: [
                      Step(
                        title: Text('Login'),
                        subtitle: Text('Login first'),
                        content: Text('Magna exercitation duis non sint eu nostrud.'),
                        isActive: _currentStep == 0,
                      ),
                      Step(
                        title: Text('Choose Plan'),
                        subtitle: Text('Choose you plan.'),
                        content: Text('Magna exercitation duis non sint eu nostrud.'),
                        isActive: _currentStep == 1,
                      ),
                      Step(
                        title: Text('Confirm payment'),
                        subtitle: Text('Confirm your payment method.'),
                        content: Text('Magna exercitation duis non sint eu nostrud.'),
                        isActive: _currentStep == 2,
                      ),
                    ],
                  ),
                ),
              ],
            ),
          )
        );
      }
    }

    效果:

  • 相关阅读:
    vsftpd文件服务参数汇总和虚拟用户使用
    MHA实现mysql高可用复制集群
    mysqldump备份与基于bin-log实现完全恢复
    MySQL的日志相关内容
    MySQL(mariadb)主从复制模式与复制过滤
    MySQL(mariadb)多实例应用与多实例主从复制
    DNS的主从,转发与负载功能
    Spring 自动代理
    Jquery Validate 使用记坑
    动态代理
  • 原文地址:https://www.cnblogs.com/loaderman/p/11344629.html
Copyright © 2020-2023  润新知