This application demonstrates the use of the BoxDecoration widget in Flutter. It shows how to add color, borders, border radius, images and box shadows to a container.
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
For help getting started with Flutter development, view the online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.
The following technologies were used to develop this program:
Flutter 2.8.1 Dart 2.15.1
- Clone the repository using the following command:
git clone https://github.com/your-username/flutter-box-decoration-sample.git
- Navigate to the project directory using the following command:
cd flutter-box-decoration-sample
- Run the application using the following command:
flutter run
The Container widget
has the following properties:
padding
: sets the padding around the child widget inside the container.
decoration
: creates the design for the container using BoxDecoration.
child
: contains the text widget that displays the word "Flutter".
The main feature of this app is the customized BoxDecoration applied to the Container widget. The box has a red color background and a black border with a width of 4. The border radius is set to be 40 at the bottom left corner and top right corner, and 10 at the bottom right corner and top left corner. Additionally, there is an image that is set as the background of the box with the DecorationImage class. Finally, two BoxShadow instances are used to create the shadow effect.
The BoxDecoration
property has the following attributes:
color
: sets the background color of the container.
border
: creates a black border around the container with a width of 4.
borderRadius
: sets the rounded corners of the container.
image
: adds an image to the container using the URL defined in _url.
boxShadow
: applies two BoxShadow effects to the container.
The BoxShadow
property has the following attributes:
color
: sets the color of the shadow.
offset
: sets the distance and direction of the shadow from the container.
blurRadius
: sets the amount of blurring for the shadow.
This program depends on the following packages:
flutter/material.dart:
The Material Design framework for Flutter.
This project was created by @Karaxmedov.
Contributions to this program are welcome. If you want to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Implement the feature or fix the bug.
- Write tests for your code.
- Submit a pull request.