CustomContainer Widget
Overview
CustomContainer is a reusable Flutter widget that provides a container with customizable properties, including size, border radius, background color, shadow effects, and padding/margin.
Features
- Adjustable width and height
- Customizable border radius
- Background color customization
- Shadow effects with adjustable blur radius, spread radius, and offset
- Custom padding and margin
📲 Installation
Add the dependency to your pubspec.yaml:
dependencies:
apptomate_custom_container: ^0.0.1
Usage
Import the widget
import 'package:flutter/material.dart';
Example Usage
CustomContainer(
height: 100.0,
width: 200.0,
borderRadius: 16.0,
backgroundColor: Colors.blue,
shadowColor: Colors.black,
blurRadius: 10.0,
spreadRadius: 2.0,
offset: Offset(0, 4),
padding: EdgeInsets.all(16.0),
margin: EdgeInsets.symmetric(vertical: 10.0, horizontal: 20.0),
child: Center(
child: Text(
'Hello, Custom Container!',
style: TextStyle(color: Colors.white, fontSize: 16),
),
),
)
Constructor Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
child |
Widget |
Required | The widget inside the container. |
height |
double? |
null |
Height of the container. |
width |
double? |
null |
Width of the container. |
borderRadius |
double |
12.0 |
Radius of the container’s corners. |
backgroundColor |
Color? |
null (defaults to white) |
Background color of the container. |
shadowColor |
Color |
Colors.grey |
Color of the shadow. |
blurRadius |
double |
6.0 |
Blur intensity of the shadow. |
spreadRadius |
double |
1.0 |
Spread of the shadow. |
offset |
Offset |
(0, 2) |
Shadow positioning. |
padding |
EdgeInsetsGeometry? |
null |
Inner spacing. |
margin |
EdgeInsetsGeometry? |
null |
Outer spacing. |