Skip to content

加入低电量卡片变色提醒#158

Open
aqqkad wants to merge 1 commit into
BenderBlog:mainfrom
aqqkad:low-electricity-warning
Open

加入低电量卡片变色提醒#158
aqqkad wants to merge 1 commit into
BenderBlog:mainfrom
aqqkad:low-electricity-warning

Conversation

@aqqkad

@aqqkad aqqkad commented Jul 5, 2026

Copy link
Copy Markdown

变更内容

  • 首页电量低于阈值时,电量卡片切换为提醒样式
  • 设置页新增“低电量卡片变色提醒”开关
  • 支持自定义低电量阈值
  • 默认开启,默认阈值为 20 度

实现说明

  • 提醒样式使用现有主题色 errorContainer / onErrorContainer
  • 设置项接入现有 Preference 枚举
  • 不硬编码具体颜色

检查

  • 已通过相关文件的 dart analyze

final state = controller.energyInfoStateSignal.value;
final displayInfo = controller.displayEnergyInfo.value;
final lowElectricityWarningEnabled =
!preference.contains(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

State<SettingWindow> createState() => _SettingWindowState();
}

const int _defaultLowElectricityWarningThreshold = 20;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同理,写到 energy_controller.dart 里面。

那个控制器里面写个新信号叫 electricityWarning ,参数为 int。初始化判断逻辑如下:

  • 没有开启该功能:设置为 -1 ,UI 方面设置为不理会
  • 开启了,但是没有用户自定义量:设置为 20
  • 开启且用户设置了自定义量:用用户的数值

@BenderBlog

Copy link
Copy Markdown
Owner
  1. 截图给我看效果,包括设置页面、开启警告情况下的样式
  2. 按照上面的要求改状态管理

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants