-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create 'Layout' utility class (#184)
- Loading branch information
Showing
6 changed files
with
41 additions
and
56 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:commet/config/build_config.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
|
||
class Layout { | ||
static bool get desktop { | ||
if (BuildConfig.DESKTOP) { | ||
return true; | ||
} | ||
|
||
return !_isPortrait(); | ||
} | ||
|
||
static bool get mobile { | ||
if (BuildConfig.MOBILE) { | ||
return true; | ||
} | ||
|
||
return _isPortrait(); | ||
} | ||
|
||
static bool _isPortrait() { | ||
var view = WidgetsBinding.instance.platformDispatcher.views.first; | ||
var size = view.physicalSize; | ||
|
||
return size.height > size.width; | ||
} | ||
} |
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
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
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
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
This file was deleted.
Oops, something went wrong.