Edit ddress 2
code:
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
class ProfileBody extends StatefulWidget {
@override
_ProfileBodyState createState() => _ProfileBodyState();
}
class _ProfileBodyState extends State<ProfileBody> {
bool nameEdit;
final TextEditingController nameProfileController =
new TextEditingController();
final TextEditingController addressProfileController =
new TextEditingController();
final TextEditingController cityProfileController =
new TextEditingController();
final TextEditingController stateProfileController =
new TextEditingController();
final TextEditingController mobileNoProfileController =
new TextEditingController();
@override
void initState() {
nameEdit = false;
}
@override
Widget build(BuildContext context) {
return SingleChildScrollView(
child: Column(
children: <Widget>[
_buildHeader(context),
SizedBox(height: 10.0),
_buildInfo(context),
],
),
);
}
Widget _buildHeader(BuildContext context) {
return Stack(
children: <Widget>[
Ink(
height: 230,
color: Colors.deepOrangeAccent.shade200,
),
Container(
width: double.infinity,
margin: const EdgeInsets.only(top: 20),
child: Column(
children: <Widget>[
Card(
elevation: 2,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
// color: Colors.deepOrange.shade200,
child: Container(
width: 100,
height: 100,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(100),
border: Border.all(
color: Colors.white,
width: 6.0,
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(80),
child: SvgPicture.asset(
"QAssets/logo_y.svg",
fit: BoxFit.cover,
),
),
),
),
_buildMainInfo(context)
],
),
),
Container(
margin: const EdgeInsets.only(top: 180),
child: _buildInfoCard(context),
)
],
);
}
Widget _buildInfoCard(context) {
return Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 20, left: 30, right: 30),
child: Card(
elevation: 5.0,
color: Colors.white,
child: Padding(
padding: const EdgeInsets.only(
top: 16.0, bottom: 16.0, right: 10.0, left: 10.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
new Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
new Text(
'Cart Details',
style: new TextStyle(
fontSize: 18.0,
color: Colors.black,
fontWeight: FontWeight.w400),
),
Padding(
padding: const EdgeInsets.only(top: 6.0),
child: new Text(
'5',
style: new TextStyle(
fontSize: 18.0,
color: Color(0Xffde6262),
fontWeight: FontWeight.w600),
),
),
],
),
new Column(
children: <Widget>[
new Text(
'Order',
style: new TextStyle(
fontSize: 18.0,
color: Colors.black,
fontWeight: FontWeight.w400),
),
Padding(
padding: const EdgeInsets.only(top: 6.0),
child: new Text(
'3',
style: new TextStyle(
fontSize: 18.0,
color: Color(0Xffde6262),
fontWeight: FontWeight.w600),
),
),
],
),
],
),
),
),
),
],
);
}
Widget _buildMainInfo(BuildContext context) {
return Container(
width: double.infinity,
margin: const EdgeInsets.all(10),
alignment: AlignmentDirectional.center,
child: Column(
children: <Widget>[
Text('Maherban',
style: TextStyle(
fontSize: 20,
color: Colors.yellow,
fontWeight: FontWeight.bold)),
SizedBox(height: 10),
Text('Flutter',
style: TextStyle(
color: Colors.grey.shade50, fontStyle: FontStyle.italic))
],
),
);
}
Widget _buildInfo(BuildContext context) {
return Container(
child: Card(
color: Colors.white,
child: Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.only(
left: 15,
bottom: 25,
right: 15,
),
child: Column(
children: <Widget>[
Container(
child: Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
RaisedButton(
child: nameEdit
? Text(
"SAVE",
style: TextStyle(
fontWeight: FontWeight.bold,
),
)
: Text(
"EDIT",
style: TextStyle(
fontWeight: FontWeight.bold,
),
),
onPressed: () {
setState(() {
nameEdit = !nameEdit;
});
},
),
],
),
),
//////name
ListTile(
leading:
Icon(Icons.account_circle, color: Colors.deepOrangeAccent),
title: Text(
"Full Name",
style: TextStyle(fontSize: 18, color: Colors.black),
),
subtitle: nameEdit
? TextFormField(
controller: nameProfileController,
decoration: InputDecoration(
hintText: "Your Name",
),
)
: Text(nameProfileController.text,
style: TextStyle(fontSize: 18, color: Colors.black)),
),
Divider(),
///address
ListTile(
leading: Icon(Icons.list, color: Colors.deepOrangeAccent),
title: Text(
"Address",
style: TextStyle(fontSize: 18, color: Colors.black),
),
subtitle: nameEdit
? TextFormField(
controller: addressProfileController,
decoration: InputDecoration(
hintText: "Your Address",
),
)
: Text(addressProfileController.text,
style: TextStyle(fontSize: 18, color: Colors.black)),
),
Divider(),
///city
ListTile(
leading: Icon(Icons.map, color: Colors.deepOrangeAccent),
title: Text(
"City",
style: TextStyle(fontSize: 18, color: Colors.black),
),
subtitle: nameEdit
? TextFormField(
controller: cityProfileController,
decoration: InputDecoration(
hintText: "Your City",
),
)
: Text(cityProfileController.text,
style: TextStyle(fontSize: 18, color: Colors.black)),
),
Divider(),
///state
ListTile(
leading:
Icon(Icons.location_city, color: Colors.deepOrangeAccent),
title: Text(
"State",
style: TextStyle(fontSize: 18, color: Colors.black),
),
subtitle: nameEdit
? TextFormField(
controller: stateProfileController,
decoration: InputDecoration(
hintText: "Your State",
),
)
: Text(stateProfileController.text,
style: TextStyle(fontSize: 18, color: Colors.black)),
),
],
),
),
));
}
}
0 Comments