Flutter Obtenha largura da tela
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
Lively Lizard
double height = MediaQuery.of(context).size.height;
double width = MediaQuery.of(context).size.width;
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
getHeightWidth(context){
double width = MediaQuery.of(context).size.width;
double height = MediaQuery.of(context).size.height;
setState(() {
heightHolder = height.roundToDouble();
widthHolder = width.roundToDouble() ;
});
}
//In logical pixels
var width = MediaQuery.of(context).size.width;
var height = MediaQuery.of(context).size.height;
var padding = MediaQuery.of(context).padding;
var safeHeight = height - padding.top - padding.bottom;
import 'package:flutter_screenutil/flutter_screenutil.dart';
dependencies:
flutter:
sdk: flutter
# add flutter_ScreenUtil
flutter_screenutil: ^0.4.2