You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何在Flutter热力图中移除“less more”提示?

移除Flutter热力图中的“less more”提示

只需在HeatMap组件中添加showColorTip: false参数,即可关闭底部的颜色提示条(即你所说的“less more”提示)。

修改后的完整代码

import 'package:flutter/material.dart';
import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart';
import 'package:flutter_heatmap_calendar/flutter_heatmap_calendar.dart' as map_heatmap;


class MyHeatMap extends StatefulWidget {
  const MyHeatMap({super.key});

  @override
  State<MyHeatMap> createState() => MyHeatMapState();
}

class MyHeatMapState extends State<MyHeatMap> {
  @override
  Widget build(BuildContext context) {
    return map_heatmap.HeatMap(
      datasets: {
        DateTime(2024, 1, 6): 3,
        DateTime(2024, 1, 7): 7,
        DateTime(2024, 1, 28): 10,
        DateTime(2024, 1, 9): 13,
        DateTime(2024, 1, 13): 6,
      },
      colorMode: ColorMode.opacity,
      showText: false,
      scrollable: true,
      // 关闭颜色提示条
      showColorTip: false,
      colorsets: const {
        1: Color.fromARGB(20, 76, 200, 80),
        2: Color.fromARGB(40, 76, 200, 80),
        3: Color.fromARGB(60, 76, 200, 80),
        4: Color.fromARGB(80, 76, 200, 80),
        5: Color.fromARGB(100, 76, 200, 80),
        6: Color.fromARGB(120, 76, 200, 80),
        7: Color.fromARGB(150, 76, 200, 80),
        8: Color.fromARGB(180, 76, 200, 80),
        9: Color.fromARGB(220, 76, 200, 80),
        10: Color.fromARGB(255, 76, 200, 80),
      },
      onClick: (value) {
        ScaffoldMessenger.of(context)
            .showSnackBar(SnackBar(content: Text(value.toString())));
      },
    );
  }
}

添加该参数后,热力图会隐藏底部的“less more”提示,实现你想要的简洁界面效果。


内容的提问来源于stack exchange,提问作者Jubibani

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 03:18:10