提问人:Samruddhi Chavan 提问时间:10/16/2023 最后编辑:DavisSamruddhi Chavan 更新时间:10/16/2023 访问量:53
修复整个屏幕的背景屏幕
fix the background screen for the whole screen
问:
我在这里设置了背景图像,但它没有为整个屏幕渲染。它只出现在SVG法师的背景上。我希望它作为整个屏幕的背景,并且svg图像应该在屏幕的中央。
class IntroScreen extends StatelessWidget {
IntroScreen({Key? key}) : super(key: key);
final List<PageViewModel> pages = [
PageViewModel(
title: '', // Empty title
body: '', // Empty body
image: Center(
child: Stack(
alignment: Alignment.bottomCenter,
children: [
// Background image
Container(
// width: mediaQueryData.size.i,
// height: mediaQueryData.size.height,
decoration: BoxDecoration(
// color: theme.colorScheme.onPrimary.withOpacity(1),
image: DecorationImage(
image: AssetImage('assets/images/img_bgplain1.png'),
fit: BoxFit.cover,
),
),
),
// SVG image centered on top of the background
Center(
child: SvgPicture.asset(
'assets/images/img_group_deep_orange_50.svg',
height: 900, // Adjust the image size as needed
fit: BoxFit.contain,
),
),
],
),
),
),
PageViewModel(
title: '', // Empty title
body: '',
footer: SizedBox(
height: 45,
width: 300,
),
image: Center(
child: Stack(
children: [
// Background image (same as previous page)
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/img_bgplain1.png'),
fit: BoxFit.cover,
),
),
),
// SVG image centered on top of the background
Center(
child: SvgPicture.asset(
'assets/images/img_group_deep_orange_a100_01.svg',
height: 900, // Adjust the image size as needed
fit: BoxFit.contain,
),
),
],
),
),
),
PageViewModel(
title: '', // Empty title
body: '',
footer: SizedBox(
height: 45,
width: 300,
),
image: Center(
child: Stack(
children: [
// Background image (same as previous pages)
Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage('assets/images/img_bgplain1.png'),
fit: BoxFit.cover,
),
),
),
// SVG image centered on top of the background
Center(
child: SvgPicture.asset(
'assets/images/img_group_deep_orange_100_01.svg',
height: 900, // Adjust the image size as needed
fit: BoxFit.contain,
),
),
],
),
),
),
];
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
// Background image for the whole screen
Container(
width: double.infinity,
height: double.infinity,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(ImageConstant.imgBgplain1),
fit: BoxFit.cover,
),
),
),
Padding(
padding: const EdgeInsets.fromLTRB(10, 80, 10, 10),
child: IntroductionScreen(
pages: pages,
dotsDecorator: const DotsDecorator(
size: Size(10, 10),
color: Color.fromARGB(255, 234, 230, 226),
activeSize: Size.square(15),
activeColor: Color.fromARGB(255, 153, 13, 3),
),
showDoneButton: true,
done: const Text('Done', style: TextStyle(fontSize: 20)),
showSkipButton: true,
skip: const Icon(Icons.close, size: 25),
showNextButton: true,
next: const Icon(Icons.arrow_forward, size: 25),
onDone: () => onDone(context),
curve: Curves.bounceOut,
),
),
],
),
);
}
答:
0赞
aminjafari-dev
10/16/2023
#1
class BaseLayout extends StatelessWidget{
@override
Widget build(BuildContext context){
return Scaffold(
body: Container(
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(your image path),
fit: BoxFit.cover,
),
),
child: null /* add child content here */,
),
);
}
}
下一个:将卡片中的行居中
评论