layout_simulator 0.1.2 copy "layout_simulator: ^0.1.2" to clipboard
layout_simulator: ^0.1.2 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();
        }
      },
    );
  }
}
13
likes
90
pub points
68%
popularity

Publisher

unverified uploader

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