easiness 0.1.0
easiness: ^0.1.0 copied to clipboard
Flutter extensions for spacing, padding, margin, radius, and logging to make UI code concise and clean.
Easiness #
A collection of handy Flutter extensions to make your development easier and your code cleaner.
Features #
- Widget Extensions: Simplify common widget operations like centering, adding margins, padding, and border radius
- Gap Extensions: Create spacing with intuitive syntax using
SizedBox - Logger Utilities: Beautiful colored console logging with boxed output for better visibility
Installation #
Add this to your package's pubspec.yaml file:
dependencies:
easiness: ^0.1.0
Then run:
flutter pub get
Usage #
Gap Extensions #
Create spacing effortlessly using numeric extensions:
import 'package:easiness/easiness.dart';
Column(
children: [
Text('Hello'),
16.hGap, // Vertical gap of 16
Text('World'),
20.wGap, // Horizontal gap of 20 (useful in Rows)
Text('Flutter'),
],
)
hGap- Creates a vertical gap (height)wGap- Creates a horizontal gap (width)sqGap- Creates a square gap (both height and width)
Widget Extensions #
Center Widget
Text('Centered Text').center()
Margin Extensions
// All sides
Container().marginAll(16.0)
// Symmetric
Container().marginSym(h: 20, v: 10)
// Specific sides
Container().marginOnly(left: 10, top: 20, right: 10, bottom: 5)
Padding Extensions
// All sides
Text('Padded').paddingAll(16.0)
// Symmetric
Text('Padded').paddingSym(h: 20, v: 10)
// Specific sides
Text('Padded').paddingOnly(left: 10, top: 20)
Border Radius Extension
Container(
color: Colors.blue,
child: Text('Rounded corners'),
).borderRadius(12.0)
Logger Utilities #
Beautiful console logging with colored boxed output:
import 'package:easiness/easiness.dart';
// Direct logging
LoggerBox.error('Something went wrong!');
LoggerBox.success('Operation completed successfully');
LoggerBox.info('Processing data...');
// Extension methods on any object
'Error message'.logError();
'Success message'.logSuccess();
'Info message'.logInfo();
// HTTP Response logging
httpResponse.logResponseInfo();
Output examples:
///////////////////////////////////
| ERROR |
| Something went wrong! |
///////////////////////////////////
///////////////////////////////////
| SUCCESS |
| Operation completed |
///////////////////////////////////
///////////////////////////////////
| INFO |
| Processing data... |
///////////////////////////////////
Example #
import 'package:flutter/material.dart';
import 'package:easiness/easiness.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
'App started'.logSuccess();
return MaterialApp(
home: Scaffold(
body: Column(
children: [
Text('Welcome to Easiness')
.center()
.paddingAll(16.0)
.marginSym(v: 20),
24.hGap,
Container(
color: Colors.blue,
child: Text('Rounded Container'),
)
.borderRadius(12.0)
.paddingAll(20.0),
],
),
),
);
}
}
Features Overview #
| Feature | Description |
|---|---|
| Gap Extensions | Quick spacing with hGap, wGap, sqGap |
| Center Extension | Center any widget with .center() |
| Margin Extensions | Add margins with marginAll(), marginSym(), marginOnly() |
| Padding Extensions | Add padding with paddingAll(), paddingSym(), paddingOnly() |
| Border Radius | Round corners with .borderRadius() |
| Logger | Colored console output with LoggerBox and extension methods |
Contributing #
Contributions are welcome! Please feel free to submit a Pull Request.
License #
This project is licensed under the MIT License - see the LICENSE file for details.
Author #
Created with ❤️ for the Flutter community
Note: The logger utilities only work in debug mode and will not print in release builds.