Nes

style: very good analysis Powered by Mason License: MIT

受老式复古游戏机启发的UI库

安装?

❗ 要开始使用Nes UI,您的计算机上必须安装 Flutter SDK

nes_ui 添加到您的 pubspec.yaml 文件中

dependencies:
  nes_ui:

安装它

flutter packages get

配置它

Nes UI 提供了一个 ThemeData,您可以将其添加到您的 MaterialApp 中。该主题可以通过 flutterNesTheme 方法获取。

import 'package:nes_ui/nes_ui.dart';

MaterialApp(
  theme: flutterNesTheme(),
);

查看该方法的许多参数以自定义主题。

字体

Nes UI 使用来自 Google Fonts 包Press start 2P 字体。

Google Fonts 会在运行时通过 http 获取文件。要保持该行为并确保其正常工作,请务必在您的 main 方法中调用 WidgetsFlutterBinding.ensureInitialized();

有关更多信息,请遵循此 Google Fonts 包指南

如果您想将字体捆绑到应用程序中并避免 http 请求,请遵循 此其他指南

捆绑字体到应用程序时,您还应该在 LicenseRegistry 中包含字体许可证。

例如

void main() {
  LicenseRegistry.addLicense(() async* {
    final license = await rootBundle.loadString('google_fonts/OFL.txt');
    yield LicenseEntryWithLineBreaks(['google_fonts'], license);
  });

  runApp(...);
}

更多关于字体许可证的信息 在此

在此查看所有小部件的图库 此处

Material 定制小部件

Nes UI 致力于充分利用 Material Design,并定制其外观以符合包的期望外观。以下是 Nes UI 定制的 Material 小部件列表:

  • 文本
  • TextField/TextFormField
  • Divider

自定义小部件

有些小部件与 Material 的外观和结构差异太大,无法在不从头开始构建整个小部件的情况下实现。这是 Nes UI 提供的小部件列表:

  • NesButton
  • NesCheckbox
  • NesContainer
  • NesIcon

更多即将推出!

GitHub

查看 Github