From 9199b878871a07ff7e85631ae8d734b9a7087be4 Mon Sep 17 00:00:00 2001 From: kosa3 Date: Sat, 17 Dec 2022 15:01:16 +0900 Subject: [PATCH 1/2] feat: add showWeekText property --- README.md | 1 + lib/src/heatmap.dart | 7 +++++++ lib/src/widget/heatmap_page.dart | 5 ++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cb85871..e761e8c 100644 --- a/README.md +++ b/README.md @@ -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 `showText` is `true`.| |showColorTip|`bool?`|`true`|Show color tip if `showColorTip` is `true`.| |colorTipHelper|`List?`|`null`|Widgets which are shown at left and right side of `colorTip`.
First value is the left side widget and second value is the right side widget.
Give null value makes default 'less' and 'more' text.| |colorTipCount|`int?`|`7`|Length of `colorTip` block.| diff --git a/lib/src/heatmap.dart b/lib/src/heatmap.dart index e884860..24f68fe 100644 --- a/lib/src/heatmap.dart +++ b/lib/src/heatmap.dart @@ -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. @@ -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, @@ -146,6 +152,7 @@ class _HeatMap extends State { onClick: widget.onClick, margin: widget.margin, showText: widget.showText, + showWeekText: widget.showWeekText, )), // Show HeatMapColorTip if showColorTip is true. diff --git a/lib/src/widget/heatmap_page.dart b/lib/src/widget/heatmap_page.dart index e1c2984..ffafea3 100644 --- a/lib/src/widget/heatmap_page.dart +++ b/lib/src/widget/heatmap_page.dart @@ -75,6 +75,8 @@ class HeatMapPage extends StatelessWidget { final bool? showText; + final bool? showWeekText; + HeatMapPage({ Key? key, required this.colorMode, @@ -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); @@ -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, From 26addf9df87958e41dde6566d3f8c3211df48fc6 Mon Sep 17 00:00:00 2001 From: kosa3 Date: Sat, 17 Dec 2022 15:11:31 +0900 Subject: [PATCH 2/2] fix: typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e761e8c..4fe61d9 100644 --- a/README.md +++ b/README.md @@ -53,7 +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 `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?`|`null`|Widgets which are shown at left and right side of `colorTip`.
First value is the left side widget and second value is the right side widget.
Give null value makes default 'less' and 'more' text.| |colorTipCount|`int?`|`7`|Length of `colorTip` block.|