ZenitUI
使用 Flutter 设计精美应用
ZenitUI 是什么
ZenitUI 是一个用于 Flutter 的 UI 库,旨在与 Material 库一起使用
安装
将包添加到您的依赖项
dependencies:
zenit_ui:
git: https://github.com/larsb24/zenit_ui
组件
按钮
按钮为用户提供了一种触发即时操作的方式。按钮有两种类型。主要和次要。
以下是如何创建基本主要按钮的示例
PrimaryButton(
onPressed: () => print("PrimaryButton was clicked"),
backgroundColor: ZenitColors.blue,
foregroundColor: const Color(0xffffffff),
child: const Text(
"Primary Button",
),
),
对于次要按钮,只需将关键字更改为 SecondaryButton 即可。
开关
开关是一个允许您打开或关闭事物的组件。
以下是如何创建基本开关的示例
bool _checked = false;
Switch(
value: _checked,
onChanged: (value) => setState(() => _checked = value),
),