autoscalable_container 0.0.1
autoscalable_container: ^0.0.1 copied to clipboard
AutoScalable Container is a Flutter package that provides a dynamically resizable container. It automatically adjusts its height and width based on its content, with support for gradient colors and va [...]
AutoScalable Container is a Flutter package that provides a dynamically resizable container. It automatically adjusts its height and width based on its content, with support for gradient colors and various customization options.
Features #
- Dynamic Sizing: Adjusts container size based on content.
- Customizable Gradients: Set gradient colors for the container background.
- Flexible Customization: Configure padding, border radius, borders, and margins.
- Intrinsic Size Support: Ensures proper resizing with content.
- Adjustable Scaling Factors: Specify scaling factors for width and height adjustments.
Getting started #
Installation : Add the following to your pubspec.yaml file:
dependencies:
autoscalable_container: ^0.0.1
Then Run :
flutter pub get
Usage #
import 'package:flutter/material.dart';
import 'package:autoscalable_container/autoscalable_container.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('AutoScalable Container Example')),
body: Center(
child: AutoScalableContainer(
gradient: LinearGradient(colors: [Colors.orange, Colors.red]),
borderRadius: 15.0,
border: Border.all(color: Colors.black, width: 2),
padding: EdgeInsets.all(16),
widthScalingFactor: 0.9,
heightScalingFactor: 0.6,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'This container adjusts its size based on the content.',
style: TextStyle(fontSize: 16, color: Colors.white),
),
SizedBox(height: 10),
Text(
'You can add more widgets inside.',
style: TextStyle(fontSize: 16, color: Colors.white),
),
],
),
),
),
),
);
}
}
Attributes #
-
child
Type: Widget
Description: The widget to display inside the container. This is the main content of the container. -
gradient
Type: Gradient?
Description: The gradient colors to apply to the container's background. If not provided, a default gradient will be used. -
padding
Type: EdgeInsetsGeometry
Default: EdgeInsets.all(8.0)
Description: Padding inside the container. Adjusts the space around the child widget. -
borderRadius
Type: double
Default: 10.0
Description: Radius of the container's corners. Determines how rounded the corners of the container are. -
border
Type: BoxBorder?
Description: Border to apply around the container. Use this to customize the container's border style and color. -
margin
Type: EdgeInsetsGeometry
Default: EdgeInsets.all(8.0)
Description: Margin around the container. Adjusts the space outside the container. -
widthScalingFactor
Type: double
Default: 0.95
Description: Scaling factor for the width of the container. The width will be adjusted by this factor relative to the available width. -
heightScalingFactor
Type: double
Default: 0.50
Description: Scaling factor for the height of the container. The height will be adjusted by this factor relative to the available height.