搜尋套件、儲存庫與 APP 分類

套件詳情v1.0.0

flutter_use_battery

適用於Flutter應用程式的電池監控鈎子。提供useBattery鈎子,可在跨平台環境中即時追蹤電池電量與充電狀態。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
40
喜歡數
1
Pub 分數
150

安裝套件

flutter pub add flutter_use_battery

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

flutter_use_battery 是一個 Flutter 套件,透過方便的 useBattery 鈎子提供即時電池監控。它讓開發者能夠跨多個平台(包括 Android、iOS、Web、macOS、Windows 和 Linux)追蹤裝置的目前電池電量與充電狀態。此套件與 Flutter 的反應式架構無縫整合,讓應用程式能動態回應電池狀態的變更。非常適合需要能源效率意識或向使用者通知低電量的應用程式。

適用情境

  • 即時電池電量追蹤
  • 低電量警告系統
  • 節能應用行為
  • 跨平台電池監控
  • 基於電池狀態的使用者介面更新

主要特色

  • 即時電池狀態更新
  • 平台無關的實作
  • Simple useBattery 鈎子 API
  • 支援所有主要的Flutter平台
  • 輕量且易於整合

適合對象

  • 需要電池意識的應用程式
  • 使用 Flutter hooks 的開發者
  • 跨平台行動與桌面應用
  • 效能優化工具
  • 使用者體驗增強

使用建議

  • 需要適當的平台權限
  • 僅限電池電量與充電狀態
  • 不支援電池健康狀態或溫度
  • 若過度使用,可能會影響電池壽命
  • Web 支援取決於瀏覽器功能

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

flutter_use

flutter_lints
Inspired by react-use.


A collection of Flutter Hooks inspired by React's react-use library. This monorepo contains multiple packages providing different categories of hooks for Flutter development.

📦 Packages

Package Description Version
flutter_use Core hooks library with essential utilities pub package
flutter_use_audio Audio playback and control hooks pub package
flutter_use_battery Battery state monitoring hooks pub package
flutter_use_geolocation Location and permission hooks pub package
flutter_use_network_state Network connectivity hooks pub package
flutter_use_sensors Device sensors hooks pub package
flutter_use_video Video playbook hooks pub package

🚀 Installation

For the core package:

flutter pub add flutter_use

For specialized packages:

flutter pub add flutter_use_audio    # Audio hooks
flutter pub add flutter_use_battery  # Battery hooks
# ... and so on

🌐 Interactive Demo Site

Try out all hooks with live examples at: https://wasabeef.github.io/flutter_use/

📚 Hooks by Category

📱 Mobile-first Hooks

Core package: flutter_use

  • useAsync — manages async operations with loading, data, and error states.
  • useDebounceFn — debounces function calls for better performance.
  • useInfiniteScroll — implements infinite scrolling with automatic loading.
  • useForm — comprehensive form state management with validation.
  • useKeyboard — tracks keyboard visibility and manages layouts (mobile only).
🎭 State Management

Core package: flutter_use

⏱️ Timing & Animation

Core package: flutter_use

🔄 Side Effects & Performance

Core package: flutter_use

🎯 UI Interactions

Core package: flutter_use

♻️ Lifecycle Management

Core package: flutter_use

🎨 Development & Debugging

Core package: flutter_use

  • useLogger — logs in console as component goes through life-cycles.
📱 Device Sensors

Package: flutter_use_sensors

Core package: flutter_use

🔋 Device Information

Package: flutter_use_battery

Package: flutter_use_geolocation

  • useGeolocation — tracks geo location and permission state of user's device. geolocator

Package: flutter_use_network_state

🎵 Media

Package: flutter_use_audio

  • useAudio — plays audio and exposes its controls. just_audio

Package: flutter_use_video

🚧 Coming Soon

  • useEvent — subscribe to events.
  • useFullscreen — display an element or video full-screen.
  • usePageLeave — triggers when mouse leaves page boundaries.
  • usePermission — query permission status for apps APIs.
  • useMethods — neat alternative to useReducer.
  • useSetState — creates setState method which works like this.setState.
  • usePromise — resolves promise only while component is mounted.
  • useObservable — tracks latest value of an Observable.



Unlicense — public domain.



所屬分類

依賴

依賴清單 2 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。