diagonal_decoration 2.0.1 copy "diagonal_decoration: ^2.0.1" to clipboard
diagonal_decoration: ^2.0.1 copied to clipboard

Custom box decoration with diagonals on the background. Contains DiagonalDecoration and MatrixDecoration.

Diagonal Decoration #

pub package CI

You can use plain color or gradient for backgrounds, but there is a third option that can make your app look more interesting. Use this DiagonalDecoration or MatrixDecoration to create custom backgrounds for your containers.

Installing: #

Requirements: Flutter 3.47+ (material_ui). On older Flutter, use diagonal_decoration: ^1.2.0.

In your pubspec.yaml

dependencies:
  diagonal_decoration: ^2.0.0

The samples below use Colors from package:material_ui/material_ui.dart. Apps that haven't migrated to material_ui yet can keep package:flutter/material.dart.

Basic Usage: #

Just add DiagonalDecoration or MatrixDecoration to your Container's decoration parameter

    return Container(
      width: 200,
      height: 200,
      decoration: DiagonalDecoration(),
    );

Advanced usage #

    decoration: const DiagonalDecoration(
       lineColor: Colors.black,
       backgroundColor: Colors.grey,
       radius: Radius.circular(20),
       lineWidth: 1,
       distanceBetweenLines: 5, // must be greater than 0
    )
    decoration: const MatrixDecoration(
       lineColor: Colors.black12,
       backgroundColor: Colors.white,
       radius: Radius.circular(12),
       lineWidth: 1,
       lineCount: 20,
    )

Both decorations work with AnimatedContainer, which animates between two decorations of the same type, and with Container(clipBehavior: ...), which clips the child to the rounded corners.


More from Yako #

Other Flutter packages from the same team:

Animated demo of the settings_ui Flutter package: an iOS-style settings screen with Appearance and General sections; turning on Dark mode switches the whole list to dark.
settings_ui
Settings screens that look native on every platform.
Animated demo of the badges Flutter package: a count badge on a cart icon goes from 1 to 4, a notification badge pops in, and a Twitter-style verified badge, a NEW label and an Instagram-shaped badge appear.
badges
Badges for any widget: counters, dots, shapes and animations.
Animated demo of the yako_celebrations Flutter package: an epic celebration fills a dark screen with fireworks, flames, spinning coins, confetti and popping Yako logos under a LEVEL UP! title.
yako_celebrations
Full-screen celebrations in one line: confetti, coins, fireworks, flames.
Animated demo of the status_alert Flutter package: liking a song shows an Apple-style blurred Loved popup with an icon and a subtitle, which then fades away.
status_alert
Apple-style status alerts that hide themselves.
Animated demo of the full_screen_menu Flutter package: a blurred full-screen overlay opens over a weather app with five round gradient buttons and a close button.
full_screen_menu
A full-screen menu with round gradient buttons.
Animated demo of the yako_theme_switch Flutter package: a toggle whose sun thumb rolls into a moon as the screen changes from light mode to dark mode.
yako_theme_switch
An animated switch between light and dark themes.
52
likes
160
points
54
downloads
screenshot

Documentation

API reference

Publisher

verified publisheryako.dev

Weekly Downloads

Custom box decoration with diagonals on the background. Contains DiagonalDecoration and MatrixDecoration.

Repository (GitHub)
View/report issues

Topics

#ui #decoration #background #pattern

License

MIT (license)

Dependencies

flutter, material_ui

More

Packages that depend on diagonal_decoration