Line data Source code
1 : import 'package:meta/meta.dart'; 2 : import 'package:widgetbook_annotation/widgetbook_annotation.dart'; 3 : import 'package:widgetbook_generator/code_generators/instances/device_type_instance.dart'; 4 : import 'package:widgetbook_generator/code_generators/instances/instance.dart'; 5 : import 'package:widgetbook_generator/code_generators/instances/resolution_instance.dart'; 6 : import 'package:widgetbook_generator/code_generators/properties/property.dart'; 7 : 8 : @immutable 9 : 10 : /// An instance of [Device] 11 : class DeviceInstance extends Instance { 12 : /// Creates a new instance of [DeviceInstance] 13 2 : DeviceInstance({ 14 : required Device device, 15 2 : }) : super( 16 : name: 'Device', 17 2 : properties: [ 18 2 : Property.string( 19 : key: 'name', 20 2 : value: device.name, 21 : ), 22 2 : Property( 23 : key: 'resolution', 24 2 : instance: ResolutionInstance( 25 2 : resolution: device.resolution, 26 : ), 27 : ), 28 2 : Property( 29 : key: 'type', 30 2 : instance: DeviceTypeInstance( 31 2 : deviceType: device.type, 32 : ), 33 : ), 34 : ], 35 : ); 36 : }