simple_heatmap_calendar 0.5.0
simple_heatmap_calendar: ^0.5.0 copied to clipboard
A powerful and easy-to-use Flutter heatmap calendar package which supports internationalization, UTC time zone, and offers rich and adjustable options.
Simple Heatmap Calendar #

Powerful and easy-to-use heatmap flutter chart package.
Features #
- customizable localized labels without a direct
intldependency. - various configuration choices.
- has better performance when dealing with a large time span on the calendar.
See the runnable example to explore the available options.
Example gallery #
Material 3, light/dark appearance, and live configuration:

Tap to add activity, or long press to edit a day:

Requirements #
Requires Flutter 3.47.0 / Dart 3.13 or newer.
Material components use material_ui; host UI and themes must use the same
standalone package. See Flutter's migration guide.
Getting started #
Add dependency with flutter pub add command #
flutter pub add simple_heatmap_calendar
Or Add below line to pubspec.yaml #
dependencies:
...
simple_heatmap_calendar: any # or special version
Then run flutter pub get
Development #
Development and CI use Flutter 3.47.9, pinned in .fvmrc.
fvm install
make check
Use make help for other commands. See the example guide
for run and build commands.
Usage #
import 'package:material_ui/material_ui.dart';
import 'package:simple_heatmap_calendar/simple_heatmap_calendar.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@override
State<StatefulWidget> createState() => _HomePage();
}
class _HomePage extends State<HomePage> {
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
return Scaffold(
appBar: AppBar(title: const Text("Simple Heatmap Calendar")),
body: Card(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: HeatmapCalendar<num>(
startDate: DateTime(2020, 1, 1),
endedDate: DateTime(2025, 12, 31),
colorMap: {
10: theme.primaryColor.withValues(alpha: 0.2),
20: theme.primaryColor.withValues(alpha: 0.4),
30: theme.primaryColor.withValues(alpha: 0.6),
40: theme.primaryColor.withValues(alpha: 0.8),
50: theme.primaryColor,
},
selectedMap: {
DateTime(2025, 12, 31): 10,
DateTime(2025, 12, 30): 20,
DateTime(2025, 12, 29): 30,
DateTime(2025, 12, 28): 40,
DateTime(2025, 12, 26): 50,
DateTime(2025, 12, 22): 60,
DateTime(2025, 12, 12): 999,
DateTime(2025, 12, 1): 0,
DateTime(2025, 11, 23): 12,
DateTime(2025, 12, 16): 34,
DateTime(2025, 12, 15): 45,
DateTime(2025, 12, 12): 89,
DateTime(2020, 1, 16): 34,
DateTime(2020, 1, 15): 45,
DateTime(2020, 1, 12): 89,
},
cellSize: const Size.square(16.0),
colorTipCellSize: const Size.square(12.0),
style: const HeatmapCalendarStyle.defaults(
cellValueFontSize: 6.0,
cellRadius: BorderRadius.all(Radius.circular(4.0)),
weekLabelValueFontSize: 12.0,
monthLabelFontSize: 12.0,
),
layoutParameters: const HeatmapLayoutParameters.defaults(
monthLabelPosition: CalendarMonthLabelPosition.top,
weekLabelPosition: CalendarWeekLabelPosition.right,
colorTipPosition: CalendarColorTipPosition.bottom,
),
),
),
),
);
}
}
Localized labels #
Labels default to English. Formatters receive the calendar's locale or follow
the app locale. For localization with an app-owned intl dependency:
import 'package:intl/intl.dart'; // Add intl to the app's dependencies.
HeatmapCalendar<num>(
startDate: DateTime(2023, 1, 1),
endedDate: DateTime(2023, 12, 31),
weekLabelFormatter: (date, locale) =>
DateFormat('ccccc', locale.toString()).format(date),
monthLabelFormatter: (date, locale, {required showYear}) =>
DateFormat(showYear ? 'yMMM' : 'MMM', locale.toString()).format(date),
layoutParameters: const HeatmapLayoutParameters.defaults(
monthLabelPosition: CalendarMonthLabelPosition.top,
weekLabelPosition: CalendarWeekLabelPosition.left,
),
)
Initialize locale data through app delegates or initializeDateFormatting.
Other formatting libraries or app translations also work. material_ui still
depends on intl; this package adds no direct version constraint.
Migration #
weekLabelValueBuilderandmonthLabelItemBuildernow receive(context, date, defaultText): formatted text replaces the date pattern.MonthLabelItem.format→label(text);MonthLabelRow.getFormatandWeekLabelColumn.format→formatter(callbacks shown above).- Both row/column widgets accept
locale.MonthLabelRownow defaults to English month abbreviations and shows the year in January unlessshowYearOnMonthLabelis false. - Remove
defaultWeekLabelDateFormatterandWeekLabelItem.dateFormatter; the week builder receivesvalueas its default text.
Donate #
License #
MIT License
Copyright (c) 2023 Fries_I23
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.