smooth_gradient
is a package that allows you to create linear gradients that use a specific curve.
Status | Comments |
---|---|
Current stable Flutter version | |
Current beta Flutter version | |
The oldest supported Flutter version |
- Add this package to your dependencies.
dependencies:
smooth_gradient: latest_version
- Get the dependencies.
flutter pub get
Replace LinearGradient
with a SmoothGradient
and optionally provide a curve.
return DecoratedBox(
decoration: BoxDecoration(
gradient: SmoothGradient(
from: Colors.black,
to: Colors.white,
// Defaults to `Curves.easeInOut`.
curve: Curves.easeIn,
),
),
child: const SizedBox.square(
dimension: 100,
),
);
- This package requires at least Flutter 3.24 to work.
- If there are any issues feel free to go to GitHub Issues and report a bug.
- Inspired by SmoothGradient for SwiftUI and X (Twitter) post.