Casting a shadow on a box is the capability of the built-in Flutter widget BoxShadow. Typically, BoxShadow is utilized in conjunction with BoxDecoration. In the BoxDecoration widget one of its parameters is boxShadow which takes a list of BoxShadow to cast a shadow around a box of mobile application.
Syntex
Properties of BoxShadow Widget:
- blurRadius : A double value is entered into this attribute as the object. It manages the haze around the shadow's edges.
- Blursigma : A double value is entered into this attribute as the object. It controls the blur-radius in terms of sigma instead of logical pixels.
- Color: The color property used for shadow.
- Offset: The object assigned to this attribute, offset class, determines how much the shadow will show.
- spreadRadius: Additionally, this property uses a double number as the object to determine how much the box should be expanded before the blur is applied.
Step-by-Step Implementation
Step 1: Create a New Project in Android Studio (File >new flutter project)
Step 2: Adding material package
Import method the runApp method in the main function call first while run the application.
Step 3: Creating a stateless widget
We can create a stateless widget that contains MaterialApp widget,AppBar,etc.
Step 4: Creating a boxshadow widget
Final code :
Happy coding!