Android 我无法解决颤振启动屏幕的尺寸问题
我在启动屏幕中使用的GIF大小没有全屏显示Android 我无法解决颤振启动屏幕的尺寸问题,android,android-studio,flutter,resize,animated-gif,Android,Android Studio,Flutter,Resize,Animated Gif,我在启动屏幕中使用的GIF大小没有全屏显示 import 'package:flutter/material.dart'; import 'package:moms_kitchen/login_page.dart'; import 'package:splashscreen/splashscreen.dart'; void main() { runApp(new MaterialApp( debugShowCheckedModeBanner: false, home: n
import 'package:flutter/material.dart';
import 'package:moms_kitchen/login_page.dart';
import 'package:splashscreen/splashscreen.dart';
void main() {
runApp(new MaterialApp(
debugShowCheckedModeBanner: false,
home: new MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Center(
child: SplashScreen(
seconds: 6,
backgroundColor: Colors.white,
image: new Image.asset('assets/splash1.gif'),
loaderColor: Colors.white,
photoSize: 250,
navigateAfterSeconds: MainScreen(),
),
);
}
}
class MainScreen extends StatefulWidget {
@override
_MainScreenState createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Mom's Kitchen",
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
fontFamily: 'LeonSans'),
home: LoginPage(),
debugShowCheckedModeBanner: false,
);
}
}
我想在整个屏幕上显示这个GIT
请帮助我或建议我如何在全屏上显示它
import 'package:flutter/material.dart';
import 'package:moms_kitchen/login_page.dart';
import 'package:splashscreen/splashscreen.dart';
void main() {
runApp(new MaterialApp(
debugShowCheckedModeBanner: false,
home: new MyApp(),
));
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return Center(
child: SplashScreen(
seconds: 6,
backgroundColor: Colors.white,
image: new Image.asset('assets/splash1.gif'),
loaderColor: Colors.white,
photoSize: 250,
navigateAfterSeconds: MainScreen(),
),
);
}
}
class MainScreen extends StatefulWidget {
@override
_MainScreenState createState() => _MainScreenState();
}
class _MainScreenState extends State<MainScreen> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Mom's Kitchen",
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
fontFamily: 'LeonSans'),
home: LoginPage(),
debugShowCheckedModeBanner: false,
);
}
}
导入“包装:颤振/材料.省道”;
导入“package:moms_kitchen/login_page.dart”;
导入“包:splashscreen/splashscreen.dart”;
void main(){
runApp(新材料)PP(
debugShowCheckedModeBanner:false,
主页:新建MyApp(),
));
}
类MyApp扩展了StatefulWidget{
@凌驾
_MyAppState createState()=>new_MyAppState();
}
类MyAppState扩展了状态{
@凌驾
小部件构建(构建上下文){
返回中心(
孩子:飞溅屏幕(
秒:6,
背景颜色:Colors.white,
image:newimage.asset('assets/splash1.gif'),
装载颜色:颜色。白色,
照片大小:250,
navigateAfterSeconds:MainScreen(),
),
);
}
}
类MainScreen扩展StatefulWidget{
@凌驾
_MainScreenState createState()=>\u MainScreenState();
}
类_MainScreenState扩展状态{
@凌驾
小部件构建(构建上下文){
返回材料PP(
标题:“妈妈的厨房”,
主题:主题数据(
主样本:颜色。蓝色,
视觉密度:视觉密度。自适应平台密度,
fontFamily:“LeonSans”,
主页:登录页面(),
debugShowCheckedModeBanner:false,
);
}
}
来自此
backgroundColor: Colors.white,
image: new Image.asset('assets/splash1.gif'),
loaderColor: Colors.white,
photoSize: 250,
您正在将高度设置为250
要获得设备屏幕高度,您可以通过
var height=MediaQuery.of(context).size.height* 1;
然后使用高度作为你的照片大小试试这样的方法可能会有所帮助
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
将您的
SplashScreen
小部件包装在一个容器中
一种小部件,通过足够的填充插入其子部件,以避免操作系统的入侵
例如,这将使子项缩进足够多,以避免屏幕顶部的状态栏
然后将图像
参数包装在带有设备尺寸的容器中
安全区(
孩子:飞溅屏幕(
...
图片:集装箱(
子级:Image.asset('assets/splash1.gif'),
宽度:MediaQuery.of(context).size.width,
高度:MediaQuery.of(context).size.height,
),
),
),
对于宽度?var height=MediaQuery.of(context).size.height*1;在这个变量中,我的程序中出现了错误width:MediaQuery.of(context)。size.width,height:MediaQuery.of(context)。size.height,return-SafeArea(child:SplashScreen(秒:6,backgroundColor:Colors.white,image:Container(child:image.asset('assets/splash1.gif'),width:MediaQuery.of(context).size.width,height:MediaQuery.of(context).size.height,),//loaderColor:Colors.white,//photoSize:250,navigateAfterSeconds:MainScreen(),),);然后它的不工作错误是“aurgument类型容器无法分配给参数类型image”