Lights

一个旨在为视障人士使用智能手机的平台。

这个应用程序目前有一些演示功能。这些功能只是此类平台可以做什么的例子。该项目的真正价值不在于它现在是什么,而在于它能成为什么。

工作

该项目旨在通过以下方式解决挑战:

  • 创建易于使用的界面,只涉及几个简单的手势。
  • 仅通过语音给出响应。
  • 使其他人能够通过创建新功能来贡献项目。

用法

这有两个主要方面。

主界面

它包含一个大而易读的文本,对应于当前活动的功能。

  • 垂直滑动将在主页和收藏夹之间切换。

  • 水平滑动将在该部分的功能之间切换。

  • 双击将读取功能的描述。

  • 长按将执行功能。

设置

此部分供用户信任的普通人使用。此人可以帮助用户更改应用的设置。

应用设置

包含以下选项,分为几个部分:

  • 语音
    • 调整语速
    • 调整音量

  • 功能
    • 重新排序功能
    • 添加或删除收藏夹中的项目
    • 启用或禁用功能

#### 功能设置

包含所有功能提供的设置(如果它们提供任何设置)。

功能

  • 天气:告知设定位置的天气。
  • 日期:告知当前日期。
  • 时间:告知当前时间。
  • 通话:拨打预设号码。
  • 对象检测:检测摄像头前方的物体。

添加新功能

此项目的核心理念是提供一个平台,而不是它目前拥有的功能。因此,提供一种简单的方式来添加新功能至关重要。

步骤1

熟悉 lib\features 文件夹中的其他功能。这是存放功能的文件夹。熟悉它们将帮助您理解项目结构。

步骤2

在 lib\features 文件夹中创建一个新文件夹。此文件夹将包含您要添加的功能。然后在此文件夹中创建一个名为 `feature_name.dart` 的文件。此文件将包含该功能的代码。然后在此文件夹中创建一个名为 `feature_name_settings.dart` 的文件。此文件将包含该功能的设置页面小部件(功能提供设置是可选的,如果您的功能没有设置,请不要创建此文件)。

步骤3

通过扩展 `lib\feature.dart` 中的 `Feature` 类来实现您的功能。

import 'package:flutter/material.dart';

/// Add a constructor if you feel the need to.
abstract class Feature {
  /// Name of the feature.
  String get name;

  /// Description of the feature.
  String get description;

  /// Returns the settings page widget. If the feature does not have settings, return null.
  Widget? get settingsPage;

  /// Returns an icon for the feature. Only needed if the feature has a settings page. Else return null.
  IconData? get icon;

  /// Will be called when the feature is executed.
  void execute();

  /// Will be called only when the app is opened for the first time. Use to save preferences using SharedPreferences.
  Future<void> init() async {}
}

第 4 步

在 `lib\globals.dart` 文件中注册您的功能。

allFeatures = {
  "home": HomeFeature(),
  "favourites": FavouritesFeature(),

  // Register new features below
  "weather": WeatherFeature(tts: tts, prefs: _prefs),
  "data": DateFeature(tts: tts),
  "time": TimeFeature(tts: tts, prefs: _prefs),
  "call": CallFeature(prefs: _prefs),
  "object_detection": DetectionFeature(tts: tts),
    };

GitHub

查看 Github