Skip to content

Commit

Permalink
Revert "修正宽度和高度为无视屏幕的方向"
Browse files Browse the repository at this point in the history
This reverts commit dc21e4a.
  • Loading branch information
zhuoyuan committed Apr 29, 2022
1 parent 55c49a1 commit 8e7570e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
1 change: 0 additions & 1 deletion example/lib/src/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class HomePageScaffold extends StatelessWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
TextField(),
Row(
children: <Widget>[
// Using Extensions
Expand Down
38 changes: 4 additions & 34 deletions lib/src/screen_util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -121,43 +121,13 @@ class ScreenUtil {

/// 当前设备宽度 dp
/// The horizontal extent of this size.
double get screenWidth {
if (_orientation == Orientation.landscape) {
return (context != null
? MediaQuery.of(context!).size.height
: _screenHeight);
}
return context != null ? MediaQuery.of(context!).size.width : _screenWidth;
}
double get screenWidth =>
context != null ? MediaQuery.of(context!).size.width : _screenWidth;

///当前设备高度 dp
///The vertical extent of this size. dp
double get screenHeight {
if (_orientation == Orientation.landscape) {
return context != null
? MediaQuery.of(context!).size.width
: _screenWidth;
}
return context != null
? MediaQuery.of(context!).size.height
: _screenHeight;
}

Size get screenSize {
if (_orientation == Orientation.landscape) {
double width = (context != null
? MediaQuery.of(context!).size.height
: _screenHeight) +
bottomBarHeight;
double height =
(context != null ? MediaQuery.of(context!).size.width : _screenWidth);

return Size(width, height);
}
return Size(
context != null ? MediaQuery.of(context!).size.width : _screenWidth,
context != null ? MediaQuery.of(context!).size.height : _screenHeight);
}
double get screenHeight =>
context != null ? MediaQuery.of(context!).size.height : _screenHeight;

/// 状态栏高度 dp 刘海屏会更高
/// The offset from the top, in dp
Expand Down

0 comments on commit 8e7570e

Please sign in to comment.