import 'package:flutter/material.dart';
class SiginupPage extends StatefulWidget {
const SiginupPage({super.key});
@override
State<SiginupPage> createState() => _SiginupPageState();
}
class _SiginupPageState extends State<SiginupPage> {
@override
Widget build(BuildContext context) {
return SafeArea(child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text(
'Get Started',
style: TextStyle(fontWeight: FontWeight.bold,fontSize: 40),
),
const SizedBox(height: 30,),
Text('Hey lets get started with this journey to development',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[700],
fontSize: 15
),
),
],
),
Container(
height: MediaQuery.of(context).size.height/3,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage('lib/assets/image/1stbg.png')
),
),
)
],
),
));
}
}
为什么我的输出没有图像和标题为全红色,带有双黄色下划线和黑色背景?我希望它以所有默认背景显示,标题的默认颜色没有下划线,并且我的图像必须呈现
因为你没有 Material 小部件作为父级。将其包裹在脚手架或材质小部件内以获得正确的样式。
用
Scaffold
包裹容器
return SafeArea(child: Scaffold(child:Container(...)