auto_spacing 0.0.3 auto_spacing: ^0.0.3 copied to clipboard
Auto spacing is designed to automatically gives space between widgets.
import 'package:auto_spacing/auto_spacing.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const AutoSpacingExample(),
);
}
}
class AutoSpacingExample extends StatefulWidget {
const AutoSpacingExample({super.key,});
@override
State<AutoSpacingExample> createState() => _AutoSpacingExampleState();
}
class _AutoSpacingExampleState extends State<AutoSpacingExample> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.inversePrimary,
title: const Text('Auto Spacing Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
color: Colors.red,
height: 100,
width: 100,
),
const AutoSpacing(20),
Container(
color: Colors.blue,
height: 100,
width: 100,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
color: Colors.red,
height: 100,
width: 100,
),
const AutoSpacing(),
Container(
color: Colors.blue,
height: 100,
width: 100,
),
],
),
],
),
),
);
}
}