Skip to content

Commit

Permalink
feat: initiate add emergency screen🎨
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicky Maulana committed Aug 24, 2023
1 parent 9a37b72 commit 54415ab
Show file tree
Hide file tree
Showing 4 changed files with 194 additions and 2 deletions.
Binary file added assets/icons/ic_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
186 changes: 186 additions & 0 deletions lib/ui/phone/add_emergency.dart
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");
},
),
),
);
}
}
4 changes: 3 additions & 1 deletion lib/ui/phone/phone.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:safewalk/constants/colors.dart';
import 'package:safewalk/utils/routes/routes.dart';

class PhoneScreen extends StatefulWidget {
@override
Expand Down Expand Up @@ -68,7 +69,8 @@ class _PhoneScreenState extends State<PhoneScreen> {
),
),
onTap: () {
print("add emergency");
// print("add emergency");
Navigator.of(context).pushNamed(Routes.addEmergency);
},
);
}
Expand Down
6 changes: 5 additions & 1 deletion lib/utils/routes/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:safewalk/ui/maps/distance.dart';
import 'package:safewalk/ui/maps/maps.dart';
import 'package:safewalk/ui/dev/navigator.dart';
import 'package:safewalk/ui/onboard/onboarding.dart';
import 'package:safewalk/ui/phone/add_emergency.dart';
import 'package:safewalk/ui/post/post.dart';
import 'package:safewalk/ui/splash/splash.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -35,6 +36,8 @@ class Routes {
static const String library = '/library';
static const String navigator = '/navigator';

static const String addEmergency = '/addEmergency';

static final routes = <String, WidgetBuilder>{
splash: (BuildContext context) => SplashScreen(),
login: (BuildContext context) => LoginScreen(),
Expand All @@ -47,9 +50,10 @@ class Routes {
biodata: (BuildContext context) => BiodataScreen(),
selfpict: (BuildContext context) => SelfPictScreen(),
success: (BuildContext context) => SuccessScreen(),

storage: (BuildContext context) => StorageScreen(),
library: (BuildContext context) => LibraryScreen(),
navigator: (BuildContext context) => NavigatorScreen(),

addEmergency: (BuildContext context) => AddEmergencyScreen(),
};
}

0 comments on commit 54415ab

Please sign in to comment.