Home > other >  Flutter how to set an offset, based on screen ratio, without a context?
Flutter how to set an offset, based on screen ratio, without a context?

Time:02-02

I want to get the Offset of the middle of the screen, without using context. Is that possible?

Instead of working with pixels, I want to work with screen ratio. For instance, in order to get the center of the screen, I will set the Offset as the following Offset(0.5, 0.5).

CodePudding user response:

I don't think this is possible in base flutter. However the Get package allows you to do this and much much more without context https://pub.dev/packages/get .

  •  Tags:  
  • Related