The calendar supports swipe gestures on mobile platforms, allowing users to navigate between pages by swiping left or right.
A FCalendarController
controls the date selection behavior, including single date, multiple dates, and date range selection.
FCalendar and all FCalendarControllers return DateTimes in UTC timezone, truncated to the nearest day.
Hold Shift while scrolling to navigate through dates on desktop and web.
1@override2Widget build(BuildContext _) => FCalendar(3 control: .managedDate(),4 start: DateTime(2000),5 end: DateTime(2040),6);7CLI
To generate and customize this style:
dart run forui style create calendarUsage
FCalendar(...)
1FCalendar(2 style: const .delta(padding: .zero),3 start: .utc(1900),4 end: .utc(2100),5 today: .now(),6 initialMonth: .now(),7 initialType: .day,8)Examples
Single Date
1@override2Widget build(BuildContext _) => FCalendar(3 control: .managedDate(),4 start: DateTime(2000),5 end: DateTime(2040),6);7Multiple Dates with Initial Selections
1@override2Widget build(BuildContext _) => FCalendar(3 control: .managedDates(4 initial: {DateTime(2024, 7, 17), DateTime(2024, 7, 20)},5 ),6 start: DateTime(2000),7 today: DateTime(2024, 7, 15),8 end: DateTime(2030),9);10Unselectable Dates
1@override2Widget build(BuildContext _) => FCalendar(3 control: .managedDates(4 initial: {DateTime(2024, 7, 17), DateTime(2024, 7, 20)},5 selectable: (date) =>6 !{DateTime.utc(2024, 7, 18), DateTime.utc(2024, 7, 19)}.contains(date),7 ),8 start: DateTime(2000),9 today: DateTime(2024, 7, 15),10 end: DateTime(2030),11);12Range Selection with Initial Range
1@override2Widget build(BuildContext _) => FCalendar(3 control: .managedRange(4 initial: (DateTime(2024, 7, 17), DateTime(2024, 7, 20)),5 ),6 start: DateTime(2000),7 today: DateTime(2024, 7, 15),8 end: DateTime(2030),9);10Badge
A badge draws attention to specific information, such as labels and counts. Use badges to display status, notifications, or small pieces of information that need to stand out.
Card
A flexible container component that displays content with an optional title, subtitle, and child widget. Cards are commonly used to group related information and actions.