Flutter widget form select a date in horizontal timeline with customizable styles.

Overview

header.jpg

Flutter widget form select a date in horizontal timeline with customizable styles.

Getting Started

You can use this package when you need to add a date picker that takes up little screen space, so we can always have it visible, and that facilitates use with one hand.

example.gif

Properties

Property Type Description
initialDate DateTime Initial date selected
firstDate DateTime First date available in calendar
lastDate DateTime Last date available in calendar
selectableDayPredicate SelectableDayPredicate Signature for predicating dates for enabled date selections
onDateSelected OnDateSelected Callback to notify that a date has been selected
leftMargin double Left margin to month and day list
monthColor Color Color for month list elements
dayColor Color Color for day list elements
activeDayColor Color Color for selected day text
activeBackgroundDayColor Color Color for selected day background
dotColor Color Color for top dots in select day
locale String Locale string to get formatted date
showYears bool Indicates if it show year selector

Use example

You can review the example folder for a complete example of using the widget.

CalendarTimeline(
  initialDate: DateTime(2020, 4, 20),
  firstDate: DateTime(2019, 1, 15),
  lastDate: DateTime(2020, 11, 20),
  onDateSelected: (date) => print(date),
  leftMargin: 20,
  monthColor: Colors.blueGrey,
  dayColor: Colors.teal[200],
  activeDayColor: Colors.white,
  activeBackgroundDayColor: Colors.redAccent[100],
  dotsColor: Color(0xFF333A47),
  selectableDayPredicate: (date) => date.day != 23,
  locale: 'en_ISO',
)
Comments
  • Widget isn't visible in Release mode build

    Widget isn't visible in Release mode build

    This widget isn't visible when I tried to run in release mode, all I get is below message in output window.

    I/flutter (19247): Unsupported operation: Infinity or NaN toInt I/flutter (19247): #0 State.widget (package:flutter/src/widgets/framework.dart) I/flutter (19247): #1 _PositionedListState._schedulePositionNotificationUpdate. (package:scrollable_positioned_list/src/positioned_list.dart:348) I/flutter (19247): #2 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1145) I/flutter (19247): #3 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1090) I/flutter (19247): #4 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:863) I/flutter (19247): #12 TickerFuture.whenCompleteOrCancel.thunk (package:flutter/src/scheduler/ticker.dart:407) I/flutter (19247): (elided 10 frames from class _RawReceivePortImpl, class _Timer, and dart:async) I/flutter (19247): Another exception was thrown: Instance of 'DiagnosticsProperty' I/flutter (19247): Another exception was thrown: Instance of 'DiagnosticsProperty'

    This seems to be the case even with Example code at https://pub.dev/packages/calendar_timeline/example.

    Debug mode works fine without any issues. Any help would be highly appreciated. thanks.

    bug 
    opened by nammaapp 7
  • improvements

    improvements

    Trying to enhance user experience, I updated the way dates are selected.

    Currently a user must select the day last for the "selectedDate" to change. But I've seen that a lot of the times, the user selects the day first and then the month or year, and changes multiple times. And until he selects the day, the new date is not selected. I believe that it is more intuitive that the state of the day or month stays the same, if posible, through the changes. So now:

    -If a user selects a day, and then the month. In the new month the preselected day will be chosen.

    EXAMPLE: User selects the 29th of jan. Then changes to March, the 29th of March is selected. In the case that the selected month doesn't have that date available(Feb, for example), it will select the first available date of the month. If no day is available, It will keep the previously selected date and fire the function "OnNoAvailableDate", so the developer can choose how to let the user Know that there are no available dates on that month and the last selected date is the current one.

    I also added lints to encourage good coding practices and easier development.

    Hope It helps as always!, Love this Package ;)

    opened by Flucadetena 4
  • Locale data has not been initialized, call initializeDateFormatting(<locale>).

    Locale data has not been initialized, call initializeDateFormatting().

    Hi, since version 1.0.2-null-safety.0 I'm facing the following exception.

    ════════ Exception caught by widgets library ═══════════════════════════════════ The following LocaleDataException was thrown building: Locale data has not been initialized, call initializeDateFormatting().

    import 'package:calendar_timeline/calendar_timeline.dart';
    import 'package:flutter/material.dart';
    
    class DatePick extends StatefulWidget {
      DatePick({Key? key, required this.date, required this.onChange})
          : super(key: key);
      final DateTime date;
      final Function(DateTime?) onChange;
    
      @override
      _DatePickState createState() => _DatePickState();
    }
    
    class _DatePickState extends State<DatePick> {
      @override
      Widget build(BuildContext context) {
        DateTime currentDate = DateTime.now();
        return CalendarTimeline(
          initialDate: widget.date,
          firstDate: (currentDate).subtract(Duration(days: 21)),
          lastDate: currentDate.add(Duration(days: 21)),
          onDateSelected: widget.onChange,
          leftMargin: 20,
          monthColor: Colors.blueGrey,
          dayColor: Colors.black87,
          activeDayColor: Colors.white,
          activeBackgroundDayColor: Colors.black87,
          dotsColor: Color(0xFF333A47),
          locale: 'de',
        );
      }
    }
    
    bug 
    opened by jnelle 3
  • Lost initialDate

    Lost initialDate

    First, i would like to congratulate you for this package, it's awesome.

    When the calendar starts with an initial date, is ok.

    when I browse for another month and return to the current date it is no longer selected. this happens with the example.

    Tanks, and sorry for my limit english.

    bug 
    opened by Freyien 3
  • DateTime.now issue

    DateTime.now issue

    If you use DateTime.now() for the date fields such as initialDate, when the calendar reloads it does not keep the currently selected date. I'm guessing it is using the time for the DateTime and not just the date portion.

    bug 
    opened by OpticNectar 3
  • Does not work with Flutter 2.0 (Cannot run with sound null safety)

    Does not work with Flutter 2.0 (Cannot run with sound null safety)

    The following error pops up when trying to run using Flutter 2.0

    Error: Cannot run with sound null safety, because the following dependencies
    don't support null safety:
    
     - package:calendar_timeline
     - package:scrollable_positioned_list
    
    For solutions, see https://dart.dev/go/unsound-null-safety
    
    opened by alisolanki 2
  • Added option to see years individualy

    Added option to see years individualy

    Added the possibility to see the years as an individual row. Simplifying the use for the users when a wide range of dates is available.

    Tried to maintain the same aesthetics of the calendar. To use simply pass the [showYears] parameter as true.

    Also added comments to help others understand better the inner works of the package and help in its development.

    Love the package, great work. Hope you like it and merge it into master.

    opened by Flucadetena 2
  • Changing/Resetting the initial date does not return the view to the appropriate date

    Changing/Resetting the initial date does not return the view to the appropriate date

    Using the example, I have set the first day as now() and the last date as 6 months from now. If I scroll right towards the end of the month and press RESET in the example code, the Calendar only scrolls a little bit to the left, not the entire way to the initial date as it was supposed to be. You must press the button several times for it to go back to the initial date.

    By the way, great job guys!

    Edit: I must hot reload when changing start dates, otherwise the reset button will go crazy. Not sure that's intended, but it's how it behaves apparently.

    bug 
    opened by wsegatto 2
  • ci: integrate a CI system and fix some linter rules

    ci: integrate a CI system and fix some linter rules

    As discussed previously, here is my contribution that introduces a continuous integration system using GitHub Actions. It uses two workflows created for Flutter based on the ones from Very Good Ventures. I've also added the linter rules that they maintain and fix some code smells that appeared based on those.

    Feel free to ping me to change anything or if you prefer a completely different approach. Hopefully this will help the package to maintain its quality over time as new contributors chime in.

    opened by pablojimpas 1
  • Minor fix for the new `shrink` API

    Minor fix for the new `shrink` API

    PR #47 introduced a new variable to tweak the space that widgets took in the screen. In some widgets it was done as an optional parameter and disabled by default, however, in another ones it was made required without any particular reason, effectively breaking the API of this package without the corresponding major version bump. The change left the tests of this package failing without even compiling and potentially broke builds from application developers using this package.

    To avoid a major version bump, this PR homogenizes the behavior of this new variable to the more sane default of making it optional. Also fixes some collateral side effects introduced in #47 like a change in a FontWeight and a height that broke a lot of tests.

    To avoid this kind of mistakes in the future, I suggest setting up some kind of CI system that runs automated tests & lints. I can make a contribution with that improvement if you want.

    opened by pablojimpas 1
  • Getting Warning after Flutter 3 Upgrade 🪲

    Getting Warning after Flutter 3 Upgrade 🪲

    I am getting below warning message 👉

    Warning: Operand of null-aware operation '!' has type 'SchedulerBinding' which excludes null

    • 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/Users/sinno/flutter/packages/flutter/lib/src/scheduler/binding.dart'). package:flutter/…/scheduler/binding.dart:1 SchedulerBinding.instance!.addPostFrameCallback((_) {
    opened by sinnoorc 1
  • Stop scrolling at last day

    Stop scrolling at last day

    Is there a way to have the calendar stop at the last day available? If I only have 7 days enabled for example it allows the user to scroll past the last day and they just see nothing.

    enhancement 
    opened by SM2DevLLC 2
