我是Flutter 翼新手.我想用IntroductionScreen小工具来制作全屏渐变背景色.然而,当我在盒子装饰中使用渐变 colored颜色 时,底部有白色的盒子空间.我不希望这种事发生.这是我的代码
return IntroductionScreen(
pages: [
PageViewModel(
title: "Hallo1",
body:
"Instead of having to buy an entire share, invest any amount you want.",
image: buildImage('assets/onboard1bg.png'),
decoration: buildDecoration(),
),
PageViewModel(
title: "Hallo2",
body:
"Instead of having to buy an entire share, invest any amount you want.",
image: buildImage('assets/onboard2bg.png'),
decoration: buildDecoration(),
),
],
showNextButton: false,
showDoneButton: false,
showSkipButton: false,
dotsDecorator: getDotDecoration(),
globalFooter: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: [
ElevatedButton(
child: Text(
'Login',
style: TextStyle(color: Colors.white),
),
onPressed: () {
CupertinoModalBottom(context, "Login", SignIn(), true);
},
style: ElevatedButton.styleFrom(
minimumSize: const Size.fromHeight(50),
primary: Colors.orange,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
),
),
],
),
),
);
}
DotsDecorator getDotDecoration() => DotsDecorator(
color: Colors.grey,
size: Size(15, 8),
activeColor: Colors.white,
activeSize: Size(25, 8),
activeShape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(24),
),
);
Widget buildImage(String path) => Center(child: Image.asset(path));
PageDecoration buildDecoration() => PageDecoration(
imagePadding: EdgeInsets.all(0),
boxDecoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
Color.fromRGBO(205, 193, 255, 1.0),
Color.fromARGB(255, 255, 79, 10),
Color.fromARGB(255, 255, 31, 31),
],
),
),
);
}
这就是它看起来的样子,我想做渐变色全屏.但是,并没有奏效