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

outline_gradient_button 封面
插件详情v2.0.1+1

outline_gradient_button

OutlineGradientButton 包用于创建带有渐变轮廓的按钮。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
22
喜欢数
97
Pub 分数
150

安装插件

flutter pub add outline_gradient_button

插件介绍

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

outline_gradient_button 包使开发者能够在 Flutter 应用中创建具有渐变轮廓的视觉吸引力按钮。它通过添加可自定义的渐变边框,扩展了标准按钮控件,从而实现现代且动态的用户界面设计。非常适合追求时尚、引人注目的界面但又不牺牲功能性的应用。该包支持所有主要平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,确保在各种设备上外观一致。通过 pub add 进行最少设置,即可无缝集成到现有项目中。

适合场景

  • 创建时尚的用户界面元素
  • 提升应用的视觉吸引力
  • 设计交互式操作按钮
  • 构建现代移动和网页界面
  • 为表单按钮添加渐变效果

主要特点

  • 渐变轮廓样式
  • 跨平台兼容性
  • 与 Flutter 的轻松集成
  • 可自定义的边框颜色和宽度
  • 支持各种按钮类型(例如 ElevatedButton、TextButton)
  • 轻量且高效

适合对象

  • 寻求视觉魅力的UI设计师
  • 开发现代 Flutter 应用的开发者
  • 需要基于梯度的交互元素的项目
  • 面向多个平台的应用程序
  • 原型设计和生产就绪的接口

使用建议

  • 可能需要额外的样式来处理复杂的渐变
  • 仅限轮廓效果,不支持填充渐变
  • 大量按钮对性能的影响
  • 最好与对比度高的背景色搭配以提高可见性

原始 README

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

wow

Example

Take a look at the provided example for how to use the OutlineGradientButton.

How to use

demo_button1

OutlineGradientButton(
  child: Text('WOW'),
  gradient: LinearGradient(
    colors: [Colors.purple, Colors.pink],
    begin: Alignment.topCenter,
    end: Alignment.bottomCenter,
  ),
  strokeWidth: 4,
),

demo_button2

OutlineGradientButton(
  child: Text('TEXT'),
  gradient: LinearGradient(colors: [Colors.pink, Colors.purple]),
  strokeWidth: 4,
  radius: Radius.circular(8),
),

demo_button3

OutlineGradientButton(
  child: Text('OMG'),
  gradient: LinearGradient(
    stops: [0, 0.5, 0.5, 1],
    colors: [Colors.green, Colors.green, Colors.red, Colors.red],
  ),
  strokeWidth: 4,
  corners: Corners(topLeft: Radius.elliptical(16, 14), bottomRight: Radius.circular(6)),
),

demo_button4

OutlineGradientButton(
  child: SizedBox(
    width: 52,
    height: 52,
    child: Column(
      mainAxisSize: MainAxisSize.min,
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        Icon(Icons.opacity, color: Colors.grey, size: 24),
        Text('TEXT', style: TextStyle(fontSize: 9)),
      ],
    ),
  ),
  gradient: LinearGradient(
    colors: [Colors.blue, Colors.black],
    begin: Alignment(-1, -1),
    end: Alignment(2, 2),
  ),
  strokeWidth: 4,
  padding: EdgeInsets.zero,
  radius: Radius.circular(26),
),

demo_button5

OutlineGradientButton(
  child: Text('Linear gradient', style: TextStyle(color: Colors.black, fontSize: 10)),
  gradient: LinearGradient(
    colors: List.generate(360, (h) => HSLColor.fromAHSL(1, h.toDouble(), 1, 0.5).toColor()),
  ),
  strokeWidth: 2,
  padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
  radius: Radius.circular(8),
),

demo_button6

OutlineGradientButton(
  child: Text('Sweep gradient', style: TextStyle(color: Colors.black, fontSize: 10)),
  gradient: SweepGradient(
    colors: List.generate(360, (h) => HSLColor.fromAHSL(1, h.toDouble(), 1, 0.5).toColor()),
  ),
  strokeWidth: 2,
  padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
  radius: Radius.circular(8),
),

demo_button7

OutlineGradientButton(
  child: Text('With background color and elevation', style: TextStyle(color: Colors.white, fontSize: 12)),
  gradient: LinearGradient(colors: [Colors.greenAccent, Colors.yellow]),
  strokeWidth: 2,
  padding: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
  corners: Corners(topRight: Radius.circular(16), bottomRight: Radius.circular(16)),
  backgroundColor: Colors.lightBlue,
  elevation: 4,
  inkWell: true,
  onTap: () => showSnack('onTap'),
  onDoubleTap: () => showSnack('onDoubleTap'),
  onLongPress: () => showSnack('onLongPress'),
),

所属分类

源码仓库

使用此插件的项目