-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: initiate add emergency screen🎨
- Loading branch information
Vicky Maulana
committed
Aug 24, 2023
1 parent
9a37b72
commit 54415ab
Showing
4 changed files
with
194 additions
and
2 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:safewalk/constants/colors.dart'; | ||
import 'package:safewalk/utils/device/device_utils.dart'; | ||
|
||
class AddEmergencyScreen extends StatefulWidget { | ||
const AddEmergencyScreen({super.key}); | ||
|
||
@override | ||
State<AddEmergencyScreen> createState() => _AddEmergencyScreenState(); | ||
} | ||
|
||
class _AddEmergencyScreenState extends State<AddEmergencyScreen> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar(), | ||
body: SingleChildScrollView( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16.0), | ||
child: Text( | ||
"Add Emergency Contact", | ||
textAlign: TextAlign.start, | ||
style: TextStyle( | ||
fontSize: 24, | ||
fontWeight: FontWeight.bold, | ||
), | ||
), | ||
), | ||
_buildPhotoHolder(), | ||
_buildNameField(), | ||
_buildPhoneField(), | ||
_buildEmailField(), | ||
SizedBox( | ||
height: DeviceUtils.getScaledHeight(context, 0.2) | ||
), | ||
_buildButtonField() | ||
], | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _buildButtonField() { | ||
return Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
mainAxisSize: MainAxisSize.max, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [ | ||
Container( | ||
height: 50, | ||
width: DeviceUtils.getScaledWidth(context, 0.2), | ||
margin: EdgeInsets.only(left:16 , top: 8), | ||
child: ElevatedButton( | ||
onPressed: () { | ||
Navigator.pop(context); | ||
}, | ||
child: Text("Cancel"), | ||
style: ElevatedButton.styleFrom( | ||
backgroundColor: Colors.grey.withOpacity(0.2), | ||
shape: RoundedRectangleBorder( | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
), | ||
), | ||
), | ||
GestureDetector( | ||
child: Container( | ||
height: 50, | ||
width: DeviceUtils.getScaledWidth(context, 0.65), | ||
margin: EdgeInsets.only(right: 16, top: 8), | ||
decoration: BoxDecoration( | ||
gradient: LinearGradient( | ||
colors: [ | ||
AppColors.primaryGradientDarkTopLeft, | ||
AppColors.primaryGradientDarkBottomRight, | ||
], | ||
begin: Alignment.topLeft, | ||
end: Alignment.bottomRight, | ||
), | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
child: Center( | ||
child: Text( | ||
"Save", | ||
style: TextStyle( | ||
fontSize: 16, | ||
fontWeight: FontWeight.bold, | ||
color: Colors.white, | ||
), | ||
), | ||
) | ||
), | ||
onTap: () { | ||
print("Save"); | ||
}, | ||
), | ||
], | ||
); | ||
} | ||
|
||
Widget _buildNameField() { | ||
return Container( | ||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), | ||
child: TextField( | ||
decoration: InputDecoration( | ||
labelText: "Name", | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _buildPhoneField() { | ||
return Container( | ||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), | ||
child: TextField( | ||
decoration: InputDecoration( | ||
labelText: "Phone", | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _buildEmailField() { | ||
return Container( | ||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 8), | ||
child: TextField( | ||
decoration: InputDecoration( | ||
labelText: "Email", | ||
border: OutlineInputBorder( | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
|
||
Widget _buildPhotoHolder() { | ||
return Center( | ||
child: Container( | ||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16), | ||
height: 210, | ||
width: 210, | ||
decoration: BoxDecoration( | ||
gradient: LinearGradient( | ||
colors: [ | ||
AppColors.primaryGradientDarkTopLeft, | ||
AppColors.primaryGradientDarkBottomRight, | ||
], | ||
begin: Alignment.topLeft, | ||
end: Alignment.bottomRight, | ||
), | ||
borderRadius: BorderRadius.circular(100), | ||
), | ||
child: GestureDetector( | ||
child: Container( | ||
height: 200, | ||
width: 200, | ||
margin: EdgeInsets.symmetric(horizontal: 10, vertical: 10), | ||
decoration: BoxDecoration( | ||
color: AppColors.backgroundDark, | ||
borderRadius: BorderRadius.circular(100), | ||
), | ||
child: Center( | ||
child: Image.asset( | ||
'assets/icons/ic_image.png', | ||
height: 100, | ||
width: 100, | ||
)), | ||
), | ||
onTap: () { | ||
print("Add photo"); | ||
}, | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters