Skip to content

Commit 0bb13ca

Browse files
author
github-actions
committed
Prepare version 0.8.1
1 parent cc0e1fa commit 0bb13ca

20 files changed

Lines changed: 164 additions & 90 deletions

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## [0.8.1]
4+
5+
- Released @ 6/2025 (UTC)
6+
- chore: Update dependencies
7+
38
## [0.8.0]
49

510
- Released @ 3/2025 (UTC)

example/lib/main.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@ final class ExampleScreenController extends ScreenController {
3333
ExampleScreenController(super.screen, super.state);
3434
}
3535

36-
final class ExampleScreenState extends AdaptiveScreenState<ExampleScreen, ExampleScreenController> {
36+
final class ExampleScreenState
37+
extends AdaptiveScreenState<ExampleScreen, ExampleScreenController> {
3738
@override
3839
Widget wideBody(BuildContext context) {
3940
return Container(

lib/df_screen.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ export 'src/_src.g.dart';
1919
export 'package:df_collection/df_collection.dart';
2020
export 'package:df_config/df_config.dart';
2121
export 'package:df_di/df_di.dart';
22-
export 'package:df_generate_dart_models_core/df_generate_dart_models_core.dart' hide Sequential, Finisher;
22+
export 'package:df_generate_dart_models_core/df_generate_dart_models_core.dart'
23+
hide Sequential, Finisher;
2324
export 'package:df_router/df_router.dart';
2425
export 'package:df_scalable/df_scalable.dart';
2526
export 'package:df_screen_core/df_screen_core.dart';

lib/src/_src.g.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ export './screen_states/adaptive_screen_state/adaptive_screen_state.dart';
1919
export './screen_controller.dart';
2020
export './screen_state.dart';
2121
export './app_layout.dart';
22-
export './screen.dart';
22+
export './screen.dart';

lib/src/_utils/_utils.g.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@
1010
export './view_insets_builder.dart';
1111
export './current_platform.dart';
1212
export './screen_calculator.dart';
13-
export './surface.dart';
13+
export './surface.dart';

lib/src/_utils/screen_calculator.dart

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,29 @@ const MIN_MOBILE_ASPECT_RATIO = 4.0 / 3.0;
9595

9696
/// The smallest of the following common aspect ratios for mobile phones (4.0 / 3.0)
9797
double get minMobileAspectRatio => {
98-
// Samsungs
99-
16.0 / 10.0,
100-
// Pixels, Samsungs
101-
16.0 / 9.0,
102-
// Pixels, most iPhones before 2018
103-
18.0 / 9.0,
104-
// Pixels
105-
18.5 / 9.0,
106-
18.7 / 9.0,
107-
19.0 / 10.0,
108-
// Pixels
109-
19.0 / 9.0,
110-
// Pixels and most iPhones after 2018
111-
19.5 / 9.0,
112-
3.0 / 2.0,
113-
// Old iPhones, and many tablets!
114-
4.0 / 3.0,
115-
5.0 / 3.0,
116-
// Samsungs
117-
2.10 / 1,
118-
20.0 / 9.0,
119-
193 / 90,
120-
}.reduce((a, b) => a <= b ? a : b);
98+
// Samsungs
99+
16.0 / 10.0,
100+
// Pixels, Samsungs
101+
16.0 / 9.0,
102+
// Pixels, most iPhones before 2018
103+
18.0 / 9.0,
104+
// Pixels
105+
18.5 / 9.0,
106+
18.7 / 9.0,
107+
19.0 / 10.0,
108+
// Pixels
109+
19.0 / 9.0,
110+
// Pixels and most iPhones after 2018
111+
19.5 / 9.0,
112+
3.0 / 2.0,
113+
// Old iPhones, and many tablets!
114+
4.0 / 3.0,
115+
5.0 / 3.0,
116+
// Samsungs
117+
2.10 / 1,
118+
20.0 / 9.0,
119+
193 / 90,
120+
}.reduce((a, b) => a <= b ? a : b);
121121

122122
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
123123

lib/src/_utils/surface.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Surface extends StatelessWidget {
5555
final $borderRadius = decoration?.borderRadius ?? borderRadius;
5656
final $decoration =
5757
decoration?.copyWith(color: $color, borderRadius: $borderRadius) ??
58-
BoxDecoration(color: $color, borderRadius: $borderRadius);
58+
BoxDecoration(color: $color, borderRadius: $borderRadius);
5959
return ClipRRect(
6060
borderRadius: $borderRadius,
6161
child: Container(

lib/src/_utils/view_insets_builder.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,13 @@ class _State extends State<ViewInsetsBuilder> with WidgetsBindingObserver {
9797

9898
void _updateViewInsets() {
9999
final viewInsets = View.of(context).viewInsets;
100-
final reachedMax = viewInsets.top > _viewInsets.top ||
100+
final reachedMax =
101+
viewInsets.top > _viewInsets.top ||
101102
viewInsets.bottom > _viewInsets.bottom ||
102103
viewInsets.left > _viewInsets.left ||
103104
viewInsets.right > _viewInsets.right;
104-
final reachedMin = viewInsets.top == 0 &&
105+
final reachedMin =
106+
viewInsets.top == 0 &&
105107
viewInsets.bottom == 0 &&
106108
viewInsets.left == 0 &&
107109
viewInsets.right == 0;

lib/src/adaptive_layout_builder.dart

Lines changed: 61 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
3838
final Widget Function(BuildContext, Widget, EdgeInsets)? alignBuilder;
3939

4040
/// Presentation of body, background, and foreground
41-
final Widget Function(BuildContext, Widget, Widget, Widget)? presentationBuilder;
41+
final Widget Function(BuildContext, Widget, Widget, Widget)?
42+
presentationBuilder;
4243

4344
/// Side insets calculation
4445
final EdgeInsets Function(BuildContext, EdgeInsets)? sideInsetsBuilder;
@@ -79,31 +80,63 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
7980
body = paddingBuilder?.call(context, body) ?? body;
8081

8182
// Build side widgets
82-
final topSide = topSideBuilder?.call(context, MediaQuery.of(context).viewInsets.top) ??
83+
final topSide =
84+
topSideBuilder?.call(
85+
context,
86+
MediaQuery.of(context).viewInsets.top,
87+
) ??
8388
const SizedBox.shrink();
8489
final bottomSide =
85-
bottomSideBuilder?.call(context, MediaQuery.of(context).viewInsets.bottom) ??
86-
const SizedBox.shrink();
87-
final leftSide = leftSideBuilder?.call(context, MediaQuery.of(context).viewInsets.left) ??
90+
bottomSideBuilder?.call(
91+
context,
92+
MediaQuery.of(context).viewInsets.bottom,
93+
) ??
94+
const SizedBox.shrink();
95+
final leftSide =
96+
leftSideBuilder?.call(
97+
context,
98+
MediaQuery.of(context).viewInsets.left,
99+
) ??
88100
const SizedBox.shrink();
89101
final rightSide =
90-
rightSideBuilder?.call(context, MediaQuery.of(context).viewInsets.right) ??
91-
const SizedBox.shrink();
102+
rightSideBuilder?.call(
103+
context,
104+
MediaQuery.of(context).viewInsets.right,
105+
) ??
106+
const SizedBox.shrink();
92107

93108
// Calculate side insets
94-
final sideInsets = sideInsetsBuilder?.call(
109+
final sideInsets =
110+
sideInsetsBuilder?.call(
95111
context,
96112
EdgeInsets.only(
97-
left: letAsOrNull<PreferredSizeWidget>(leftSide)?.preferredSize.width ?? 0.0,
98-
right: letAsOrNull<PreferredSizeWidget>(rightSide)?.preferredSize.width ?? 0.0,
99-
top: letAsOrNull<PreferredSizeWidget>(topSide)?.preferredSize.height ?? 0.0,
100-
bottom: letAsOrNull<PreferredSizeWidget>(bottomSide)?.preferredSize.height ?? 0.0,
113+
left:
114+
letAsOrNull<PreferredSizeWidget>(
115+
leftSide,
116+
)?.preferredSize.width ??
117+
0.0,
118+
right:
119+
letAsOrNull<PreferredSizeWidget>(
120+
rightSide,
121+
)?.preferredSize.width ??
122+
0.0,
123+
top:
124+
letAsOrNull<PreferredSizeWidget>(
125+
topSide,
126+
)?.preferredSize.height ??
127+
0.0,
128+
bottom:
129+
letAsOrNull<PreferredSizeWidget>(
130+
bottomSide,
131+
)?.preferredSize.height ??
132+
0.0,
101133
),
102134
) ??
103135
EdgeInsets.zero;
104136

105137
// Align body with side insets
106-
body = alignBuilder?.call(context, body, sideInsets) ??
138+
body =
139+
alignBuilder?.call(context, body, sideInsets) ??
107140
_defaultAlign(context, body, sideInsets);
108141

109142
// Combine body with side widgets
@@ -119,7 +152,9 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
119152
children: [
120153
topSide is PreferredSizeWidget
121154
? ConstrainedBox(
122-
constraints: BoxConstraints.loose(topSide.preferredSize),
155+
constraints: BoxConstraints.loose(
156+
topSide.preferredSize,
157+
),
123158
child: topSide,
124159
)
125160
: topSide,
@@ -131,14 +166,18 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
131166
children: [
132167
leftSide is PreferredSizeWidget
133168
? ConstrainedBox(
134-
constraints: BoxConstraints.loose(leftSide.preferredSize),
169+
constraints: BoxConstraints.loose(
170+
leftSide.preferredSize,
171+
),
135172
child: leftSide,
136173
)
137174
: leftSide,
138175
const Spacer(),
139176
rightSide is PreferredSizeWidget
140177
? ConstrainedBox(
141-
constraints: BoxConstraints.loose(rightSide.preferredSize),
178+
constraints: BoxConstraints.loose(
179+
rightSide.preferredSize,
180+
),
142181
child: rightSide,
143182
)
144183
: rightSide,
@@ -147,7 +186,9 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
147186
),
148187
bottomSide is PreferredSizeWidget
149188
? ConstrainedBox(
150-
constraints: BoxConstraints.loose(bottomSide.preferredSize),
189+
constraints: BoxConstraints.loose(
190+
bottomSide.preferredSize,
191+
),
151192
child: bottomSide,
152193
)
153194
: bottomSide,
@@ -157,7 +198,8 @@ class AdaptiveLayoutBuilder extends StatelessWidget {
157198
);
158199

159200
// Apply presentation
160-
body = presentationBuilder?.call(
201+
body =
202+
presentationBuilder?.call(
161203
context,
162204
body,
163205
backgroundBuilder?.call(context) ?? _defaultBackground(context),
@@ -238,10 +280,7 @@ Widget _defaultPresentation(
238280
fit: StackFit.expand,
239281
children: [
240282
background,
241-
Padding(
242-
padding: MediaQuery.viewInsetsOf(context),
243-
child: body,
244-
),
283+
Padding(padding: MediaQuery.viewInsetsOf(context), child: body),
245284
foreground,
246285
],
247286
);

lib/src/app_layout.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ enum AppLayout {
5858
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
5959

6060
ScreenCalculator getCurrentScreenCalculator() {
61-
final firstDisplay = WidgetsBinding.instance.platformDispatcher.displays.first;
61+
final firstDisplay =
62+
WidgetsBinding.instance.platformDispatcher.displays.first;
6263
final displaySize = firstDisplay.size;
6364
final displayPixelRatio = firstDisplay.devicePixelRatio;
6465
final screenSize = displaySize / displayPixelRatio;

0 commit comments

Comments
 (0)