GithubHelp home page GithubHelp logo

mohamadsobhy / gradient_like_css Goto Github PK

View Code? Open in Web Editor NEW

This project forked from azukisiromochi/gradient_like_css

0.0 0.0 0.0 241 KB

The `gradient_like_css` package for Flutter allows you to experience CSS-like gradients in your Flutter app.

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

License: MIT License

Ruby 1.98% Objective-C 3.41% Java 5.39% Dart 89.23%

gradient_like_css's Introduction

gradient_like_css

The gradient_like_css package for Flutter allows you to experience CSS-like gradients in your Flutter app.


Installing

1. Depend on it

Add this to your package's pubspec.yaml file:

dependencies:
  gradient_like_css: ^1.0.0

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

3. Import it

Now in your Dart code, you can use:

import 'package:gradient_like_css/gradient_like_css.dart';

Usage

To import CssLike:

import 'package:gradient_like_css/gradient_like_css.dart';

To use CssLike with the BoxDecoration:

BoxDecoration(
  gradient: linearGradient(-225, ['#69EACB', '#EACCF8 48%', "#6654F1"]),
);

Example

CssLike.linearGradient()

๐ŸŽจ Gradient at the default angle

with CSS:

background: linear-gradient(#e66465, #9198e5);

with Flutter:

Container(
  height: 300,
  width: 300,
  decoration: BoxDecoration(
    gradient: linearGradient(null, ['#e66465', '#9198e5']),
  ),
);

*Note: If the first argument is null, a 180 degree angular gradient is created.


๐ŸŽจ Gradient at a 45-degree angle

with CSS:

background: linear-gradient(45deg, red, blue);

with Flutter:

Container(
  height: 300,
  width: 300,
  decoration: BoxDecoration(
    gradient: linearGradient(45, ['red', 'blue']),
  ),
);

*Note: The color argument can use X11/CSS3 color names.


๐ŸŽจ Gradient that starts at 60% of the gradient line

with CSS:

background: linear-gradient(135deg, orange, orange 60%, cyan);

with Flutter:

Container(
  height: 300,
  width: 300,
  decoration: BoxDecoration(
    gradient: linearGradient(135, ['orange', 'orange 60%', 'cyan']),
  ),
);

*Note: You can add a color-stop points using the stop argument. It can be used with % such as 'orange 60%'.


๐ŸŽจ Gradient with multi-position color stops

with CSS:

background: linear-gradient(to right,
     red 20%, orange 20% 40%, yellow 40% 60%, green 60% 80%, blue 80%);

with Flutter:

Container(
  height: 300,
  width: 300,
  decoration: BoxDecoration(
    gradient: linearGradient(Alignment.centerRight, 
      ['red 20%', 'orange 20% 40%', 'yellow 40% 60%', 'green 60% 80%', 'blue 80%']),
  ),
);

*Note: The first argument can be Alignment as well as angle.


WebColors / X11Colors

To use X11Colors:

Container(
    color: X11Colors.MediumSpringGreen.color,
);

To use WebColors by X11/CSS3 color names:

Container(
    // Can be used in lowercase too
    color: WebColors.of('MediumSpringGreen').color,
);

Features

  • radialGradient()
  • conicGradient() ( sweepGradient )

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 request are also welcome.

gradient_like_css's People

Contributors

azukisiromochi avatar adrianv425 avatar

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.