responsive_spacing_v2 1.1.2 responsive_spacing_v2: ^1.1.2 copied to clipboard
A simple Flutter package to add responsive padding and margin widgets for consistent, adaptive spacing across different screen sizes.
import 'package:flutter/material.dart';
import 'package:responsive_spacing_v2/responsive_spacing_v2.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text("Responsive Spacing Example"),
),
body: Column(
children: [
ResponsivePadding(
smallScreenPadding: 8.0,
largeScreenPadding: 16.0,
child: Container(
color: Colors.blue,
child: const Text("This text has responsive padding"),
),
),
ResponsiveMargin(
smallScreenMargin: 8.0,
largeScreenMargin: 16.0,
child: ElevatedButton(
onPressed: () {
// Button action
},
child: const Text("Button with responsive margin"),
),
),
ElevatedButton(
onPressed: () {
// Button action
},
child: const Text("Button without responsive margin"),
),
],
),
),
);
}
}