搜尋套件、儲存庫與 APP 分類

glass_kit 封面
套件詳情v4.0.2

glass_kit

一個包含用於在 Flutter 應用中實現玻璃模糊效果的組件的套件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下載
1.3萬
喜歡數
535
Pub 分數
160

安裝套件

flutter pub add glass_kit

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

Glass Kit 是一個 Flutter 套件,提供即用型組件,用於在應用程式中實現玻璃擬態效果。它讓開發者能夠建立視覺上吸引人的半透明 UI 元件,具有模糊與透明效果,這在現代設計趨勢中相當常見。該套件支援多個平台,包括 Android、iOS、Web、macOS、Windows 和 Linux,確保跨裝置的一致性玻璃擬態樣式。透過 pub add 簡單整合,它簡化了加入複雜 UI 元件的過程,無需複雜的自訂程式碼。

適用情境

  • 建立現代應用程式介面
  • 設計半透明疊加層
  • 建構儀表板背景
  • 實現帶有模糊效果的浮動卡片
  • 透過視覺深度增強使用者體驗

主要特色

  • 預建構的玻璃模糊小部件
  • 支援模糊效果
  • 透明度和漸變自定義
  • 跨平台相容性
  • 與 Flutter 的輕鬆整合
  • 響應式設計支援

適合對象

  • 尋求現代美學的UI設計師
  • 開發簡潔移動或網頁應用的開發者
  • 需要沉浸式視覺效果的項目
  • 專注於精緻的使用者介面
  • 面向現代設計趨勢的應用

使用建議

  • 使用重度模糊效果時的性能影響
  • 可能需要在低階設備上進行優化
  • 超出基本玻璃樣式之外的自訂功能有限
  • 最適合淺色主題設計
  • 不適合高對比度或深色模式為主的應用程式

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

Glass Kit

A package containing widgets to implement glass morphism in flutter apps


Platform Pub Package CI Codecov Coverage License: MIT Donate


Table of contents

About

GlassMorphism, is a new UI trend with a huge popularity among designers. Glass Kit provides you with widgets and other elements to implement this style in your flutter apps easily and efficiently.

Gallery:



ios-themed-glassmorphism         glassmorphism-in-card

Source code for the above can be found in the example directory here


Getting Started

You should add the following to the pubspec.yaml file:

dependencies:
  glass_kit: ^4.0.2

You should then run flutter packages get in your terminal so as to get the package.

Now import the package in the dart file:

import 'package:glass_kit/glass_kit.dart';

Usage

To create a basic clear glass container you can use the clearGlass constructor. If needed, just provide the height and width and you are good to go. The clearGlass and frostedGlass constructors assign default values to the properties if not provided.

GlassContainer.clearGlass(child: Child());

To create a frosted glass container use the frostedGlass constructor.

GlassContainer.frostedGlass(width: 300, child: Child());

Depending on your requirements you can tweak with the properties and create awesome glass widgets. You can also use the GlassContainer constructor to create fully customizable glass widgets.

Note : GlassContainer comes with properties as in a regular Container but with some exceptions and additions. Checkout the docs for the list of properties and their default values.

Here's a fully customized GlassContainer with shape as circle:

GlassContainer(
      height: 300,
      width: 400,
      gradient: LinearGradient(
        colors: [Colors.white.withOpacity(0.40), Colors.white.withOpacity(0.10)],
        begin: Alignment.topLeft,
        end: Alignment.bottomRight,
      ),
      borderGradient: LinearGradient(
        colors: [Colors.white.withOpacity(0.60), Colors.white.withOpacity(0.10), Colors.lightBlueAccent.withOpacity(0.05), Colors.lightBlueAccent.withOpacity(0.6)],
        begin: Alignment.topLeft,
        end: Alignment.bottomRight,
        stops: [0.0, 0.39, 0.40, 1.0],
      ),
      blur: 15.0,
      borderWidth: 1.5,
      elevation: 3.0,
      isFrostedGlass: true,
      shadowColor: Colors.black.withOpacity(0.20),
      alignment: Alignment.center,
      frostedOpacity: 0.12,
      margin: EdgeInsets.all(8.0),
      padding: EdgeInsets.all(8.0),
    );

Note : You can also provide borderRadius but when the shape is BoxShape.rectangle.

Bugs or Requests

If you encounter any problems feel free to open an issue. If you feel the library is missing a feature, please raise a ticket on GitHub and I'll look into it. Pull requests are also welcome.

See Contributing.md.

Contributors

Thanks goes to these wonderful people (emoji key):

Kabilan VS
Kabilan VS

🐛 💻
Martin Klüpfel
Martin Klüpfel

🚧 💻
Vladimir E. Koltunov
Vladimir E. Koltunov

🐛 💻

This project follows the all-contributors specification. Contributions of any kind are welcome! See Contributing.md.

License

glass_kit is licensed under MIT License

所屬分類

原始碼儲存庫

使用此套件的專案