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

card_banner 封面
插件详情v0.0.1+2

card_banner

一个简单的 widget,可帮助您在任何 widget 上放置横幅。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
6
喜欢数
25
Pub 分数
140

安装插件

flutter pub add card_banner

插件介绍

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

CardBanner 是一个轻量级的 Flutter 小部件,旨在轻松地在任何其他小部件上放置横幅。它提供了一种简单的方法,无需复杂的布局管理即可为 UI 元素添加视觉指示器,例如徽章、丝带或标签。横幅可以相对于父小部件进行定位,并通过颜色、文本和对齐选项进行自定义。适用于在多个平台的应用中突出显示功能、状态指示器或促销信息。

适合场景

  • 向卡片添加状态徽章
  • 突出显示促销内容
  • 在项目上显示优先级标签
  • 为UI元素创建自定义徽章
  • 通过视觉提示增强用户反馈

主要特点

  • 与任何小部件的轻松集成
  • 可自定义的横幅文本和颜色
  • 灵活的定位选项
  • 支持多个平台
  • 最小化样板代码
  • 响应式设计兼容性

适合对象

  • 开发用户界面密集型应用的开发者
  • 需要视觉注释的设计人员
  • 需要状态指示器的应用程序
  • 跨平台移动和Web应用程序
  • 具有动态内容标记的项目

使用建议

  • 可能需要手动对齐调整
  • 超出基本自定义的样式有限
  • 不适合复杂动画
  • 最好与简单、静态的横幅一起使用
  • 在大型列表中过度使用时的性能影响

原始 README

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

Card Banner

It is simple to add a banner to any widget using card banner.

Features

  • Highly customizable.
  • Multi-platform support.

Getting started

Add this line to your pubspec.yaml under the dependencies:

dependencies:
    card_banner: <latest-version>

alternatively, you can use this command:

flutter pub add card_banner

Import statement

import 'package:card_banner/card_banner.dart'

Screenshot

Usage

Simple example: Cover the card widget with the card banner and provide the required text. It's done

class MyBanner extends StatelessWidget {
  const MyBanner({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: const Color.fromARGB(255, 221, 222, 245),
      body: ListView.builder(
        padding: const EdgeInsets.symmetric(horizontal: 10),
        itemCount: 8,
        itemBuilder: (context, index) {
          return CardBanner(
            text: "50% Off",
            child: foodCard(),
          );
        },
      ),
    );
  }

  Card foodCard() {
    return Card(
      child: ListTile(
        contentPadding: EdgeInsets.zero,
        title: Image.network(
          "https://images.pexels.com/photos/461198/pexels-photo-461198.jpeg",
          fit: BoxFit.cover,
        ),
        subtitle: const Padding(
          padding: EdgeInsets.all(12.0),
          child: Text(
            "Nulla cillum qui elit adipisicing culpa ad laboris amet laboris velit. Pariatur sit tempor nostrud non duis commodo laboris. Consequat incididunt laborum qui dolore in velit consequat mollit amet. Proident eu et sint veniam sunt fugiat quis fugiat sunt pariatur do enim in.",
            overflow: TextOverflow.ellipsis,
            maxLines: 3,
          ),
        ),
      ),
    );
  }
}

Additional information

Check the example project on github for advanced usage.

所属分类

源码仓库

使用此插件的项目

暂无相关数据。