Line data Source code
1 : import 'package:flutter/material.dart'; 2 : 3 : class Resolution { 4 0 : Size get logicalSize => nativeSize / scaleFactor; 5 : final Size nativeSize; 6 : 7 : final double scaleFactor; 8 : 9 0 : factory Resolution.dimensions({ 10 : required double width, 11 : required double height, 12 : required double scaleFactor, 13 : }) { 14 0 : return Resolution( 15 0 : nativeSize: Size(width, height), 16 : scaleFactor: scaleFactor, 17 : ); 18 : } 19 : 20 4 : const Resolution({ 21 : required this.nativeSize, 22 : required this.scaleFactor, 23 : }); 24 : 25 0 : @override 26 : bool operator ==(Object other) { 27 : if (identical(this, other)) return true; 28 : 29 0 : return other is Resolution && 30 0 : other.nativeSize == nativeSize && 31 0 : other.scaleFactor == scaleFactor; 32 : } 33 : 34 1 : @override 35 5 : int get hashCode => nativeSize.hashCode ^ scaleFactor.hashCode; 36 : }