I have three widgets that I am trying to align on my screen in refernce to each other.
I have a golden border that I want to set as my background, the wheel in the center and the center of the wheel which is also a seperate asset.
I have aligned the assets using MediaQuery however every time I debug it on a different device the MediaQuery has some difference and the alignmnet isn't proper. This is how Im calling my widgets:
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: <Widget>[
//this is for the GOLDEN BORDER
Positioned(
top: MediaQuery.of(context).size.height * 0.082,
child: Image.asset(
'assets/app/border3.png',
height: MediaQuery.of(context).size.width,
)),
//This is the WHEEL
Column(
children: <Widget>[
SizedBox(height: MediaQuery.of(context).size.height * 0.344),
Container(
//color: Theme.of(context).primaryColor.withAlpha(180),
child: Center(
child: Winwheel(
handleCallback: ((handler) {
ctrl = handler;
}),
textFontFamily: 'Netflix',
controller: ctrl,
numSegments: 3,
outerRadius: MediaQuery.of(context).size.height * 0.41 / 2,
innerRadius: 28,
strokeStyle: Colors.white,
textFontSize: 20.0,
textFillStyle: Colors.white,
textFontWeight: FontWeight.bold,
textAlignment: WinwheelTextAlignment.center,
textOrientation: WinwheelTextOrientation.horizontal,
wheelImage: 'assets/app/spin2.png',
drawMode: WinwheelDrawMode.code,
drawText: true,
imageOverlay: false,
textMargin: 0,
pointerAngle: 0,
pointerGuide: PointerGuide(
display: true,
),
segments: <Segment>[
Segment(
textFontFamily: 'Netflix',
fillStyle: Color(0xff9b57fc),
textFillStyle: Colors.white,
text: '400',
strokeStyle: Colors.transparent),
Segment(
textFontFamily: 'Netflix',
fillStyle: Color(0xff17a8f9),
textFillStyle: Colors.white,
text: '400',
strokeStyle: Colors.transparent,
),
Segment(
textFontFamily: 'Netflix',
fillStyle: Colors.pink,
textFillStyle: Colors.white,
text: '900',
strokeStyle: Colors.transparent,
),
Segment(
textFontFamily: 'Netflix',
fillStyle: Color(0xffef225b),
textFillStyle: Colors.white,
text: '500',
strokeStyle: Colors.transparent,
),
],
pins: Pin(
visible: false,
number: 16,
margin: 6,
// outerRadius: 5,
fillStyle: Colors.transparent,
),
animation: WinwheelAnimation(
type: WinwheelAnimationType.spinToStop,
spins: 4,
duration: const Duration(
seconds: 15,
),
callbackFinished: (int segment) {
setState(() {
isPlaying = false;
});
print('animation finished');
print(segment);
},
callbackBefore: () {
setState(() {
isPlaying = true;
});
},
),
),
),
),
],
),
//This is the GOLDEN CENTER
Positioned(
top: MediaQuery.of(context).size.height * 0.285,
left: MediaQuery.of(context).size.width * 0.359,
child: Image.asset('assets/app/center.png',
height: MediaQuery.of(context).size.height * 0.16)),
],
),
);
}
I am using the winwheel dependency for the Spinning wheel. This is what the final output looks like. It isn't properly aligned in all devices even though it looks fine in the image