Owner
Jose Manuel Márquez
Ingeniero de software especializado en diseño y desarrollo de aplicaciones móviles nativas con Flutter.
Jose Manuel Márquez
A multi select form field using alert dialog to select multiple items with checkboxes and showing as chips.

A multi select form field using alert dialog to select multiple items with checkboxes and showing as chips.

Carlos Eugenio Torres 73 Sep 7, 2022
A Flutter widget to show a text form field to display a date or clock dialog

A Flutter widget to show a text form field to display a date or clock dialog. This widget extend TextField and has a similar behavior as TextFormField.

m3uzz Soluções em TI 82 Jan 6, 2023
Multi select flutter tejpal - A package for creating multi-select widgets in a variety of ways

Multi select flutter tejpal - A package for creating multi-select widgets in a variety of ways

Tejpal Singh 3 Jul 11, 2022
A Flutter Widget to make interactive timeline widget.

Bubble Timeline Package A Flutter Widget to make interactive timeline widget. This widget can be used to make Event Timelines, or Timelines for certai

Vansh Goel 12 Sep 22, 2022
SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page

SmartSelect allows you to easily convert your usual form select or dropdown into dynamic page, popup dialog, or sliding bottom sheet with various choices input such as radio, checkbox, switch, chips, or even custom input. Supports single and multiple choice.

