Line data Source code
1 : import 'screen.dart'; 2 : 3 : class Organization { 4 : final int division; 5 : final double height; 6 : 7 4 : Organization({ 8 : required this.division, 9 : required this.height, 10 : }); 11 : 12 1 : Organization copyWith({ 13 : TypeScreen? type, 14 : int? division, 15 : double? height, 16 : }) { 17 1 : return Organization( 18 1 : division: division ?? this.division, 19 1 : height: height ?? this.height, 20 : ); 21 : } 22 : 23 1 : @override 24 : bool operator ==(Object other) { 25 : if (identical(this, other)) return true; 26 : 27 1 : return other is Organization && 28 3 : other.division == division && 29 0 : other.height == height; 30 : } 31 : 32 1 : @override 33 5 : int get hashCode => division.hashCode ^ height.hashCode; 34 : } 35 : 36 : extension OrganizationExt on String { 37 2 : double get parseHeight { 38 2 : final operator = this.substring(1, 2); 39 2 : final value = operator == "/" 40 6 : ? 1 / double.parse(this.substring(2)) 41 2 : : double.parse(this.substring(2)); 42 : return value; 43 : } 44 : 45 2 : TypeScreen get parseScreen { 46 2 : if (this == "lg") { 47 : return TypeScreen.lg; 48 2 : } else if (this == "md") { 49 : return TypeScreen.md; 50 2 : } else if (this == "sm") { 51 : return TypeScreen.sm; 52 : } else { 53 : return TypeScreen.xs; 54 : } 55 : } 56 : }