center_the_widgets 2.0.0 copy "center_the_widgets: ^2.0.0" to clipboard
center_the_widgets: ^2.0.0 copied to clipboard

Keep mobile-first Flutter layouts centered and readable on web, desktop, tablets, and other large screens.

example/lib/main.dart

import 'package:flutter/material.dart';

import 'package:center_the_widgets/center_the_widgets.dart';

void main() {
  runApp(
    const MaterialApp(
      home: CenterTheWidgets(
        color: Colors.blueGrey,
        child: Example(),
      ),
    ),
  );
}

class Example extends StatelessWidget {
  const Example({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('CenterTheWidgets example'),
      ),
      body: Center(
        child: Container(
          margin: const EdgeInsets.symmetric(horizontal: 32),
          width: 200000,
          height: 300,
          color: Colors.orange,
          alignment: Alignment.center,
          child: const Text('Some widgets...'),
        ),
      ),
      bottomSheet: Container(
        color: Colors.green,
        width: MediaQuery.of(context).size.width,
        padding: const EdgeInsets.symmetric(vertical: 16),
        child: const Text(
          'Bottom sheets stay inside the centered surface too.',
          textAlign: TextAlign.center,
        ),
      ),
    );
  }
}
4
likes
160
points
89
downloads
screenshot

Documentation

API reference

Publisher

verified publishergabrimatic.info

Weekly Downloads

Keep mobile-first Flutter layouts centered and readable on web, desktop, tablets, and other large screens.

Repository (GitHub)
View/report issues

Topics

#flutter #responsive #layout #widget #web

Funding

Consider supporting this project:

www.buymeacoffee.com

License

MIT (license)

Dependencies

flutter

More

Packages that depend on center_the_widgets