📏 Adopt all the values to dp
instead of px
#30
Replies: 2 comments 5 replies
-
Hi @moazelsawaf, AFAIK, using dp values for positioning the floating view on the screen is not necessary because its position is calculated in pixels and is not dependent on the device's screen density. Using dp values for sizing the view is appropriate, as it helps to ensure that the view will be displayed consistently across devices with varying screen densities. Using dp for positioning the view would not offer any significant benefits and could potentially introduce compatibility issues. If you have any articles or resources to share about the benefits of using dp values for positioning views, I would be happy to take a look and learn more. Thank you for your suggestion! |
Beta Was this translation helpful? Give feedback.
-
I can see now the But what about the |
Beta Was this translation helpful? Give feedback.
-
Hello Dear,
I would like to suggest you adopting all the values to density-independent pixels (
dp
) instead of pixels (px
) as onbubble
,closeBubble
, andclosablePerimeter
to allow more responsive and convenient experience.For example, the
onMove(x ,y)
,onMove(x ,y)
, andonMove(x ,y)
callbacks are given theyx
andy
values inpx
so it would be difficult to use these values while consideringdp
as convention.Also while defining the
startLocation
of the bubble, it is defined with pixel (px
) value instead ofdp
, so it would be different across different devices due to different pixel densities.For me, as an autor of dash_bubble Flutter plugin, I have added two helper methods to do that conversion for me, so that the end developer is just using and excepting
dp
values as per the Flutter convention.Here are the two methods I have added:
I hope you like the suggestion and I am waiting for your feedback 🙏🏻
Thanks 🙏🏻❤
Beta Was this translation helpful? Give feedback.
All reactions