layout_simulator 0.3.0 copy "layout_simulator: ^0.3.0" to clipboard
layout_simulator: ^0.3.0 copied to clipboard

LayoutSimulator can simulate app layout with any screen size, orientation and text scale.

LayoutSimulator #

This package is inspired by DeviceSimulator.
LayoutSimulator can simulate app layout with any screen size, orientation and text scale.

Getting Started #

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

import 'package:layout_simulator/layout_simulator.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  ThemeMode _themeMode = ThemeMode.system;
  bool isEnabled = true;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData.light(),
      darkTheme: ThemeData.dark(),
      themeMode: _themeMode,
      home: FirstPage(),
      builder: (context, child) {
        if (kDebugMode) {
          return LayoutSimulator(
            enable: isEnabled,
            child: child ?? SizedBox(),
            onChangedThemeMode: (themeMode) {
              setState(() {
                this._themeMode = themeMode;
              });
            },
          );
        } else {
          return child ?? SizedBox();
        }
      },
    );
  }
}
14
likes
150
points
64
downloads

Publisher

unverified uploader

Weekly Downloads

LayoutSimulator can simulate app layout with any screen size, orientation and text scale.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on layout_simulator