adaptive_layout 0.1.7 copy "adaptive_layout: ^0.1.7" to clipboard
adaptive_layout: ^0.1.7 copied to clipboard

A flutter package that facilitates implementing layouts that adapt to different screen widths.

example/lib/main.dart

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

void main() {
  /// Optionally set custom breakpoints for medium and/or large screens.
  AdaptiveLayout.setBreakpoints(
    mediumScreenMinWidth: 600,
    largeScreenMinWidth: 1200,
  );

  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Adaptive Layout Demo',
      home: Scaffold(
        /// Use AdaptiveLayout
        body: AdaptiveLayout(
          smallLayout: MyContainer(color: Colors.amber),
          mediumLayout: MyContainer(color: Colors.red[200]),
          largeLayout: MyContainer(color: Colors.green[200]),
        ),
      ),
    );
  }
}

/// Any widget
class MyContainer extends StatelessWidget {
  const MyContainer({
    Key? key,
    this.color,
  }) : super(key: key);

  final Color? color;

  @override
  Widget build(BuildContext context) {
    return Container(
      color: color,
      child: Center(
        child: Text(
          'See how the color of my container is different on different screen widths.',
        ),
      ),
    );
  }
}
16
likes
160
points
105
downloads

Publisher

verified publishertoureholder.com

Weekly Downloads

A flutter package that facilitates implementing layouts that adapt to different screen widths.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on adaptive_layout