flutter_month_select 0.0.1 copy "flutter_month_select: ^0.0.1" to clipboard
flutter_month_select: ^0.0.1 copied to clipboard

A package flutter_month_select helps to select month of the year easily in android and ios.

example/lib/main.dart

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

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

/// this is the example for select month picker
/// press bottom button for open month select dialogue box
class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

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

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

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,
        title: Text(widget.title),
      ),

      floatingActionButton: FloatingActionButton(
        onPressed: () async {
          /// this method we can use for month select
          DateTime? picker = await showMonthYearPicker(
              context: context,
              initialDate: DateTime(2023),
              firstDate: DateTime(2022),
              lastDate: DateTime.now());

          /// we can get the selected month in picker
          /// note picker can be nullable
        },
        tooltip: 'Increment',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
1
likes
140
pub points
30%
popularity

Publisher

verified publisherwhiteorangesoftware.com

A package flutter_month_select helps to select month of the year easily in android and ios.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, intl

More

Packages that depend on flutter_month_select