Giter VIP home page Giter VIP logo

riticksaha / glassmorphism Goto Github PK

View Code? Open in Web Editor NEW
63.0 1.0 26.0 3.8 MB

Glassmorphic UI Package For Flutter || UI ||

Home Page: https://pub.dev/packages/glassmorphism

License: Apache License 2.0

Dart 85.99% Kotlin 0.35% Swift 1.01% Objective-C 2.18% HTML 3.82% Java 1.92% Shell 1.44% Ruby 3.29%
flutter package flutter-package dart ui gradient-borders child-widget container-border lineargradient instagram application

glassmorphism's Introduction

Glassmorphic Container ⭐️

A Flutter package for creating Glassmorphic UI designs in an easy and simple manner! Supports iOS, Android, web, Windows, macOS, and Linux.

Glassmorphic Example App. With realtime pub.dev stats📱

A package that simplefies your urge to create a interactive Glassmorphic Container.

Inspired by Glassmorphism CSS Generator. Highly customizable and helps developing beautiful Glassmorphic UI.

Usage 💻

likes
> pub points
> popularity

To use this plugin, add glassmorphism as a dependency in your pubspec.yaml file. Use the below example to get started with the sample example.

You can follow this tutorial and work around with the package.

Glassmorphism UI Package For @Flutter || UI || A Glassy and easy to use Package #flutter

Everything Is AWESOME

Features 🔮

  • Fully customizable components
  • Easy To use
  • Null Safe version
  • Multiple Childs widgets supported
  • Gesture Listener GestureDetector
  • Circular Border / Traditional Borders
  • Gradient Borders
  • Gradient Fill on container [Full Control to User]

To use GlassmorphicContainer with fixed Height and width:

GlassmorphicContainer(
  width: 350,
  height: 350,
  borderRadius: 20,
  blur: 20,
  alignment: Alignment.bottomCenter,
  border: 2,
  linearGradient: LinearGradient(
      begin: Alignment.topLeft,
      end: Alignment.bottomRight,
      colors: [
        Color(0xFFffffff).withOpacity(0.1),
        Color(0xFFFFFFFF).withOpacity(0.05),
      ],
      stops: [
        0.1,
        1,
      ]),
  borderGradient: LinearGradient(
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
    colors: [
      Color(0xFFffffff).withOpacity(0.5),
      Color((0xFFFFFFFF)).withOpacity(0.5),
    ],
  ),
  child: null,
),

Use GlassmorphicFlexContainer with responsiveness or take child widgets size. :

GlassmorphicFlexContainer(
  borderRadius: 20,
  blur: 20,
  padding: EdgeInsets.all(40),
  alignment: Alignment.bottomCenter,
  border: 2,
  linearGradient: LinearGradient(
      begin: Alignment.topLeft,
      end: Alignment.bottomRight,
      colors: [
        Color(0xFFffffff).withOpacity(0.1),
        Color(0xFFFFFFFF).withOpacity(0.05),
      ],
      stops: [
        0.1,
        1,
      ]),
  borderGradient: LinearGradient(
    begin: Alignment.topLeft,
    end: Alignment.bottomRight,
    colors: [
      Color(0xFFffffff).withOpacity(0.5),
      Color((0xFFFFFFFF)).withOpacity(0.5),
    ],
  ),
  child: null,
),

example, Simple Glassmorphic Container with Blur.

Example

import 'package:flutter/material.dart';
import 'package:glassmorphism/glassmorphism.dart';
import 'dart:ui';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'GlassmorphicContainer Example',
      home: GlassmorphicSample(),
    );
  }
}

class GlassmorphicSample extends StatefulWidget {
  @override
  State<GlassmorphicSample> createState() => GlassmorphicSampleState();
}

class GlassmorphicSampleState extends State<GlassmorphicSample> {
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: Container(
        height: double.infinity,
        width: double.infinity,
        child: Stack(
          children: [
            Image.network(
              "https://github.com/RitickSaha/glassmophism/blob/master/example/assets/bg.png?raw=true",
              fit: BoxFit.cover,
              height: double.infinity,
              width: double.infinity,
              scale: 1,
            ),
            SafeArea(
              child: Center(
                child: GlassmorphicContainer(
                    width: 350,
                    height: 750,
                    borderRadius: 20,
                    blur: 20,
                    alignment: Alignment.bottomCenter,
                    border: 2,
                    linearGradient: LinearGradient(
                        begin: Alignment.topLeft,
                        end: Alignment.bottomRight,
                        colors: [
                          Color(0xFFffffff).withOpacity(0.1),
                          Color(0xFFFFFFFF).withOpacity(0.05),
                        ],
                        stops: [
                          0.1,
                          1,
                        ]),
                    borderGradient: LinearGradient(
                      begin: Alignment.topLeft,
                      end: Alignment.bottomRight,
                      colors: [
                        Color(0xFFffffff).withOpacity(0.5),
                        Color((0xFFFFFFFF)).withOpacity(0.5),
                      ],
                    ),
                    child: null),
              ),
            ),
          ],
        ),
      ),
    );
  }
}

