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

glassmorphism_widgets 封面
插件详情v0.2.2

glassmorphism_widgets

一组可用于 Flutter 应用的组件。您可以轻松自定义和开发玻璃拟态组件。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
601
喜欢数
79
Pub 分数
150

安装插件

flutter pub add glassmorphism_widgets

插件介绍

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

一个 Flutter 包,提供了一组可自定义的控件,用于在应用程序中创建玻璃形态效果。它简化了模糊、半透明 UI 元素的实现,具有现代感十足的磨砂玻璃美学。开发者可以轻松集成并调整这些控件,以满足跨平台的各种设计需求。该包支持 Android、iOS、Web、macOS、Windows 和 Linux,非常适合追求简洁、现代外观的跨平台项目。

适合场景

  • 创建现代应用程序界面
  • 设计带有模糊效果的浮动卡片
  • 构建视觉上吸引人的叠加层
  • 通过深度提升用户体验
  • 实现半透明UI组件

主要特点

  • 易于使用的玻璃拟态小部件
  • 可自定义的模糊和透明度级别
  • 跨平台兼容性
  • 支持多种主题
  • 内置动画支持
  • 通过 pub add 简单集成

适合对象

  • 寻求现代美学的UI设计师
  • 开发跨平台应用的开发者
  • 需要磨砂玻璃效果的项目
  • 专注于视觉吸引力的应用程序
  • 使用 Flutter 进行快速原型设计的团队

使用建议

  • 使用重度模糊效果时的性能影响
  • 可能需要额外的样式以支持深色模式
  • 超出基本属性的自定义功能有限
  • 不适用于低端设备
  • 某些平台上可能存在渲染不一致的情况

原始 README

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

Glassmorphism Widgets

About

This package allows you to easily create a Glassmorphism UI.
The AppBar, ListTile, and even the BottomNavigationBar work like Material Design widgets.
The color, shape, and size of the glass are all up to you.
Create your ideal Glassmorphism App!
This package currently supports only stable channel.

Getting started

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

dependencies:
  glassmorphism_widgets:

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:glassmorphism_widgets/glassmorphism_widgets.dart';

Usage

Here is an example of how to use Glassmorphism Widgets.
Many of the parameters are based on the original Material Design widget.
If you want to know glass specific parameter.
You should look here.

GlassContainer

a simple glass container.

GlassContainer(
    child: Padding(
      padding: EdgeInsets.all(8),
      child: GlassText("Hello World"),
    ),
),
GlassFlexContainer
Container(
    height:200,
    width:200,
    GlassFlexContainer(
        child: Padding(
        padding: EdgeInsets.all(8),
        child: GlassText("Hello World"),
        ),
    ),
),
GlassApp & GlassThemeData

If you want to change glass widgets look all together.
You should use GlassApp and GlassThemeData.

GlassApp(
  theme: GlassThemeData(
    blur: 10,
  ),
  home: MaterialApp(
    title: 'Flutter Demo',
    theme: ThemeData(
      primarySwatch: Colors.blue,
    ),
    home: const MyHomePage(title: 'Flutter Demo Home Page'),
  ),
)
GlassTheme

If you want to access GlassThemeData.
You should use GlassTheme.

GlassThemeData data = GlassTheme.of(context);
GlassText

It is a thin white text.

GlassText("Hello World"),
GlassAppBar

a simple glass app bar.

appBar: GlassAppBar(
    title: GlassText(
        'Glass Morphic Demo',
        fontWeight: FontWeight.bold,
        color: Colors.white,
    ),
),
GlassListTile

a simple glass list tile

GlassListTile(
    leading: GlassIcon(Icons.search),
    title: TextField(
        decoration: InputDecoration(
        hintText: 'Search',
        border: InputBorder.none,
        hintStyle: glassTextStyle,
        ),
        style: glassTextStyle,
    ),
    onTap: () {},
),
GlassButton

a simple glass button

GlassButton(
    onPressed: () {
    showGlassBottomSheet(
        context: context,
        child: Center(
            child: GlassText("Hello World", fontSize: 20)));
    },
    child: GlassText("Button"),
),
showGlassBottomSheet

Display bottom sheet like glass

showGlassBottomSheet(
    context: context,
    child: Center(
        child: GlassText("Hello World", fontSize: 20)));
GlassFloatingActionButton
floatingActionButton: GlassFloatingActionButton(
    onPressed: () {
        setState(() {
            index++;
        });
    },
    child: GlassText("$index"),
),
GlassBottomBar
bottomNavigationBar: GlassBottomBar(
            items: [
              GlassBottomBarItem(
                icon: Icon(Icons.home),
                title: GlassText("Home"),
              ),
              GlassBottomBarItem(
                icon: Icon(Icons.search),
                title: GlassText("Search"),
              ),
              GlassBottomBarItem(
                icon: Icon(Icons.settings),
                title: GlassText("Settings"),
              ),
            ],
            onTap: (i) {
              setState(() {
                index = i;
              });
            },
            currentIndex: index,
          ),
GlassIcon
IconButton(
    icon: GlassIcon(Icons.search),
    onPressed: () {},
),

a specific Glass widget parameter

How to change widgets gradient?

You should add parameter linearGradient.

How to change widgets shape?

You should add parameter radius or borderRadius.
borderRadius takes precedence over radius.

I want to create more clear glass or more frosted glass

You should add parameter blur.
If you set blur lower value. GlassWidgets will become clear.

Problem

Master Channel cannot use GlassFloatingActionButton.

Contact

If you have anything you want to inform me (@yama-yeah), such as suggestions to enhance this package or functionalities you want etc, feel free to make issues on GitHub

所属分类

源码仓库

使用此插件的项目

暂无相关数据。