Reputation: 181
I use setEnabledSystemUIOverlays to hide status bar and virtual button bar.
But there are blanks on the top and bottom of the screen (as seen in the photo):
Does anyone know how to solve it?
Here is my code:
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void main() {
SystemChrome.setEnabledSystemUIOverlays([]);
runApp(new MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: "Test",
home: new MyHomePage(title: "Test"),
);
}
}
class MyHomePage extends StatelessWidget {
final String title;
MyHomePage({Key key, this.title}) : super(key: key);
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(title),
),
body: new Container(
color: Colors.red,
),
);
}
}
Upvotes: 6
Views: 16208
Reputation: 1
// resizeToAvoidBottomInset: false
not work for me.Container.height = Get.height
// set max height
Container.child.image.fit = BoxFit.fill
// with thisflutter 2.2.0
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:lottie/lottie.dart';
import '../controllers/splash_controller.dart';
class SplashScreenView extends GetView<SplashController> {
final SplashController c = Get.find();
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
/// key! fix full screen
height: Get.height,
///
child: Lottie.asset(
/// image file:
AppConfig.splash1,
/// key! fix full screen
fit: BoxFit.fill,
///
controller: c.animationController,
frameRate: FrameRate(60),
repeat: true,
///
delegates: LottieDelegates(
text: (initialText) => 'test',
),
onLoaded: (composition) {
c.animationController..duration = composition.duration;
},
),
),
/// not work
// resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
);
}
}
Upvotes: 0
Reputation: 528
this it work perfect for me:
@override
Widget build(BuildContext context) {
// To make this screen full screen.
// It will hide status bar and notch.
SystemChrome.setEnabledSystemUIOverlays([]);
// full screen image for splash screen.
return Container(
child: new Image.asset('assets/splash.png', fit: BoxFit.fill));
}
}
import this
import 'package:flutter/services.dart';
Upvotes: 7
Reputation: 71
set resizeToAvoidBottomPadding: false to Scaffold.
return Scaffold(
resizeToAvoidBottomPadding: false,
);
Upvotes: 7