Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add showWeekText option #14

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart';
|borderRadius|`double?`|`5`|Border radius value of block.|
|scrollable|`bool`|`false`|Make `HeatMap` scrollable if `scrollable` is `true`.|
|showText|`bool?`|`false`|Show day text in every block if `showText` is `true`.|
|showWeekText|`bool?`|`true`|Show week label to left side of heatmap if `showWeekText` is `true`.|
|showColorTip|`bool?`|`true`|Show color tip if `showColorTip` is `true`.|
|colorTipHelper|`List<Widget?>?`|`null`|Widgets which are shown at left and right side of `colorTip`.<br>First value is the left side widget and second value is the right side widget.<br>Give null value makes default 'less' and 'more' text.|
|colorTipCount|`int?`|`7`|Length of `colorTip` block.|
Expand Down
7 changes: 7 additions & 0 deletions lib/src/heatmap.dart
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ class HeatMap extends StatefulWidget {
/// Default value is false.
final bool? showText;

/// Show week labels to left side of heatmap if the value is true.
///
/// Default value is true.
final bool? showWeekText;

/// Show color tip which represents the color range at the below.
///
/// Default value is true.
Expand Down Expand Up @@ -102,6 +107,7 @@ class HeatMap extends StatefulWidget {
this.datasets,
this.defaultColor,
this.showText = false,
this.showWeekText = true,
this.showColorTip = true,
this.scrollable = false,
this.colorTipHelper,
Expand Down Expand Up @@ -146,6 +152,7 @@ class _HeatMap extends State<HeatMap> {
onClick: widget.onClick,
margin: widget.margin,
showText: widget.showText,
showWeekText: widget.showWeekText,
)),

// Show HeatMapColorTip if showColorTip is true.
Expand Down
5 changes: 4 additions & 1 deletion lib/src/widget/heatmap_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ class HeatMapPage extends StatelessWidget {

final bool? showText;

final bool? showWeekText;

HeatMapPage({
Key? key,
required this.colorMode,
Expand All @@ -90,6 +92,7 @@ class HeatMapPage extends StatelessWidget {
this.onClick,
this.margin,
this.showText,
this.showWeekText,
}) : _dateDifferent = endDate.difference(startDate).inDays,
maxValue = DatasetsUtil.getMaxValue(datasets),
super(key: key);
Expand Down Expand Up @@ -147,7 +150,7 @@ class HeatMapPage extends StatelessWidget {
mainAxisSize: MainAxisSize.min,
children: [
// Show week labels to left side of heatmap.
HeatMapWeekText(
if (showWeekText ?? true) HeatMapWeekText(
margin: margin,
fontSize: fontSize,
size: size,
Expand Down