패키지, 저장소 및 앱 카테고리 검색

GitHub 저장소timobaehr/fl_heatmap

fl_heatmap

Flutter 앱용으로 제작된 히트맵입니다.

fl_heatmap 프로젝트 이미지
스타
16
포크
7
최근 푸시(UTC)
2025. 10. 26.
프로젝트 상태
활성

원본 README

아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.

fl_heatmap

A heatmap widget for Flutter apps.

heatmap electricity consumption

heatmap water consumption

Usage

1 - Depend on it

Add it to your package's pubspec.yaml file

dependencies:
  fl_heatmap: ^0.1.0
2 - Install it

Install packages from the command line

flutter packages get
3 - Use it

This is an example for the months of four years:

import 'package:fl_heatmap/fl_heatmap.dart';

class _ExampleState extends State<ExampleApp> {
  HeatmapItem? selectedItem;

  late HeatmapData heatmapData;

  @override
  void initState() {
    _initExampleData();
    super.initState();
  }

  void _initExampleData() {
    const rows = [
      '2022',
      '2021',
      '2020',
      '2019',
    ];
    const columns = [
      'Jan',
      'Feb',
      'Mär',
      'Apr',
      'Mai',
      'Jun',
      'Jul',
      'Aug',
      'Sep',
      'Okt',
      'Nov',
      'Dez',
    ];
    final r = Random();
    const String unit = 'kWh';
    heatmapData = HeatmapData(rows: rows, columns: columns, items: [
      for (int row = 0; row < rows.length; row++)
        for (int col = 0; col < columns.length; col++)
          HeatmapItem(
              value: r.nextDouble() * 6,
              unit: unit,
              xAxisLabel: columns[col],
              yAxisLabel: rows[row]),
    ]);
  }

  @override
  Widget build(BuildContext context) {
    final title = selectedItem != null
        ? '${selectedItem!.value.toStringAsFixed(2)} ${selectedItem!.unit}'
        : '--- ${heatmapData.items.first.unit}';
    final subtitle = selectedItem != null
        ? '${selectedItem!.xAxisLabel} ${selectedItem!.yAxisLabel}'
        : '---';
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Heatmap plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Column(
            children: [
              const SizedBox(height: 16),
              Text(title, textScaleFactor: 1.4),
              Text(subtitle),
              const SizedBox(height: 8),
              Heatmap(
                  onItemSelectedListener: (HeatmapItem? selectedItem) {
                    debugPrint(
                        'Item ${selectedItem?.yAxisLabel}/${selectedItem?.xAxisLabel} with value ${selectedItem?.value} selected');
                    setState(() {
                      this.selectedItem = selectedItem;
                    });
                  },
                  rowsVisible: 5, // Only the first 5 rows are visible
                  heatmapData: heatmapData)
            ],
          ),
        ),
      ),
    );
  }
}

If necessary you can inherit from HeatmapItem and attach some payload, e.g. the electricity costs for the consumption:

class CustomHeatmapItem extends HeatmapItem {
  CustomHeatmapItem(
      {required this.costs,
      required double value,
      required String unit,
      required String xAxisLabel,
      required String yAxisLabel})
      : super(
            value: value,
            unit: unit,
            xAxisLabel: xAxisLabel,
            yAxisLabel: yAxisLabel);
  
  final double costs;
}

Features

  • Supporting custom color schemes with dynamic size or use predefined color palettes such as colorPaletteTemperature, colorPaletteRed, colorPaletteBlue.
  • x- and y-axis labels are completely dynamic
  • Do not show the x-axis/y-axis labels if necessary
  • Detect clicks on cells and get back the data item to show detailed information about the cell
  • Use different styles for the cells if necessary
  • Show only the first lines and user can request to show all

Apps using this plugin

EHW+ Your app?
EHW+ ...
Timo Bähr GitHub avatar
GitHub 작성자

Timo Bähr ↗

Wolters KluwerMannheim공식 웹사이트 ↗
언어DartRubyKotlinSwiftObjective-C

이 저장소가 배포한 패키지

사용 중인 의존성

의존성 목록 3 개

  • flutter{"sdk":"flutter"}
  • flutter_test개발 의존성{"sdk":"flutter"}
  • flutter_lints개발 의존성^1.0.0

프로젝트에 맞는 저장소를 선택하려면?

사용 목적에 따라 검색하고 개발 활동을 비교한 뒤 원본 저장소에서 요구 사항을 확인하세요.

  1. 이름, 작성자 또는 설명으로 검색하고 기술 주제로 범위를 좁힙니다.
  2. 스타, 포크, 최근 푸시를 함께 비교하세요. 스타는 관심의 지표이며 품질을 보장하지 않습니다.
  3. 사용하기 전에 GitHub에서 README, 라이선스, Issues를 확인하세요.

출처 및 관리

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