From 54415abdde08db3927829bbd2383f3f56be25a84 Mon Sep 17 00:00:00 2001 From: Vicky Maulana Date: Thu, 24 Aug 2023 10:14:45 +0700 Subject: [PATCH] =?UTF-8?q?feat:=20initiate=20add=20emergency=20screen?= =?UTF-8?q?=F0=9F=8E=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/icons/ic_image.png | Bin 0 -> 1908 bytes lib/ui/phone/add_emergency.dart | 186 ++++++++++++++++++++++++++++++++ lib/ui/phone/phone.dart | 4 +- lib/utils/routes/routes.dart | 6 +- 4 files changed, 194 insertions(+), 2 deletions(-) create mode 100644 assets/icons/ic_image.png create mode 100644 lib/ui/phone/add_emergency.dart diff --git a/assets/icons/ic_image.png b/assets/icons/ic_image.png new file mode 100644 index 0000000000000000000000000000000000000000..cc629288374dd16b1c79b0ac8c12c6dd5a6882fd GIT binary patch literal 1908 zcmV-)2aEWLP)|2Fs#7ji_alnNc@ZiNJu<1yx%Z6 z$8*m z`274lz~}Db;^H3qb#2Ch!^1=G?d@$74TmVv$Hzy62SsTB`@zCKvAn#zMCjud{_@PI zz|HyB*Vj!5-6kwQMFB|)E8nGW+8FE~``$~wOc$YP<$5-o^-#VlW-`3qEO-dZ!R+kp zc!t#oV1LlZJo;0}<#Nqy(pM;>*-!j#p!`7HM&AaZsRD!w@Y&RySQo=6L}Qi9%gd5U z8Sd}z3s6D@eGbIpGE(t9;Qu`vpru(+h75&&etwQ{W7YTlq$jez2*WV{@bFN9(4k|r z;OXhf>v|(91*|Nfl{o^;gn>fd-rlx^w}l4%*?61`L_>CRfC9sb6Iu`ifd}iiA`wR~ zKHDceYDi{B`UWdavd{ufd=iE!6Jo%=S0bp2PX84{O!>Y^5EmC0Mb0<9Km~A=njwMv>S}!v8YlU$ zn*;%?)cP%cI2x?=hYGj2wXPR3S^Xyy|0FRpGgIo<2h?d6EIx+LGj!WolOo9Ksu!g5 z6h79oOp3teE<l6 zmjQAG&zTg%a^&AaXpY6l&(F^bP-2nggsA>iVFN#nSLk=kd8ws1JOsw5!SS&?Os?-SXc7q+9?n)j;oM+wb*W#G%dELuXIC7CC!hFhp}w)se-{K}D&|4_}Vinunp4B`aYXUZV1cTQEax%U$XJv58ROSU*U$d-63Ed>?IrOwo^Y?e`oYFdC zbpfA8CF_yKYm5%Vv`yjli0Onji@T?Ytj4}=yO@)nDB9W4)JHi+I(mZjyT^&pRc=SY zl|QkB-zl^p`pWct9kT4C$9=r2i2=5awrY04)LC%tYybDb09psWy{(5lGe0vXzl$cQq}@MQX<)>D|)rgezy36fQ5y*-$g35Tn}9>*i4qO%j?Z1v5gm!t=9; zpa008)W#$p;p~T_qocyY!a`n7VB_;3J3BkOrz_!))SXU_i`CWDqH}3i&VA{XOQHvW z#tlh{b%q+r@|vuu{9)JLi6$}Q1blmqDY(Lalo#nASq<5R`$Qhsb`gEOX%T9YGIH1T zWKD$`Vc~i2C??~QB%-f(YJAP|a%6X_*kVH|yxkS?%!GlXRgQ$J5_Ba=xi}Ev)ye)4 z3Rs^M>!Yu0azOT!Eb`U5uv z#qusocMCta{quorX#&Sa+?_d literal 0 HcmV?d00001 diff --git a/lib/ui/phone/add_emergency.dart b/lib/ui/phone/add_emergency.dart new file mode 100644 index 0000000..ecadbe7 --- /dev/null +++ b/lib/ui/phone/add_emergency.dart @@ -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 createState() => _AddEmergencyScreenState(); +} + +class _AddEmergencyScreenState extends State { + @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"); + }, + ), + ), + ); + } +} diff --git a/lib/ui/phone/phone.dart b/lib/ui/phone/phone.dart index f208763..1aaf3e8 100644 --- a/lib/ui/phone/phone.dart +++ b/lib/ui/phone/phone.dart @@ -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 @@ -68,7 +69,8 @@ class _PhoneScreenState extends State { ), ), onTap: () { - print("add emergency"); + // print("add emergency"); + Navigator.of(context).pushNamed(Routes.addEmergency); }, ); } diff --git a/lib/utils/routes/routes.dart b/lib/utils/routes/routes.dart index 025aa64..0836df0 100644 --- a/lib/utils/routes/routes.dart +++ b/lib/utils/routes/routes.dart @@ -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'; @@ -35,6 +36,8 @@ class Routes { static const String library = '/library'; static const String navigator = '/navigator'; + static const String addEmergency = '/addEmergency'; + static final routes = { splash: (BuildContext context) => SplashScreen(), login: (BuildContext context) => LoginScreen(), @@ -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(), }; }