这个忘记密码的代码和我用了Stack
和2个容器,并在它们上面圈出了头像.
计划开始时,一切都很好,但当我填写表格时.圆圈化身倒下.我该怎么解决这个问题呢?
保证金的使用是这样做的原因吗,但我如何将巡回头像放在中间?
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/painting.dart';
import 'package:google_fonts/google_fonts.dart';
import 'Login.dart';
class Restartpassword extends StatelessWidget {
const Restartpassword({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
color: Colors.deepPurple.withOpacity(0.2),
width: double.infinity,
child: Center(
child: Stack(
children: [
Container(
margin: EdgeInsets.symmetric(horizontal: 20),
height: 400,
),
Center(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 20),
height: 300,
decoration: BoxDecoration(
border: Border.all(
width: 1,
color: Colors.grey
)
),
child: Column(
mainAxisAlignment:MainAxisAlignment.center ,
children: [
Container(
//----------------------------------------------------
decoration: BoxDecoration(
color: Colors.deepPurple.withOpacity(0.1),
border: Border(
left: BorderSide(color: Colors.deepPurple,width: 10),
),
),
//----------------------------------------------------
width: 300,
height: 50,
//----------
child:TextFormField(
style: GoogleFonts.pacifico(
color: Colors.purple,
fontSize: 20.0,
),
//----------------------------------
keyboardType:TextInputType.text ,
//----------------------------------
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
//-----------------------------------
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_open_sharp,color:Colors.purple),
border: InputBorder.none,
hintText: '***New Password***',
hintStyle: GoogleFonts.pacifico(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold
),
fillColor: Colors.black12.withOpacity(0.2),
filled: true,
//-----------------------------------
),
)),
SizedBox(
height: 10,
),
Container(
//----------------------------------------------------
decoration: BoxDecoration(
color: Colors.deepPurple.withOpacity(0.1),
border: Border(
left: BorderSide(color: Colors.deepPurple,width: 10),
),
),
//----------------------------------------------------
width: 300,
height: 50,
//----------
child:TextFormField(
style: GoogleFonts.pacifico(
color: Colors.purple,
fontSize: 20.0,
),
//----------------------------------
keyboardType:TextInputType.text ,
//----------------------------------
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter some text';
}
return null;
},
//-----------------------------------
decoration: InputDecoration(
prefixIcon: Icon(Icons.lock_outline,color:Colors.purple),
border: InputBorder.none,
hintText: '***Confirm Password***',
hintStyle: GoogleFonts.pacifico(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold
),
fillColor: Colors.black12.withOpacity(0.2),
filled: true,
//-----------------------------------
),
)),
SizedBox(
height: 10,
),
Container(
width:130 ,
height: 45,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(15)
),
child: MaterialButton(
minWidth: 130,
hoverColor: Colors.purple,
color: Colors.green,
onPressed: (){
Navigator.push(context, MaterialPageRoute(builder: (context) => loginScreen())) ;
},
child: Text('Restart '
,style: GoogleFonts.pacifico(
color: Colors.white,
fontSize: 20.0,
),
)),
)
],
),
),
),
Container(
height: 80,
width: 80,
margin: EdgeInsetsDirectional.only(
start: 165,
top: 210
),
child: CircleAvatar(
backgroundColor:Colors.white.withOpacity(0.3),
radius: 30,
child: Icon(Icons.lock,size: 60,
color: Colors.purple,),
),
),
],
),
),
)
),
);
}
}