Simulated class

A widget for fitting your app into a device frame image.

When using Simulated, please use runPkg instead of runApp. This is to ensure that the viewPadding settings are applied correctly.

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

void main() {
  runPkg(
    Directionality(
      textDirection: TextDirection.ltr,
      child: Simulated(
        innerScreenSize: const Size(1658, 3588),
        innerScreenOffset: const Size(116, 103),
        originalLogicalScreenSize: const Size(414, 896),
        deviceFrameImage: Image.asset('assets/example_device_frame.png'),
        viewPadding:
        const PhysicalViewPadding(left: 0, top: 68, right: 0, bottom: 66),
        child: const MyAwesomeApp(),
      ),
    ),
  );
}

class MyAwesomeApp extends StatelessWidget {
  const MyAwesomeApp();
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        home: Scaffold(
            appBar: AppBar(title: Text("My Awesome App")),
            body: ElevatedButton(child: Text('foobar'), onPressed: () {})));
  }
}
Inheritance

Constructors

Simulated({required Image deviceFrameImage, required Size innerScreenSize, required Size innerScreenOffset, required PhysicalViewPadding viewPadding, required Size originalLogicalScreenSize, Locale? locale, required Widget child, Key? key})
const
Simulated.sample({required Widget child, Locale? locale, Key? key})
By using this constructor, you can use a very simple sample device frame image. It is not recommended to use this for the actual screenshots for the store.
const

Properties

child Widget
Your app for combining with the device image.
final
deviceFrameImage Image
An Image widget to display the image of the device you want to combine.
final
hashCode int
The hash code for this object.
no setterinherited
innerScreenOffset Size
The offset from the top left corner to the screen in the device image.
final
innerScreenSize Size
The size of the screen in the device image.
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
locale Locale?
If you want to specify the language settings of the device to be reproduced, set this argument.
final
originalLogicalScreenSize Size
The number of original LOGICAL pixels of the device being used as the device image.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
viewPadding PhysicalViewPadding
The part of the display that is partially hidden by the system UI. This allows you to represent parts of the display that are hidden by the hardware display "notch" or the system status bar.
final

Methods

build(BuildContext context) Widget
Describes the part of the user interface represented by this widget.
override
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree.
inherited
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited