nepali_month_year_picker 0.0.4+4 nepali_month_year_picker: ^0.0.4+4 copied to clipboard
The month year picker inspired by the Flutter's date picker design.
Material Nepali Month/Year Picker #
The Nepali month year picker inspired by the month year picker by zulfahmi.dev
. It is a month year picker for the Nepali calendar with the help of nepali_utils
.
Quick Start #
-
Open your
pubspec.yaml
file and add this entry:nepali_month_year_picker: ^0.0.4+4
OR just run
flutter pub add nepali_month_year_picker
using your preferred terminal app. -
Then run
flutter pub get
. -
Import this library into your code:
import 'package:nepali_month_year_picker/nepali_month_year_picker.dart';
Additionally, ensure your MaterialApp refers to the following
localizationsDelegates
:GlobalMaterialLocalizations.delegate, MonthYearPickerLocalizations.delegate,
-
Usage in code:
final selected = await showNepaliMonthYearPicker( context: context, initialDate: NepaliDateTime.now(), firstDate: NepaliDateTime(2019), lastDate: NepaliDateTime(2023), );
Parameters #
Parameter | Description |
---|---|
context |
Must not be null . Will be passed to the internal showDialog function call. |
initialDate |
Must not be null and must fall between the firstDate and lastDate . The initialDate will be truncated to its year and month components. When the month/year picker is first displayed, it will show the month/year of the initialDate , with initialDate selected. |
firstDate |
Must not be null . The firstDate will be truncated to its year and month components. This is the earliest allowable month/year. |
lastDate |
Must not be null . The lastDate will be truncated to its year and month components. This is the latest allowable month/year. |
selectableMonthYearPredicate |
Can be null . The function to provide full control over which month/year can be selected. If provided, only the month/year that the selectableMonthYearPredicate returns true for will be selectable. |
locale |
Can be null . If provided, will be used to set the locale for the month/year picker. Otherwise, it defaults to the ambient locale provided by Localizations . Can only be set to en as default and ne for Nepali |
useRootNavigator |
Can be null . Will be passed to the internal showDialog function call. |
routeSettings |
Can be null . Will be passed to the internal showDialog function call. |
textDirection |
Can be null . If provided, will be used to set the text direction for the month/year picker. Otherwise, it defaults to the ambient locale provided by Directionality . |
builder |
Can be null . This parameter can be used to wrap the dialog widget with a parent widget. |
initialMonthYearPickerMode |
Must not be null . Can be used to have the year picker initially appear in the MonthYearPickerMode.year mode. It defaults to the MonthYearPickerMode.month mode. |
themedata |
Can be null .Themedata when not provided it will take the system themedata but to change the colors and more themes of the dialog the themedata can be updated most commonly updated theme parametes are iconbuttontheme, textbuttontheme and colorscheme for the selected and unselected grid items. |
Example Demo #
Screenshots #
Mode | Screenshot |
---|---|
MonthYear picker in portrait mode with default locale. | |
MonthYear picker in portrait mode with Nepali locale. | |
MonthYear picker in Landscape mode . |
Building From Source #
Dependencies #
- Dart SDK version 3.0.0 or newer.
- Flutter SDK version 3.10 or newer.
Steps #
- Clone this git repo into your machine.
- Run
.\gen_l10n.ps1
to re-generate the localised strings.
Features and Bugs #
Please file feature requests and bugs at the issue tracker.
License #
This project is licensed under the MIT License - see the LICENSE file for details.