Parameters ⚙️

  • height (double) [required] - Height for the Widget [required].
  • width (double) [required]- Width for the Widget [@required].
  • borderRadius (double) [required]- Border Radius for the widget 0 - any [@required].
  • linearGradient (LinearGradient) [required]- Fills the container with the gradient passed.
  • border (double) [required]- Gives Width to the ContainerBorder.
  • blur (double) [required]- Gives BlurFilter to the Container.
  • borderGradient (LinearGradient) [required]- Fills the container's border with the gradient passed.
  • child (widget) - [optional parameter] If there is a child widget then the widget will be rendered inside the container.
  • alignment (optional) - Handles the alignment [Default_value] - [Alignemt.topleft].
  • padding (EdgeInset) - Used to provide pading to the child widget [Default_value] - [None].
  • BoxShape (Fixed) - This value is fixed to [BoxFit.rectangle].
  • constraints (ChatUser) - The constructor width and height arguments are combined with the constraints argument to set this property.
  • margin (double) - Empty space to surround the [decoration] and [child].
  GlassmorphicContainer(
    width: width,
    height: height,
    borderRadius:borderRadius,
    blur: blur,
    alignment: alignment,
    border:border,
    linearGradient: linearGradient,
    borderGradient:borderGradient,
    child: null),
  );

My Socials 👩‍👦‍👦

Credits 👨🏻‍💻




The Flutter Foundry 💙 - Instagram Link

Found this project useful? ❤️

If you found this project useful, then please consider giving it a ⭐️ on Github and sharing it with your friends via social media.

License ⚖️

API details 📝

See the glassmorphic.dart for more API details

Issues and feedback 💭

If you have any suggestion for including a feature or if something doesn't work. Feel free to open a Github issue for us to have a discussion on it.

glassmorphism's People

Contributors

harunr-plateron avatar riticksaha avatar saquibansari0101 avatar xuantung95 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

glassmorphism's Issues

Glassmorphism effect doesnt work over googlemap on iOS

Hi there,

Im developing an app using Flutter for both iOS and Android devices.

When the user taps on a marker on the map (GoogleMap) a Diologbox opens and displays the GlassmorphicContainer over the GoogleMap background, in turn displaying some text.

The effect works great on Android, but on iOS for some reason, the blurry glassmorphic effect only happens over widgets such as custom buttons, etc, but doesnt blur out the actual googlemap, text or markers on the googlemap. On Android, everything within the GlassmorphicContainer is blurred out perfectly.

Any ideas?

Adding drop shadow / elevation

Is your feature request related to a problem? Please describe.
It would be cool if I could add drop shadow / elevation to GlassmorphicContainer. The designs I made (and got approved from client) has no border and uses drop shadow to separate itself from other elements of the page.

Describe the solution you'd like
I would like an optional parameter for 'elevation', 'shadowColor' just like in Card/Material widget, or 'boxShadow' like in BoxDecoration widget.

Describe alternatives you've considered
Currently what I am doing to get this effect is, wrapping GlassmorphicContainer with a Container and provide decoration as follows

          decoration: BoxDecoration(
            color: Colors.transparent,
            borderRadius: BorderRadius.circular(20),
            boxShadow: const [
              BoxShadow(
                color: AppColors.shadow_black, //Use color of your choice
                offset: Offset(
                  5.0,
                  5.0,
                ),
                blurRadius: 10.0,
                spreadRadius: 2.0,
              ),
            ],
          ),

A better way might be to wrap GlassmorphicContainer with PhysicalModel(with color: Colors.transparent, of course) [Thanks to Flutter Widget of the Week] as it is a more raw/basic Widget but the problem for me was I couldn't control offset for shadow using this method.

Here is one of the pages from my design (what I was trying to achieve)

Dashboard Page - 1

Blur effect does not work properly on some Android devices

I recently tested the Flutter package "glassmorphism" on several Android smartphones and noticed a problem. Instead of seeing a blurred effect, I get a slightly transparent gray/white background. This problem was observed on a device running Android 9 with version One UI 1.0.

I've checked the existing problems for this package and haven't found any similar problems reported. I would like to know if this is a known problem and if there is a solution to fix it.

Thank you for your help.

screenshot

Unable to pub get the package.

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Unable to pub get the package.

The error I get is given below:

Error on line 30, column 3 of pubspec.yaml: A package may not list itself as a dependency.

Make the height and width dynamically adjust with the content

Currently, the height and width is a mandatory parameter which provides some constraints in terms of the responsiveness of the widget. Would it be possible to make these fit dynamically to the content within like the standard container does?

dart:ui/geometry.dart '<optimized out>': is not true.

bug :-
image

Code:-

GlassmorphicContainer(
                          width: 0,
                          height: 45.h,
                          borderRadius: 5.r,
                          blur: 6,
                          alignment: Alignment.center,
                          border: 10,
                          linearGradient: LinearGradient(
                              begin: Alignment.topLeft,
                              end: Alignment.bottomRight,
                              colors: [
                                colorGreen.withOpacity(0.2),
                                colorGreen.withOpacity(0.2),
                              ],
                              stops: [
                                0.1,
                                1,
                              ]),
                          borderGradient: LinearGradient(
                            begin: Alignment.topLeft,
                            end: Alignment.bottomRight,
                            colors: [
                              Colors.black.withOpacity(0.5),
                              Colors.black.withOpacity(0.5),
                            ],
                          ),

flutter doctor :-

[√] Flutter (Channel stable, 3.7.3, on Microsoft Windows [Version 10.0.19045.2604], locale en-IN)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[√] Chrome - develop for the web
[!] Visual Studio - develop for Windows (Visual Studio Community 2019 16.11.18)
    X Visual Studio is missing necessary components. Please re-run the Visual Studio installer for the "Desktop development with C++" workload, and include these components:
        MSVC v142 - VS 2019 C++ x64/x86 build tools
         - If there are multiple build tool versions available, install the latest
        C++ CMake tools for Windows
        Windows 10 SDK
[√] Android Studio (version 2021.2)
[√] VS Code (version 1.75.1)        
[√] Connected device (4 available)  
[√] HTTP Host Availability

Size by inner child

Greetings!
Can you please tell me how can I make the size of the container to the size of the inner child?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.