This commit is contained in:
erfan
2021-06-21 14:14:54 +04:30
parent 2c045f43f1
commit e2b8fab7d9
60 changed files with 4078 additions and 3928 deletions
+132 -129
View File
@@ -40,138 +40,141 @@ class _MyInfoScreenState extends State<MyInfoScreen> {
final _media = MediaQuery.of(context);
final double _devicewidth = _media.size.width;
final double _deviceBlockSize = _devicewidth / 100;
return Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Dashboard'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
return SafeArea(
child: Scaffold(
appBar: AppBar(
titleSpacing: -10,
title: Text('Dashboard'),
leading: IconButton(
icon: Icon(
Icons.keyboard_arrow_left,
size: 35,
),
onPressed: () => Navigator.of(context).pop(),
),
onPressed: () => Navigator.of(context).pop(),
),
),
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: ListView(
children: <Widget>[
InfoHeader(
deviceBlockSize: _deviceBlockSize,
label: 'MY INFO',
),
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: <Widget>[
InfoInputBox(
controller: usernameCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Full Name',
icon: FontAwesomeIcons.sortNumericDown,
inputType: TextInputType.text,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
initialValue: user['cell_number'],
decoration: InputDecoration(
icon: Icon(
Icons.call,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cell Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.grey,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 20,
),
InfoInputBox(
controller: emailCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Email Address',
icon: FontAwesomeIcons.envelope,
inputType: TextInputType.emailAddress,
),
SizedBox(
height: 40,
),
InkWell(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 60, vertical: 10),
margin: EdgeInsets.only(top: 50, bottom: 20),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(5),
),
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
textAlign: TextAlign.center,
),
),
onTap: () async {
await Provider.of<Auth>(context, listen: false)
.setUserData(
user['id'],
usernameCTRL.text,
emailCTRL.text,
)
.then(
(value) async => await showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text(
'Info changed successfully.',
),
actions: <Widget>[
FlatButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
),
);
Navigator.of(context).pop();
},
),
],
body: Consumer<ConnectivityProvider>(builder: (ct, connection, _) {
return connection.conStatus != 'offline'
? isInit
? Center(
child: CircularProgressIndicator(),
)
: ListView(
children: <Widget>[
InfoHeader(
deviceBlockSize: _deviceBlockSize,
label: 'MY INFO',
),
),
],
)
: ConnectionErrorBox();
}),
Container(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
children: <Widget>[
InfoInputBox(
controller: usernameCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Full Name',
icon: FontAwesomeIcons.sortNumericDown,
inputType: TextInputType.text,
),
SizedBox(
height: 20,
),
TextFormField(
readOnly: true,
initialValue: user['cell_number'],
decoration: InputDecoration(
icon: Icon(
Icons.call,
size: 6 * _deviceBlockSize,
),
labelStyle: TextStyle(
fontWeight: FontWeight.w100,
fontSize: 4 * _deviceBlockSize,
),
labelText: 'Cell Number',
isDense: true,
contentPadding: EdgeInsets.symmetric(
vertical: 2, horizontal: 3),
),
style: TextStyle(
fontWeight: FontWeight.w700,
color: Colors.grey,
fontSize: 5 * _deviceBlockSize,
),
keyboardType: TextInputType.number,
textInputAction: TextInputAction.next,
),
SizedBox(
height: 20,
),
InfoInputBox(
controller: emailCTRL,
deviceBlockSize: _deviceBlockSize,
label: 'Email Address',
icon: FontAwesomeIcons.envelope,
inputType: TextInputType.emailAddress,
),
SizedBox(
height: 40,
),
InkWell(
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 60, vertical: 10),
margin: EdgeInsets.only(top: 50, bottom: 20),
width: double.infinity,
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.blue, Colors.green],
),
borderRadius: BorderRadius.circular(5),
),
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 5 * _deviceBlockSize,
),
textAlign: TextAlign.center,
),
),
onTap: () async {
await Provider.of<Auth>(context,
listen: false)
.setUserData(
user['id'],
usernameCTRL.text,
emailCTRL.text,
)
.then(
(value) async => await showDialog(
context: context,
builder: (ctx) => AlertDialog(
content: Text(
'Info changed successfully.',
),
actions: <Widget>[
TextButton(
child: Text('Ok'),
onPressed: () {
Navigator.of(ctx).pop();
},
),
],
),
),
);
Navigator.of(context).pop();
},
),
],
),
),
],
)
: ConnectionErrorBox();
}),
),
);
}
}