A Flutter widget that renders a customizable inner shadow effect on its child widget. Lightweight, dependency-free, and works on all Flutter platforms.
- Configurable blur radius
- Configurable shadow color and opacity
- Configurable X/Y offset
- Works with any child widget
- No external dependencies
Add this to your pubspec.yaml:
dependencies:
inner_shadow_flutter: ^0.0.1Then run:
flutter pub getimport 'package:inner_shadow_flutter/inner_shadow_flutter.dart';
InnerShadow(
blur: 10,
color: Colors.black38,
offset: const Offset(10, 10),
child: Container(
width: 200,
height: 200,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
),
),
)| Parameter | Type | Default | Description |
|---|---|---|---|
blur |
double |
10 |
The blur radius of the inner shadow |
color |
Color |
Colors.black38 |
The color and opacity of the shadow |
offset |
Offset |
Offset(10, 10) |
The X and Y offset of the shadow |
child |
Widget? |
null |
The widget to apply the inner shadow to |
Run the included example app:
cd example
flutter runThe example app features live sliders to control blur, offset X/Y, and shadow color with a real-time code preview.
Salah Saad
Email: kassabksab@gmail.com
Repository: https://github.com/salahsaads/InnerShadow
Based on the Stack Overflow answer by Alexandr Priezzhev, licensed under CC BY-SA 4.0.
MIT License. See LICENSE for details.
