Skip to content

Device Frames

Efra Espada edited this page Jan 21, 2024 · 1 revision

The device frame support is backed by device_frame.

If your catalog page is using dummies, you can configure it to display the samples of your widget with a device frame.

This sample uses stringcare for string resources management.

import 'package:catalog/catalog.dart';
import 'package:example/r.dart';
import 'package:stringcare/stringcare.dart';

class MainScreenDummy extends PreviewDummy {

  Dummy get baseDummy => Dummy(
        parameters: {
          'title': R.strings.title_app.string(),
          'infoText': R.strings.info_text.string(),
          'incrementCounter': () {
            // nothing to do here
          },
          'counter': 12345,
        },
      );

  @override
  List<Dummy> get dummies => [
        baseDummy.copyWith(
          description: 'iPhone 13 Max sample screen',
          device: Device(
            deviceInfo: Devices.ios.iPhone13ProMax, // <-- add this
          ),
        ),
      ];
}

Clone this wiki locally