flutter_calendar_heatmap 0.1.0 copy "flutter_calendar_heatmap: ^0.1.0" to clipboard
flutter_calendar_heatmap: ^0.1.0 copied to clipboard

Flutter heatmap calendar inspired by github contribution chart.

example/lib/main.dart

import 'dart:math';

import 'package:flutter/material.dart';
import 'package:flutter_calendar_heatmap/flutter_calendar_heatmap.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Map<DateTime, int> _data = {};

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

  void _initExampleData() {
    var rng = Random();
    var now = DateTime.now();
    var today = DateTime(now.year, now.month, now.day);
    for (int i = 0; i < 200; i++) {
      DateTime date = today.subtract(Duration(days: i));
      _data[date] = rng.nextInt(6); // Random number between 0 and 5
    }
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Heatmap plugin example app'),
        ),
        body: SingleChildScrollView(
          child: Padding(
            padding: const EdgeInsets.all(20),
            child: Column(
              children: [
                const SizedBox(height: 16),
                const Text("HeatMap", textScaleFactor: 1.4),
                const Text(
                  "Flutter heatmap calendar inspired by github contribution chart.",
                  textAlign: TextAlign.center,
                ),
                const SizedBox(height: 30),
                HeatMap(aspectRatio: 2.3, data: _data),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
9
likes
120
points
36
downloads

Publisher

verified publishersinyu1012.cn

Weekly Downloads

Flutter heatmap calendar inspired by github contribution chart.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, flutter_web_plugins, intl, plugin_platform_interface

More

Packages that depend on flutter_calendar_heatmap