Skip to content

Commit

Permalink
feat: 发布新版本 修改简介 格式化文件
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanRaw committed Apr 21, 2021
1 parent 0caebc8 commit d8bb532
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,8 @@

* TODO: Null safety

## [0.2.1] - TODO: Add release date.

* TODO: Null safety


40 changes: 21 additions & 19 deletions lib/screen_adaptation_init.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,31 @@ class ScreenAdaptationInit extends StatelessWidget {
final Size? landscapeSize;
final bool allowFontScaling;

ScreenAdaptationInit({required this.child, this.size = const Size(
750, 1337), this.allowFontScaling = false, this.landscapeSize});
ScreenAdaptationInit(
{required this.child,
this.size = const Size(750, 1337),
this.allowFontScaling = false,
this.landscapeSize});

@override
Widget build(BuildContext context) {
return OrientationBuilder(
builder: (BuildContext context, Orientation orientation) {
final mediaQuery = MediaQuery.of(context);
ScreenAdaptationUtil.instance = ScreenAdaptationUtil(
width: size.width,
height: size.height,
landscapeWidth: landscapeSize?.width,
landscapeHeight: landscapeSize?.height,
allowFontScaling: allowFontScaling,
orientation: orientation,
screenWidth: mediaQuery.size.width,
screenHeight: mediaQuery.size.height,
statusBarHeight: mediaQuery.padding.top,
bottomBarHeight: mediaQuery.padding.bottom,
textScaleFactor: mediaQuery.textScaleFactor,
pixelRatio: mediaQuery.devicePixelRatio
);
return child;
});
final mediaQuery = MediaQuery.of(context);
ScreenAdaptationUtil.instance = ScreenAdaptationUtil(
width: size.width,
height: size.height,
landscapeWidth: landscapeSize?.width,
landscapeHeight: landscapeSize?.height,
allowFontScaling: allowFontScaling,
orientation: orientation,
screenWidth: mediaQuery.size.width,
screenHeight: mediaQuery.size.height,
statusBarHeight: mediaQuery.padding.top,
bottomBarHeight: mediaQuery.padding.bottom,
textScaleFactor: mediaQuery.textScaleFactor,
pixelRatio: mediaQuery.devicePixelRatio);
return child;
});
}
}
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: screen_adaptation
description: screen adaptation
version: 0.2.0-nullsafety.0
description: A flutter plugin for adapting screen and font size.Rotation automatically updates the UI.
version: 0.2.1
homepage: https://github.com/UseZwb
repository: https://github.com/UseZwb/screen_adaptation
issue_tracker: https://github.com/UseZwb/screen_adaptation/issues
Expand Down

0 comments on commit d8bb532

Please sign in to comment.