Skip to content

Commit

Permalink
Default to pixel ratio
Browse files Browse the repository at this point in the history
Resolves ABausG#205
  • Loading branch information
ueman committed Oct 2, 2024
1 parent eef1d9e commit cf3a043
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/home_widget/lib/src/home_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,11 @@ class HomeWidget {
Widget widget, {
required String key,
Size logicalSize = const Size(200, 200),
double pixelRatio = 1,
double? pixelRatio,
}) async {
pixelRatio ??=
PlatformDispatcher.instance.implicitView?.devicePixelRatio ?? 1;

/// finding the widget in the current context by the key.
final RenderRepaintBoundary repaintBoundary = RenderRepaintBoundary();

Expand All @@ -174,7 +177,7 @@ class HomeWidget {
),
configuration: ViewConfiguration(
logicalConstraints: BoxConstraints.tight(logicalSize),
devicePixelRatio: 1.0,
devicePixelRatio: pixelRatio,
),
);

Expand All @@ -193,9 +196,7 @@ class HomeWidget {
child: Column(
// image is center aligned
mainAxisAlignment: MainAxisAlignment.center,
children: [
widget,
],
children: [widget],
),
),
).attachToRenderTree(buildOwner);
Expand Down

0 comments on commit cf3a043

Please sign in to comment.