input_quantity 1.0.0 copy "input_quantity: ^1.0.0" to clipboard
input_quantity: ^1.0.0 copied to clipboard

outdated

A widget to input quantity. Built with TextFormField. Type manually or increase and decrease value with the btn

example/lib/main.dart

import 'package:example/potatoo.dart';
import 'package:flutter/material.dart';
import 'package:input_quantity/input_quantity.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 Example',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: const MyHomePage(title: 'Input Quantity'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({Key? key, required this.title}) : super(key: key);
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(18.0),
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              /// Input quantity widget
              InputQty(
                maxVal: 100,
                initVal: 0.0,
                steps: 10,
                minVal: -100,
                onQtyChanged: (val) {
                  print(val);
                },
              ),
              const SizedBox(
                height: 30,
              ),
              TextButton(
                  onPressed: () {
                    Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => const PreviewExample()));
                  },
                  child: const Text('Preview'))
            ],
          ),
        ),
      ),
    );
  }
}
68
likes
0
points
5.19k
downloads

Publisher

verified publisherpmatatias.dev

Weekly Downloads

A widget to input quantity. Built with TextFormField. Type manually or increase and decrease value with the btn

Homepage
Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on input_quantity