### NumberPicker Flutter Example App Source: https://pub.dev/packages/numberpicker/example This is the main entry point for the NumberPicker example application. It sets up the MaterialApp and navigates to the MyHomePage. ```dart import 'package:flutter/material.dart'; import 'package:numberpicker/numberpicker.dart'; void main() { runApp(new ExampleApp()); } class ExampleApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( title: 'NumberPicker Example', theme: ThemeData( primarySwatch: Colors.blue, ), home: MyHomePage(), ); } } ``` -------------------------------- ### Integer NumberPicker Example Source: https://pub.dev/packages/numberpicker/example Demonstrates the default vertical NumberPicker for integers. Includes buttons to manually adjust the value. ```dart class _IntegerExample extends StatefulWidget { @override __IntegerExampleState createState() => __IntegerExampleState(); } class __IntegerExampleState extends State<_IntegerExample> { int _currentIntValue = 10; int _currentHorizontalIntValue = 10; @override Widget build(BuildContext context) { return Column( children: [ SizedBox(height: 16), Text('Default', style: Theme.of(context).textTheme.headline6), NumberPicker( value: _currentIntValue, minValue: 0, maxValue: 100, step: 10, haptics: true, onChanged: (value) => setState(() => _currentIntValue = value), ), SizedBox(height: 32), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( icon: Icon(Icons.remove), onPressed: () => setState(() { final newValue = _currentIntValue - 10; _currentIntValue = newValue.clamp(0, 100); }), ), Text('Current int value: $_currentIntValue'), IconButton( icon: Icon(Icons.add), onPressed: () => setState(() { final newValue = _currentIntValue + 20; _currentIntValue = newValue.clamp(0, 100); }), ), ], ), Divider(color: Colors.grey, height: 32), SizedBox(height: 16), Text('Horizontal', style: Theme.of(context).textTheme.headline6), NumberPicker( value: _currentHorizontalIntValue, minValue: 0, maxValue: 100, step: 10, itemHeight: 100, axis: Axis.horizontal, onChanged: (value) => setState(() => _currentHorizontalIntValue = value), decoration: BoxDecoration( borderRadius: BorderRadius.circular(16), border: Border.all(color: Colors.black26), ), ), Row( mainAxisAlignment: MainAxisAlignment.center, children: [ IconButton( icon: Icon(Icons.remove), onPressed: () => setState(() { final newValue = _currentHorizontalIntValue - 10; _currentHorizontalIntValue = newValue.clamp(0, 100); }), ), Text('Current horizontal int value: $_currentHorizontalIntValue'), IconButton( icon: Icon(Icons.add), onPressed: () => setState(() { final newValue = _currentHorizontalIntValue + 20; _currentHorizontalIntValue = newValue.clamp(0, 100); }), ), ], ), ], ); } } ``` -------------------------------- ### Decimal NumberPicker Example Source: https://pub.dev/packages/numberpicker/example Demonstrates the DecimalNumberPicker for selecting floating-point values with a specified number of decimal places. ```dart class _DecimalExample extends StatefulWidget { @override __DecimalExampleState createState() => __DecimalExampleState(); } class __DecimalExampleState extends State<_DecimalExample> { double _currentDoubleValue = 3.0; @override Widget build(BuildContext context) { return Column( children: [ SizedBox(height: 16), Text('Decimal', style: Theme.of(context).textTheme.headline6), DecimalNumberPicker( value: _currentDoubleValue, minValue: 0, maxValue: 10, decimalPlaces: 2, onChanged: (value) => setState(() => _currentDoubleValue = value), ), SizedBox(height: 32), ], ); } } ``` -------------------------------- ### Integer NumberPicker Example Source: https://pub.dev/packages/numberpicker Demonstrates how to use the NumberPicker widget to select an integer value within a specified range. The selected value is displayed below the picker. ```dart class _IntegerExample extends StatefulWidget { @override __IntegerExampleState createState() => __IntegerExampleState(); } class __IntegerExampleState extends State<_IntegerExample> { int _currentValue = 3; @override Widget build(BuildContext context) { return Column( children: [ NumberPicker( value: _currentValue, minValue: 0, maxValue: 100, onChanged: (value) => setState(() => _currentValue = value), ), Text('Current value: $_currentValue'), ], ); } } ``` -------------------------------- ### NumberPicker Main Page with Tabs Source: https://pub.dev/packages/numberpicker/example The MyHomePage widget sets up a Scaffold with an AppBar and TabBarView to switch between Integer and Decimal examples. ```dart class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => new _MyHomePageState(); } class _MyHomePageState extends State { @override Widget build(BuildContext context) { return DefaultTabController( length: 2, child: Scaffold( appBar: AppBar( bottom: TabBar( tabs: [ Tab(text: 'Integer'), Tab(text: 'Decimal'), ], ), title: Text('Numberpicker example'), ), body: TabBarView( children: [ _IntegerExample(), _DecimalExample(), ], ), ), ); } } ``` -------------------------------- ### Add NumberPicker Dependency to Flutter Project Source: https://pub.dev/packages/numberpicker/install Run this command in your terminal to add the numberpicker package to your Flutter project's dependencies. This command also implicitly runs 'flutter pub get'. ```bash flutter pub add numberpicker ``` -------------------------------- ### Import NumberPicker Package in Dart Code Source: https://pub.dev/packages/numberpicker/install Use this import statement in your Dart files to access the NumberPicker widget and its functionalities. ```dart import 'package:numberpicker/numberpicker.dart'; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.