|
| 1 | +import 'package:dart_eval/dart_eval_bridge.dart'; |
| 2 | +import 'package:dart_eval/stdlib/core.dart'; |
| 3 | +import 'package:flutter/material.dart'; |
| 4 | +import 'package:flutter_eval/src/foundation/key.dart'; |
| 5 | +import 'package:flutter_eval/src/painting/edge_insets.dart'; |
| 6 | +import 'package:flutter_eval/src/sky_engine/ui/painting.dart'; |
| 7 | +import 'package:flutter_eval/src/widgets/framework.dart'; |
| 8 | + |
| 9 | +class $SwitchListTile implements $Instance { |
| 10 | + static const $type = BridgeTypeRef(BridgeTypeSpec( |
| 11 | + 'package:flutter/src/material/switch_list_tile.dart', 'SwitchListTile')); |
| 12 | + |
| 13 | + static const $declaration = BridgeClassDef( |
| 14 | + BridgeClassType($type, |
| 15 | + isAbstract: false, $extends: $StatelessWidget$bridge.$type), |
| 16 | + constructors: { |
| 17 | + '': BridgeConstructorDef(BridgeFunctionDef( |
| 18 | + returns: BridgeTypeAnnotation($type), |
| 19 | + namedParams: [ |
| 20 | + BridgeParameter('key', BridgeTypeAnnotation($Key.$type), true), |
| 21 | + BridgeParameter('value', |
| 22 | + BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.bool)), false), |
| 23 | + BridgeParameter( |
| 24 | + 'onChanged', |
| 25 | + BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.function), |
| 26 | + nullable: true), |
| 27 | + false), |
| 28 | + BridgeParameter( |
| 29 | + 'title', BridgeTypeAnnotation($Widget.$type), true), |
| 30 | + BridgeParameter( |
| 31 | + 'subtitle', BridgeTypeAnnotation($Widget.$type), true), |
| 32 | + BridgeParameter('isThreeLine', |
| 33 | + BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.bool)), true), |
| 34 | + BridgeParameter('dense', |
| 35 | + BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.bool)), true), |
| 36 | + BridgeParameter('contentPadding', |
| 37 | + BridgeTypeAnnotation($EdgeInsetsGeometry.$type), true), |
| 38 | + BridgeParameter('selected', |
| 39 | + BridgeTypeAnnotation(BridgeTypeRef(CoreTypes.bool)), true), |
| 40 | + BridgeParameter( |
| 41 | + 'activeColor', BridgeTypeAnnotation($Color.$type), true), |
| 42 | + BridgeParameter( |
| 43 | + 'secondary', BridgeTypeAnnotation($Widget.$type), true), |
| 44 | + ])) |
| 45 | + }, |
| 46 | + wrap: true); |
| 47 | + |
| 48 | + late final _superclass = $StatelessWidget.wrap($value); |
| 49 | + |
| 50 | + $SwitchListTile.wrap(this.$value); |
| 51 | + |
| 52 | + @override |
| 53 | + final SwitchListTile $value; |
| 54 | + |
| 55 | + static $Value? $new(Runtime runtime, $Value? target, List<$Value?> args) { |
| 56 | + return $SwitchListTile.wrap(SwitchListTile( |
| 57 | + key: args[0]?.$value, |
| 58 | + value: args[1]!.$value, |
| 59 | + onChanged: args[2] == null |
| 60 | + ? null |
| 61 | + : (value) => |
| 62 | + (args[2] as EvalCallable).call(runtime, null, [$bool(value)]), |
| 63 | + title: args[3]?.$value, |
| 64 | + subtitle: args[4]?.$value, |
| 65 | + isThreeLine: args[5]?.$value ?? false, |
| 66 | + dense: args[6]?.$value ?? false, |
| 67 | + contentPadding: args[7]?.$value, |
| 68 | + selected: args[8]?.$value ?? false, |
| 69 | + activeColor: args[9]?.$value, |
| 70 | + secondary: args[10]?.$value, |
| 71 | + )); |
| 72 | + } |
| 73 | + |
| 74 | + @override |
| 75 | + $Value? $getProperty(Runtime runtime, String identifier) { |
| 76 | + return _superclass.$getProperty(runtime, identifier); |
| 77 | + } |
| 78 | + |
| 79 | + @override |
| 80 | + get $reified => $value; |
| 81 | + |
| 82 | + @override |
| 83 | + int $getRuntimeType(Runtime runtime) => runtime.lookupType($type.spec!); |
| 84 | + |
| 85 | + @override |
| 86 | + void $setProperty(Runtime runtime, String identifier, $Value value) { |
| 87 | + return _superclass.$setProperty(runtime, identifier, value); |
| 88 | + } |
| 89 | +} |
0 commit comments