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

outdated

A lightweight library for implementing Responsive layout grid. Provide body, column, marging.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:breakpoints_mq/breakpoints_mq.dart';

void main() {
  runApp(const App());
}

class App extends StatelessWidget {
  const App({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Breakpoints Demo',
      theme: ThemeData.from(colorScheme: ColorScheme.light()),
      darkTheme: ThemeData.from(colorScheme: ColorScheme.dark()),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final data = MediaQuery.of(context);
    final breakpoint = data.breakpoint;

    return Scaffold(
      appBar: AppBar(
        title: const Text('Breakpoints Demo'),
      ),
      body: Padding(
        padding: EdgeInsets.symmetric(
          horizontal: breakpoint.margin,
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            Padding(
              padding: const EdgeInsets.all(8),
              child: Text('Screen Size: ${data.size.toString()}'),
            ),
            Padding(
              padding: const EdgeInsets.all(8),
              child: Text('Breakpoint: ${breakpoint.toString()}'),
            ),
            Expanded(
              child: GridView.count(
                crossAxisCount: breakpoint.column,
                children: List.generate(
                  100,
                  (index) => Card(
                    child: Center(
                      child: Text('No.${index + 1}'),
                    ),
                  ),
                ),
              ),
            )
          ],
        ),
      ),
    );
  }
}
0
likes
0
points
883
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight library for implementing Responsive layout grid. Provide body, column, marging.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on breakpoints_mq