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

sleek_button 封面
插件详情v0.2.0

sleek_button

一个简单但可自定义的按钮。

近 30 天下载
13
喜欢数
19
Pub 分数
40

安装插件

flutter pub add sleek_button

插件介绍

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

Sleek Button 是一个轻量级、可自定义的 Flutter 小部件,旨在以最少的努力创建优雅现代的按钮。它提供了一个简洁的 API,用于通过各种效果(包括动画、渐变和阴影)来设置按钮样式。非常适合希望在不引入大量依赖的情况下获得简单而美观的按钮组件的开发者。该包支持对大小、颜色、形状和涟漪效果进行自定义,适用于基本和高级的 UI 需求。它可以无缝集成到任何 Flutter 项目中。

适合场景

  • 在移动应用中创建样式按钮
  • 添加动画按钮效果
  • 使用吸引人的输入控件构建表单
  • 设计交互式UI元素
  • 实现自定义按钮主题
  • 提升用户界面的美观度

主要特点

  • 高度可定制的外观
  • 内置动画和涟漪效果
  • 支持渐变和阴影
  • 简单直观的 API
  • 轻量且快速的性能
  • 与现有 Flutter 项目轻松集成

适合对象

  • Flutter 初学者寻找易于使用的控件
  • 想要快速按钮样式的开发人员
  • 需要精美用户界面组件的项目
  • 专注于视觉吸引力和互动性的应用
  • 致力于在各个屏幕上实现一致的按钮设计

使用建议

  • 仅限按钮特定功能
  • 不支持加载或禁用等复杂状态的内置支持
  • 可能需要额外的代码以实现高级交互
  • 不太适合高度动态或数据驱动的按钮逻辑

原始 README

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

A simple but yet customizable button.

Install

Add the dependency to your pubspec.yaml :

dependencies:
    sleek_button: <version>

Quick start

SleekButton(
    onTap: () {
        print('tapped!');
    },
    style: SleekButtonStyle.flat(
        color: swatch.primary,
        inverted: true,
        rounded: true,
        size: SleekButtonSize.big,
        context: context,
    ),
    child: const Icon(Icons.format_bold),
)

Usage

Widget
SleekButton(
    onTap: () {
        print('tapped!');
    },
    style: <style>
    child: const Text('Save'),,
)
SleekButton(
    onTap: () {
        print('tapped!');
    },
    style: <style>
    child: Row(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
            const Icon(Icons.check),
            const SizedBox(width: 6),
            const Text('Save'),
        ],
    ),
)

If the direct child is an Icon, the button will be a square.

SleekButton(
    onTap: () {
        print('tapped!');
    },
    style: <style>
    child: const Icon(Icons.check),
)
Styles
Flat
SleekButtonStyle.flat(
    context: context,
)
SleekButtonStyle.flat(
    size: SleekButtonSize.small,
    context: context,
)
SleekButtonStyle.flat(
    inverted: true,
    context: context,
)
SleekButtonStyle.flat(
    rounded: true,
    context: context,
)
SleekButtonStyle.flat(
    size: SleekButtonSize.medium,
    rounded: true,
    context: context,
)
Outlined
SleekButtonStyle.outlined(
    context: context,
)
SleekButtonStyle.outlined(
    size: SleekButtonSize.small,
    context: context,
)
SleekButtonStyle.outlined(
    inverted: true,
    context: context,
)
SleekButtonStyle.outlined(
    rounded: true,
    context: context,
)
SleekButtonStyle.outlined(
    size: SleekButtonSize.medium,
    rounded: true,
    context: context,
)
Light
SleekButtonStyle.light(
    context: context,
)
SleekButtonStyle.light(
    size = SleekButtonSize.small,
    context: context,
)
SleekButtonStyle.light(
    rounded = true,
    context: context,
)
SleekButtonStyle.light(
    size: SleekButtonSize.medium,
    rounded = true,
    context: context,
)
Colors

If you give a color, all variants (dark, light, invert) will be calculated with the help of the derived_colors package.

SleekButtonStyle.flat(
    color: const Color(0xFF)
    context: context,
)
 SleekButtonStyle.light(
    color: const Color(0xFFFFC369),
    context: context,
)
SleekButtonStyle.outlined(
    color: const Color(0xFF323232),
    context: context,
)
Theme

You can customize the default appearance of the button by adding a SleekButtonTheme in the tree. If a Theme is in the tree, it will use it tu deduce a default theme.

SleekButtonTheme(
    data: const SleekButtonThemeData(
        padding: 24,
        textStyle: TextStyle(fontSize: 11),
        cornerRadius: 8.0,
        iconTheme: IconThemeData(size: 10),
        fill: Color(0xFFFF0000),
        borderWidth: 2,
    ),
    child: app,
)

Thanks

Thanks to the bulma framework team for the inspiration.

所属分类

依赖

依赖清单 3 项

源码仓库

使用此插件的项目

暂无相关数据。