特点

Flutter 拥有一个极其通用的 SDK,但有时我们只需要 10% 的功能来完成 90% 的工作。 我创建了这个组件来整合我认为对设计最有帮助的功能,同时保持其尽可能简单。

  • Box 使读取和编写组件更容易,通过简化常用参数。
    • 阴影边框圆角墨水效果渐变都统一到同一层级。
    • 添加了 阴影边框圆角渐变初始化的快捷函数。
  • 这旨在由设计系统用作低级构建块,以便创建更复杂的元素。

入门

将此添加到您的包的 pubspec.yaml 文件中

dependencies:
  design_box: ^1.0.0

用法

const box = Box(
  width: 40,
  height: 40,
  padding: const EdgeInsets.all(8),
  margin: const EdgeInsets.all(8),
  radius: boxRadius(10),
  border: boxBorder(Colors.white, width: 2),
  shadow: boxShadow(4),
  gradient: boxGradient(
    begin: Alignment.topRight,
    end: Alignment.bottomLeft,
    beginColor: Colors.deepOrange,
    endColor: Colors.deepPurple,
  ),
  onPressed: () {},
);

附加信息

请参阅包含的项目以获取示例实现。

GitHub

查看 Github