搜尋套件、儲存庫與 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.

所屬分類

原始碼儲存庫

使用此套件的專案

暫無相關資料。