number_ticker 0.0.2+1 copy "number_ticker: ^0.0.2+1" to clipboard
number_ticker: ^0.0.2+1 copied to clipboard

Number_ticker provides a simple number ticker for displaying a changing number. You can use it to display the number that updates in real time for better user experience.

example/main.dart

import 'package:flutter/material.dart';
import 'package:number_ticker/number_ticker.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: const MyHomePage(),
    );
  }
}

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

  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final controller = NumberTickerController();
  final controller1 = NumberTickerController();

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // 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("Number Ticker Demo"),
      ),
      body: ListView(
        children: [
          NumberTicker(
            controller: controller1,
            initialNumber: 123,
            textStyle: const TextStyle(fontSize: 24),
          ),
          Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              ElevatedButton(
                onPressed: () {
                  controller1.number = controller1.number - 1;
                },
                child: const Text('-'),
              ),
              ElevatedButton(
                onPressed: () {
                  controller1.number = controller1.number + 1;
                },
                child: const Text('+'),
              ),
              ElevatedButton(
                onPressed: () {
                  controller1.number = controller1.number - 10;
                },
                child: const Text('- 10'),
              ),
              ElevatedButton(
                onPressed: () {
                  controller1.number = controller1.number + 10;
                },
                child: const Text('+ 10'),
              ),
            ],
          ),
        ],
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
13
likes
130
pub points
73%
popularity

Publisher

unverified uploader

Number_ticker provides a simple number ticker for displaying a changing number. You can use it to display the number that updates in real time for better user experience.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on number_ticker