tw_step_counter 0.1.4 copy "tw_step_counter: ^0.1.4" to clipboard
tw_step_counter: ^0.1.4 copied to clipboard

outdated

This is a simple step caculator widget.

example/lib/main.dart

/*
 * @Author: zhengzeqin
 * @Date: 2022-07-17 22:49:40
 * @LastEditTime: 2022-08-01 11:31:43
 * @Description: your project
 */
import 'package:flutter/material.dart';
import 'package:flutter_keyboard_visibility/flutter_keyboard_visibility.dart';
import 'package:tw_step_counter/tw_colors.dart';
import 'package:tw_step_counter/tw_step_counter.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final controller = TWStepCounterController();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: KeyboardDismissOnTap(
        child: Scaffold(
          appBar: AppBar(
            title: const Text('example app'),
          ),
          body: Center(
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              children: [
                TextButton(
                  child: const Text('失去焦点'),
                  onPressed: () {
                    controller.unFocus();
                  },
                ),
                TextButton(
                  child: const Text('获取焦点'),
                  onPressed: () {
                    controller.getFocus();
                  },
                ),
                TextButton(
                  child: const Text('是否输入'),
                  onPressed: () {
                    print('最后是否输入 ${controller.isInputModify}');
                  },
                ),
                SizedBox(
                  width: 300,
                  child: TWStepCounter(
                    unit: '元/天',
                    currentValue: 130,
                    mixValue: 75,
                    maxValue: 250,
                    onTap: (value) {
                      print('点击回调===>$value');
                    },
                    inputTap: (value) {
                      print('输入回调===>$value');
                    },
                    controller: controller,
                    defaultColor: TWColors.tw999999,
                    highlightColor: Colors.yellow,
                    borderLineColor: Colors.red,
                    inputMultipleValue: 5,
                    // height: 70,
                    // isUpdateInLimitValue: false,
                    // isSupportAnimation: false,
                    // decimal: true,
                    // decimalsCount: 2,
                    valuePadding: const EdgeInsets.only(
                      left: 10,
                      right: 10,
                    ),
                  ),
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
0
likes
0
points
1
downloads

Publisher

unverified uploader

Weekly Downloads

This is a simple step caculator widget.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on tw_step_counter

Packages that implement tw_step_counter