-
Notifications
You must be signed in to change notification settings - Fork 81
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add convenience comparison operators for DeviceScreenType and Refined…
…Size
- Loading branch information
1 parent
62bc9ae
commit f7a4745
Showing
3 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.8.0 | ||
|
||
Adds comparison operators to DeviceScreenType and RefinedSize, for convenience. | ||
|
||
## 0.7.0 | ||
|
||
- Fixes #50 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,43 @@ | ||
import 'package:responsive_builder/responsive_builder.dart'; | ||
|
||
enum DeviceScreenType { | ||
@Deprecated('Use lowercase version') | ||
Mobile, | ||
Mobile(1), | ||
@Deprecated('Use lowercase version') | ||
Tablet, | ||
Tablet(2), | ||
@Deprecated('Use lowercase version') | ||
Desktop, | ||
Desktop(3), | ||
@Deprecated('Use lowercase version') | ||
Watch, | ||
mobile, | ||
tablet, | ||
desktop, | ||
watch | ||
Watch(0), | ||
mobile(1), | ||
tablet(2), | ||
desktop(3), | ||
watch(0); | ||
|
||
const DeviceScreenType(this._ordinal); | ||
|
||
final int _ordinal; | ||
|
||
bool operator >(DeviceScreenType other) => _ordinal > other._ordinal; | ||
|
||
bool operator >=(DeviceScreenType other) => _ordinal >= other._ordinal; | ||
|
||
bool operator <(DeviceScreenType other) => _ordinal < other._ordinal; | ||
|
||
bool operator <=(DeviceScreenType other) => _ordinal <= other._ordinal; | ||
} | ||
|
||
enum RefinedSize { small, normal, large, extraLarge } | ||
enum RefinedSize { | ||
small, | ||
normal, | ||
large, | ||
extraLarge; | ||
|
||
bool operator >(RefinedSize other) => index > other.index; | ||
|
||
bool operator >=(RefinedSize other) => index >= other.index; | ||
|
||
bool operator <(RefinedSize other) => index < other.index; | ||
|
||
bool operator <=(RefinedSize other) => index <= other.index; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters