搜索插件、代码仓与 APP 分类

插件详情v1.1.0

wear

一个为 Google Wear OS 提供 Flutter 支持的插件

Android
近 30 天下载
3000
喜欢数
167
Pub 分数
150

安装插件

flutter pub add wear

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

wear 包为开发针对 Google Wear OS 的应用程序提供了 Flutter 支持,使开发者能够构建交互式且响应迅速的智能手表应用。它与 Flutter 框架无缝集成,提供对 Wear OS 特有功能的访问,例如可快速浏览的用户界面、语音输入和传感器数据。专为基于 Android 的智能手表设计,该包简化了在可穿戴设备上创建原生体验的过程。该插件由 Flutter Community 维护,确保社区驱动的更新和强大的功能。

适合场景

  • 为 Wear OS 智能手表构建 Flutter 应用
  • 创建可快速浏览和快速操作的界面
  • 在手表上集成语音和传感器输入
  • 为安卓可穿戴设备开发配套应用
  • 在腕部设备上实现实时数据展示

主要特点

  • 原生 Wear OS 集成
  • 支持可快速查看和交互的表盘
  • 访问语音和传感器API
  • 与 Flutter 的跨平台兼容性
  • 社区维护且文档齐全

适合对象

  • 针对 Wear OS 设备的 Flutter 开发人员
  • 开发智能手表配套应用的团队
  • 专注于可穿戴用户体验的创作者
  • 移动应用开发者扩展到可穿戴设备
  • 需要轻量级、快速加载的表盘界面的项目

使用建议

  • 需要 Android SDK 和 Wear OS 模拟器或设备
  • 仅限 Android 平台
  • 可能需要为特定于手表的布局进行额外配置
  • 依赖于 Flutter 版本兼容性
  • 建议主要在物理设备或模拟器上进行测试

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

Flutter Wear Plugin

A plugin that offers Flutter support for Wear OS by Google (Android Wear).

To use this plugin you must set your minSdkVersion to 23.

Tutorial

https://medium.com/flutter-community/flutter-building-wearos-app-fedf0f06d1b4

Widgets

There currently three widgets provided by the plugin:

  • WatchShape: determines whether the watch is square or round.
  • AmbientMode: builder that provides what mode the watch is in. The widget will rebuild whenever the watch changes mode.

Example

Typically, all three of these widgets would be used near the root of your app's widget tree:

class WatchScreen extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return WatchShape(
      builder: (BuildContext context, WearShape shape, Widget? child) {
        return AmbientMode(
          builder: (context, mode, child) {
            return mode == Mode.active ? ActiveWatchFace() : AmbientWatchFace();
          },
        );
      },
    );
  }
}

Old Requirements

You DO NOT need to modify these files anymore:

You can remove all the old wearable references from the previous release. This plugin automatically adds all required references and settings.

  1. build.gradle: wearable dependencies

  2. AndroidManifest.xml: WAKE_LOCK and android.hardware.type.watch and com.google.android.wearable.standalone.

  3. MainActivity.kt or MainActivity.java: all AmbientMode references.

所属分类

源码仓库

使用此插件的项目