I have background image in my application but that is not full screen on different devices on tabs it show white space from top and bottom and on some devices it shows white spaces left and right I have checked this property fit: BoxFit.fill, fit: BoxFit.cover, and fit: BoxFit.contain, all these 3 properties not working.
import 'package:flutter/material.dart';
import 'package:launch_review/launch_review.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:sweetalert/sweetalert.dart';
import 'news.dart';
import 'Social.dart';
import 'liveStreaming.dart';
import 'Contactus.dart';
const url = 'link is here';
class won extends StatelessWidget {
@override
Widget build(BuildContext context) {
Future<bool> _onBackPressed() {
return showDialog(
context: context,
builder: (context) => AlertDialog(
title: Text("Do you want to exit?"),
actions: <Widget>[
FlatButton(
onPressed: () {
Navigator.pop(context, false);
},
child: Text("No")),
FlatButton(
onPressed: () {
Navigator.pop(context, true);
},
child: Text("yes"))
],
));
}
return WillPopScope(
child: Scaffold(
body: Center(
child: Stack(
children: <Widget>[
Center(
child: Image.asset(
'imges/bg.png',
fit: BoxFit.fill,
),
),
],
),
),
), onWillPop: _onBackPressed,
);
}
}
void Orientatoin() {
SystemChrome.setPreferredOrientations(
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
}
If you want it to be full screen wrap your image on a SizedBox.expand widget and not on a Center one.