Irfan Vigma Taufik 332 Dec 20, 2022
Making-form - A form design with dart programming and auto next facility

Making-form - A form design with dart programming and auto next facility

Munem Sarker 3 Nov 15, 2022
⌚️ A general flutter timeline widget based on real-world application references

framework platform tags title flutter Android, iOS, Web, macOS, Linux, Windows flutter, timeline, flutter timeline, timeline tile flutter timeline flu

Universe 285 Dec 21, 2022
Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically.

Flutter package: Define a theme (colors, text styles etc.) as static const values which can be changed dynamically. Also comes with useful extensions to create text styles by composition.

Marcelo Glasberg 21 Jan 2, 2023
A widget to provides horizontal or vertical multiple split view for Flutter.

Multi split view A widget to provides horizontal or vertical multiple split view for Flutter. Horizontal or vertical Configurable weight or size for e

Carlos Eduardo Leite de Andrade 63 Dec 28, 2022
A Flutter Widget that create a horizontal table with fixed column on left hand side.

horizontal_data_table A Flutter Widget that create a horizontal table with fixed column on left hand side. Installation This package is starting to su

May Lau 204 Dec 27, 2022
Displays a scrollable timeline with custom child widgets and custom icons.

Flutter Timeline Widget Displays a scrollable timeline with custom child widgets and custom icons. Installation In your pubspec.yaml file within your

Furkan Tektas 375 Nov 20, 2022
Horizontal_calendar - Horizontal week view calendar pub for Flutter.

horizontal_calendar Easy to use, highly customizable horizontal calendar. Features Custom date range (First & Last Date) Single or up to x days select

SoluteLabs 74 Dec 19, 2022
A dart package to display a horizontal bar of customisable toggle tabs. Supports iOS and Android.

toggle_bar A dart package to display a horizontal bar of customisable toggle tabs. Supports iOS and Android. Installation Depend on it. dependencies:

Prem Adithya 9 Jul 13, 2022
A simple Flutter widget library that helps us to select days in a week.

A simple Flutter widget library that helps us to select days in a week.

Shan Shaji 4 Oct 9, 2022
📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget.

?? Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.

Blue Fire 1.7k Jan 7, 2023
A flutter package to select a country from a list of countries.

Country picker A flutter package to select a country from a list of countries. Getting Started Add the package to your pubspec.yaml: country_picker: ^

Daniel Ioannou 60 Dec 30, 2022
Cupertino buttons which are used as radio buttons in order to select one value

Flutter Cupertino Radio Choice Cupertino buttons which are used as radio buttons in order to select one value. Tutorial A complete tutorial how to use

Christoph Rothermel 4 Sep 18, 2022
A custom dropdown button lets the user select from a number of items

CircularDropDownMenu Description A custom dropdown button lets the user select from a number of items. The button shows the currently selected item as

Surya Dev Singh 2 Dec 5, 2020
A light-weight Emoji 📦 for Dart & Flutter with all up-to-date emojis written in pure Dart 😄 . Made from 💯% ☕ with ❤️!

dart_emoji ?? A light-weight Emoji ?? for Dart & Flutter with all up-to-date emojis written in pure Dart ?? . Made from ?? % ☕ with ❤️ ! This is a for

Gatch 18 Mar 22, 2022