auto_spacing 0.0.6 auto_spacing: ^0.0.6 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>[
const Text('Hello',style: TextStyle(
fontSize: 30
),),
const Space(),
const Text('World',style: TextStyle(
fontSize: 30
),),
const Space(25),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
color: Colors.red,
height: 100,
width: 100,
),
const Space(50),
Container(
color: Colors.blue,
height: 100,
width: 100,
),
],
),
],
),
),
);
}
}