adaptive_responsive_ui 1.0.4
adaptive_responsive_ui: ^1.0.4 copied to clipboard
A comprehensive Flutter package for responsive UI design with easy-to-use extensions for width, height, padding, margin, fonts, and device detection.
import 'package:flutter/material.dart';
import 'package:flutter_responsive_helper/responsive_extensions.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
// Initialize ONCE here
ResponsiveConfig.init(context, baseWidth: 390, baseHeight: 844);
return const MaterialApp(
home: HomeScreen(),
);
}
}
class HomeScreen extends StatelessWidget {
const HomeScreen({super.key});
@override
Widget build(BuildContext context) {
// Now use everywhere without context!
return Scaffold(
appBar: AppBar(title: Text('No Context Demo')),
body: Column(
children: [
Container(
width: 300.w(), // ✅
height: 150.h(), // ✅
padding: 20.p, // ✅
margin: 16.m, // ✅
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(12.r()), // ✅
),
child: Text(
'No Context Needed!',
style: TextStyle(
fontSize: 18.sp(), // ✅
color: Colors.white,
),
),
),
20.gapH, // ✅
Container(
child:
Text('Symmetric Padding', style: TextStyle(fontSize: 16.sp())),
),
],
),
);
}
}