From 711f39a151843d49a42d371ebc4bf47bfac20c21 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Sun, 12 Apr 2020 19:35:29 +0300 Subject: [PATCH 1/5] first step from schedule screen --- .vscode/settings.json | 2 +- lib/routes.dart | 2 +- lib/screens/my_schedule_screen.dart | 132 +++++++++++++++++++- lib/widgets/shared/app_scaffold_widget.dart | 2 +- 4 files changed, 132 insertions(+), 6 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 4969fedb..a1b95030 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,7 +1,7 @@ { "commentBox.styles": { "defaultStyle": { - "commentStartToken": "/* \n *@author: Elham Rababah \n *@Date:13/4/1993 \n *@param: \n *@return:\n *@desc: ", + "commentStartToken": "/* \n *@author: Elham Rababah \n *@Date:13/4/2020 \n *@param: \n *@return:\n *@desc: ", "commentEndToken": "\n */", "leftEdgeToken": " * ", "rightEdgeToken": "", diff --git a/lib/routes.dart b/lib/routes.dart index 82771ae6..71ad519a 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -12,7 +12,7 @@ import './screens/patients/patient_search_screen.dart'; import './screens/patients/patients_list_screen.dart'; import './screens/settings/settings_screen.dart'; -const String INIT_ROUTE = LOGIN; +const String INIT_ROUTE = MY_SCHEDULE; const String HOME = '/'; const String LOGIN = 'login'; const String CHANGE_PASSWORD = 'change-password'; diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index c7775c10..29393b18 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -1,9 +1,135 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + class MyScheduleScreen extends StatelessWidget { + List litems = [ + "1", + "2", + ]; + @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar(title: Text("My Schedule"),), + return AppScaffold( + // pageOnly: false, + appBarTitle: 'My Schdule', + body: Container( + decoration: new BoxDecoration( + gradient: LinearGradient( + colors: [Colors.red[100], Colors.white], + begin: Alignment.topLeft, + end: Alignment.bottomRight, + ), + ), + padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), + child: ListView(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 20, + ), + Text('My Schedule', style: textStyle(3, FontWeight.w700)), + scheduleListByDate('Today, 7 April '), + scheduleListByDate('Wednesday, 8 April '), + ], + ), + ], + ), + ]), + )); + } + + Column scheduleListByDate(date) { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox( + height: 10, + ), + Text(date, style: textStyle(3)), + Container( + child: Column( + children: litems.map((item) { + return ScheduleItemWidget(); + }).toList(), + ), + ), + ], ); } -} \ No newline at end of file + + TextStyle textStyle(size, [FontWeight weight]) { + return TextStyle( + fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); + } +} + +class ScheduleItemWidget extends StatelessWidget { + const ScheduleItemWidget({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + RoundedContainer( + Container( + height: SizeConfig.screenHeight * 0.22, + width: SizeConfig.screenWidth * 0.95, + decoration: BoxDecoration(border: ), + // decoration: DoxD, + ), + backgroundColor: Colors.red, + showBorder: true, + borderColor: Hexcolor('#707070'), + ), + Positioned( + left: 10, + child: RoundedContainer( + Container( + padding: const EdgeInsets.all(15.0), + height: SizeConfig.screenHeight * 0.22, + width: SizeConfig.screenWidth * 0.92, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('ER new development ideas meeting ', + style: textStyle(3)), + SizedBox( + height: 8, + ), + Text('09:00 AM - 10:50 AM ', style: textStyle(3)), + SizedBox( + height: 8, + ), + Row( + children: [ + Icon(Icons.add_location), + Text('Cloud Solution ', style: textStyle(3)) + ], + ) + ], + ), + ), + elevation: 20, + raduis: 0, + showBorder: true, + borderColor: Hexcolor('#707070'), + ), + ), + ], + ); + } + + TextStyle textStyle(size, [FontWeight weight]) { + return TextStyle( + fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); + } +} diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 373c94c6..218c9e84 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -15,7 +15,7 @@ class AppScaffold extends StatelessWidget { bool showAppBar = true; bool showAppDrawer = true; bool showBottomBar = true; - String appBarTitle; + String appBarTitle=''; Widget body; @override From d3e27eab6fde1b41494f5df90bb3bf516c51e5cc Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 13 Apr 2020 12:28:51 +0300 Subject: [PATCH 2/5] finish my schedule --- lib/screens/my_schedule_screen.dart | 71 ++---------------- .../shared/rounded_container_widget.dart | 6 +- lib/widgets/shared/schedule_item_widget.dart | 72 +++++++++++++++++++ 3 files changed, 82 insertions(+), 67 deletions(-) create mode 100644 lib/widgets/shared/schedule_item_widget.dart diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index 29393b18..4e430d69 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -1,6 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/schedule_item_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; @@ -34,7 +35,7 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 20, ), - Text('My Schedule', style: textStyle(3, FontWeight.w700)), + Text('My Schedule', style: textStyle(2.5, FontWeight.w700)), scheduleListByDate('Today, 7 April '), scheduleListByDate('Wednesday, 8 April '), ], @@ -52,11 +53,12 @@ class MyScheduleScreen extends StatelessWidget { SizedBox( height: 10, ), - Text(date, style: textStyle(3)), + Text(date, style: textStyle(2.5)), Container( child: Column( children: litems.map((item) { - return ScheduleItemWidget(); + return ScheduleItemWidget('ER new development ideas meeting', + '09:00 AM - 10:50 AM ', 'Cloud Solution'); }).toList(), ), ), @@ -70,66 +72,3 @@ class MyScheduleScreen extends StatelessWidget { } } -class ScheduleItemWidget extends StatelessWidget { - const ScheduleItemWidget({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - return Stack( - children: [ - RoundedContainer( - Container( - height: SizeConfig.screenHeight * 0.22, - width: SizeConfig.screenWidth * 0.95, - decoration: BoxDecoration(border: ), - // decoration: DoxD, - ), - backgroundColor: Colors.red, - showBorder: true, - borderColor: Hexcolor('#707070'), - ), - Positioned( - left: 10, - child: RoundedContainer( - Container( - padding: const EdgeInsets.all(15.0), - height: SizeConfig.screenHeight * 0.22, - width: SizeConfig.screenWidth * 0.92, - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('ER new development ideas meeting ', - style: textStyle(3)), - SizedBox( - height: 8, - ), - Text('09:00 AM - 10:50 AM ', style: textStyle(3)), - SizedBox( - height: 8, - ), - Row( - children: [ - Icon(Icons.add_location), - Text('Cloud Solution ', style: textStyle(3)) - ], - ) - ], - ), - ), - elevation: 20, - raduis: 0, - showBorder: true, - borderColor: Hexcolor('#707070'), - ), - ), - ], - ); - } - - TextStyle textStyle(size, [FontWeight weight]) { - return TextStyle( - fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); - } -} diff --git a/lib/widgets/shared/rounded_container_widget.dart b/lib/widgets/shared/rounded_container_widget.dart index 1ce9fc53..8b071cf9 100644 --- a/lib/widgets/shared/rounded_container_widget.dart +++ b/lib/widgets/shared/rounded_container_widget.dart @@ -17,6 +17,7 @@ class RoundedContainer extends StatefulWidget { final double topRight; final double bottomLeft; final Widget widget; + final double borderWidth; RoundedContainer( this.widget, @@ -31,6 +32,7 @@ class RoundedContainer extends StatefulWidget { this.topRight = 0, this.bottomRight = 0, this.bottomLeft = 0, + this.borderWidth =1 }); @override @@ -41,11 +43,13 @@ class _RoundedContainerState extends State { @override Widget build(BuildContext context) { return Container( + height: null, + width: null, margin: EdgeInsets.all(widget.margin), decoration: widget.showBorder == true ? BoxDecoration( color: Theme.of(context).primaryColor, - border: Border.all(color: Colors.red, width: 1), + border: Border.all(color: widget.borderColor, width: widget.borderWidth), borderRadius: widget.customCornerRaduis ? BorderRadius.only( topLeft: Radius.circular(widget.topLeft), diff --git a/lib/widgets/shared/schedule_item_widget.dart b/lib/widgets/shared/schedule_item_widget.dart new file mode 100644 index 00000000..d74c84e3 --- /dev/null +++ b/lib/widgets/shared/schedule_item_widget.dart @@ -0,0 +1,72 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; +class ScheduleItemWidget extends StatelessWidget { + String title; + String date; + String location; + ScheduleItemWidget(this.title, this.date, this.location); + + @override + Widget build(BuildContext context) { + return Stack( + children: [ + RoundedContainer( + Container( + height: SizeConfig.screenHeight * 0.20, + width: SizeConfig.screenWidth * 0.80, + ), + raduis: 10, + backgroundColor: Hexcolor('#58434F'), + showBorder: true, + borderColor: Hexcolor('#707070'), + borderWidth: 0.5, + ), + Positioned( + left: 10, + child: RoundedContainer( + Container( + padding: const EdgeInsets.all(15.0), + height: SizeConfig.screenHeight * 0.20, + width: SizeConfig.screenWidth * 0.80, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title, style: textStyle(2.5)), + SizedBox( + height: 8, + ), + Text(date, style: textStyle(2.5)), + SizedBox( + height: 8, + ), + Row( + children: [ + Icon(Icons.add_location), + Text(location, style: textStyle(2.5)) + ], + ) + ], + ), + ), + elevation: 20, + // raduis: 0, + showBorder: true, + borderColor: Hexcolor('#707070'), + customCornerRaduis: true, + bottomLeft: 0, + topLeft: 0, + bottomRight: 10, + topRight: 10, + borderWidth: 0.5), + ), + ], + ); + } + + TextStyle textStyle(size, [FontWeight weight]) { + return TextStyle( + fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); + } +} From 7564e1b49663a86aaa39fcb41d1a97d0f95512b1 Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Mon, 13 Apr 2020 23:59:14 +0300 Subject: [PATCH 3/5] first step form curve and patients page --- lib/routes.dart | 6 +- lib/screens/my_schedule_screen.dart | 2 - lib/screens/patients/patients_screen.dart | 65 ++++++++++++++++++++ lib/widgets/shared/app_scaffold_widget.dart | 5 +- lib/widgets/shared/schedule_item_widget.dart | 2 +- 5 files changed, 73 insertions(+), 7 deletions(-) create mode 100644 lib/screens/patients/patients_screen.dart diff --git a/lib/routes.dart b/lib/routes.dart index 71ad519a..5e5c57c0 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -9,10 +9,10 @@ import './screens/dashboard_screen.dart'; import './screens/medicine/medicine_search_screen.dart'; import './screens/my_schedule_screen.dart'; import './screens/patients/patient_search_screen.dart'; -import './screens/patients/patients_list_screen.dart'; +import './screens/patients/patients_screen.dart'; import './screens/settings/settings_screen.dart'; -const String INIT_ROUTE = MY_SCHEDULE; +const String INIT_ROUTE = PATIENTS; const String HOME = '/'; const String LOGIN = 'login'; const String CHANGE_PASSWORD = 'change-password'; @@ -32,7 +32,7 @@ var routes = { INIT_ROUTE: (_) => Loginsreen(), MY_SCHEDULE: (_) => MyScheduleScreen(), PATIENT_SEARCH: (_) => PatientSearchScreen(), - PATIENTS: (_) => PatientsListScreen(), + PATIENTS: (_) => PatientsScreen(), QR_READER: (_) => QrReaderScreen(), BLOOD_BANK: (_) => BloodBankScreen(), DOCTOR_REPLY: (_) => DoctorReplyScreen(), diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index 4e430d69..7c9bcd66 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -1,9 +1,7 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/schedule_item_widget.dart'; import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; class MyScheduleScreen extends StatelessWidget { List litems = [ diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart new file mode 100644 index 00000000..c1bb6c53 --- /dev/null +++ b/lib/screens/patients/patients_screen.dart @@ -0,0 +1,65 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import 'package:doctor_app_flutter/widgets/shared/schedule_item_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:hexcolor/hexcolor.dart'; + +class PatientsScreen extends StatelessWidget { + List litems = [ + "1", + ]; + @override + Widget build(BuildContext context) { + return AppScaffold( + // pageOnly: false, + appBarTitle: 'Patients', + body: Stack( + + children: [ + ClipPath( + clipper: CustomShapeClipper(), + child: Container( + height: SizeConfig.realScreenHeight * 0.40, + decoration: BoxDecoration(color: Hexcolor('#FFDDD9')))), + Positioned( + // key: , + top: SizeConfig.realScreenHeight * 0.10, + child: Container( + // decoration: BoxDecoration(color: Colors.red), + // margin: EdgeInsets.symmetric(vertical: 500), + child: Column( + children: litems.map((item) { + return Text(''); + }).toList(), + ), + ), + ) + ], + )); + } +} + +class CustomShapeClipper extends CustomClipper { + @override + Path getClip(Size size) { + final Path path = Path(); + path.lineTo(0.0, size.height); + + var firstEndPoint = Offset(size.width * .5, size.height / 2); + var firstControlpoint = Offset(size.width * 0.25, size.height * 0.95 + 30); + path.quadraticBezierTo(firstControlpoint.dx, firstControlpoint.dy, + firstEndPoint.dx, firstEndPoint.dy); + + var secondEndPoint = Offset(size.width, size.height * 0.10); + var secondControlPoint = Offset(size.width * .75, size.height * .10 - 20); + path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, + secondEndPoint.dx, secondEndPoint.dy); + + path.lineTo(size.width, 0.0); + path.close(); + return path; + } + + @override + bool shouldReclip(CustomClipper oldClipper) => true; +} diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 218c9e84..1e0bff65 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,3 +1,5 @@ +import 'package:hexcolor/hexcolor.dart'; + import '../../presentation/doctor_app_icons.dart'; import '../../widgets/shared/app_drawer_widget.dart'; import 'package:flutter/material.dart'; @@ -21,10 +23,11 @@ class AppScaffold extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( + backgroundColor: Hexcolor('#FCF7F7'), appBar: (pageOnly == true || showAppBar == false)?null:AppBar( elevation: 0, - backgroundColor: Colors.red[100], + backgroundColor: Hexcolor('#FFDDD9'), textTheme: TextTheme( title: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)), title: Text(appBarTitle), diff --git a/lib/widgets/shared/schedule_item_widget.dart b/lib/widgets/shared/schedule_item_widget.dart index d74c84e3..ad8113b3 100644 --- a/lib/widgets/shared/schedule_item_widget.dart +++ b/lib/widgets/shared/schedule_item_widget.dart @@ -50,7 +50,7 @@ class ScheduleItemWidget extends StatelessWidget { ], ), ), - elevation: 20, + elevation: 0, // raduis: 0, showBorder: true, borderColor: Hexcolor('#707070'), From 709d75a3109bc3a5cf72997b644cfc5d47eb5faf Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 14 Apr 2020 12:30:27 +0300 Subject: [PATCH 4/5] first step from patient list --- lib/screens/my_schedule_screen.dart | 10 +++--- lib/screens/patients/patients_screen.dart | 20 +++++++---- ...m_widget.dart => card_with_bg_widget.dart} | 36 ++++++++++++------- 3 files changed, 42 insertions(+), 24 deletions(-) rename lib/widgets/shared/{schedule_item_widget.dart => card_with_bg_widget.dart} (67%) diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index 7c9bcd66..b3ec10b8 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -1,8 +1,9 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/schedule_item_widget.dart'; import 'package:flutter/material.dart'; +import '../config/size_config.dart'; +import '../widgets/shared/app_scaffold_widget.dart'; +import '../widgets/shared/card_with_bg_widget.dart'; + class MyScheduleScreen extends StatelessWidget { List litems = [ "1", @@ -55,8 +56,7 @@ class MyScheduleScreen extends StatelessWidget { Container( child: Column( children: litems.map((item) { - return ScheduleItemWidget('ER new development ideas meeting', - '09:00 AM - 10:50 AM ', 'Cloud Solution'); + return CardWithBgWidget(line1Text: 'ER new development ideas meeting',line2Text:'09:00 AM - 10:50 AM',line3Text: 'Cloud Solution',icon: Icons.add_location, heightPercentage: 0.20, widthPercentage: 0.80,); }).toList(), ), ), diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index c1bb6c53..106cb6fe 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,12 +1,15 @@ -import 'package:doctor_app_flutter/config/size_config.dart'; -import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; -import 'package:doctor_app_flutter/widgets/shared/schedule_item_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; +import '../../config/size_config.dart'; +import '../../widgets/shared/app_scaffold_widget.dart'; +import '../../widgets/shared/card_with_bg_widget.dart'; + class PatientsScreen extends StatelessWidget { List litems = [ "1", + "1", + "1", ]; @override Widget build(BuildContext context) { @@ -14,7 +17,6 @@ class PatientsScreen extends StatelessWidget { // pageOnly: false, appBarTitle: 'Patients', body: Stack( - children: [ ClipPath( clipper: CustomShapeClipper(), @@ -23,13 +25,19 @@ class PatientsScreen extends StatelessWidget { decoration: BoxDecoration(color: Hexcolor('#FFDDD9')))), Positioned( // key: , - top: SizeConfig.realScreenHeight * 0.10, + // top: SizeConfig.realScreenHeight * 0.10, child: Container( // decoration: BoxDecoration(color: Colors.red), // margin: EdgeInsets.symmetric(vertical: 500), child: Column( children: litems.map((item) { - return Text(''); + return CardWithBgWidget( + line1Text: 'Fahad AlSlehm - 324599', + line2Text: '12/04/2020 - 02:00 PM', + // line3Text: '', + + heightPercentage: 0.15, + widthPercentage: 0.80); }).toList(), ), ), diff --git a/lib/widgets/shared/schedule_item_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart similarity index 67% rename from lib/widgets/shared/schedule_item_widget.dart rename to lib/widgets/shared/card_with_bg_widget.dart index ad8113b3..9b4bf4ff 100644 --- a/lib/widgets/shared/schedule_item_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -2,11 +2,21 @@ import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; import 'package:hexcolor/hexcolor.dart'; -class ScheduleItemWidget extends StatelessWidget { - String title; - String date; - String location; - ScheduleItemWidget(this.title, this.date, this.location); + +class CardWithBgWidget extends StatelessWidget { + String line1Text; + String line2Text; + String line3Text; + IconData icon; + double heightPercentage; + double widthPercentage; + CardWithBgWidget( + {this.line1Text = '', + this.line2Text = '', + this.line3Text = '', + this.icon, + this.heightPercentage, + this.widthPercentage}); @override Widget build(BuildContext context) { @@ -14,8 +24,8 @@ class ScheduleItemWidget extends StatelessWidget { children: [ RoundedContainer( Container( - height: SizeConfig.screenHeight * 0.20, - width: SizeConfig.screenWidth * 0.80, + height: SizeConfig.screenHeight * heightPercentage, + width: SizeConfig.screenWidth * widthPercentage, ), raduis: 10, backgroundColor: Hexcolor('#58434F'), @@ -28,23 +38,23 @@ class ScheduleItemWidget extends StatelessWidget { child: RoundedContainer( Container( padding: const EdgeInsets.all(15.0), - height: SizeConfig.screenHeight * 0.20, - width: SizeConfig.screenWidth * 0.80, + height: SizeConfig.screenHeight * heightPercentage, + width: SizeConfig.screenWidth * widthPercentage, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(title, style: textStyle(2.5)), + Text(line1Text, style: textStyle(2.5)), SizedBox( height: 8, ), - Text(date, style: textStyle(2.5)), + Text(line2Text, style: textStyle(2.5)), SizedBox( height: 8, ), Row( children: [ - Icon(Icons.add_location), - Text(location, style: textStyle(2.5)) + Icon(icon), + Text(line3Text, style: textStyle(2.5)) ], ) ], From f3164f693eeab42b60268ad043710fbd6a20038d Mon Sep 17 00:00:00 2001 From: Elham Rababah Date: Tue, 14 Apr 2020 13:36:40 +0300 Subject: [PATCH 5/5] add curve background to all screen --- lib/routes.dart | 2 +- lib/screens/dashboard_screen.dart | 8 +- lib/screens/my_schedule_screen.dart | 7 - lib/screens/patients/patients_screen.dart | 47 ++----- lib/widgets/shared/app_scaffold_widget.dart | 139 ++++++++++++------- lib/widgets/shared/custom_shape_clipper.dart | 26 ++++ 6 files changed, 128 insertions(+), 101 deletions(-) create mode 100644 lib/widgets/shared/custom_shape_clipper.dart diff --git a/lib/routes.dart b/lib/routes.dart index 5e5c57c0..9aacf6cb 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -12,7 +12,7 @@ import './screens/patients/patient_search_screen.dart'; import './screens/patients/patients_screen.dart'; import './screens/settings/settings_screen.dart'; -const String INIT_ROUTE = PATIENTS; +const String INIT_ROUTE = LOGIN; const String HOME = '/'; const String LOGIN = 'login'; const String CHANGE_PASSWORD = 'change-password'; diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 4a286cde..d23af9cf 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -23,13 +23,7 @@ class _DashboardScreenState extends State { return AppScaffold( appBarTitle:'Home', body: Container( - decoration: new BoxDecoration( - gradient: LinearGradient( - colors: [Colors.red[100], Colors.white], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - ), + child: Column( children: [ Expanded( diff --git a/lib/screens/my_schedule_screen.dart b/lib/screens/my_schedule_screen.dart index b3ec10b8..0c4593ad 100644 --- a/lib/screens/my_schedule_screen.dart +++ b/lib/screens/my_schedule_screen.dart @@ -16,13 +16,6 @@ class MyScheduleScreen extends StatelessWidget { // pageOnly: false, appBarTitle: 'My Schdule', body: Container( - decoration: new BoxDecoration( - gradient: LinearGradient( - colors: [Colors.red[100], Colors.white], - begin: Alignment.topLeft, - end: Alignment.bottomRight, - ), - ), padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), child: ListView(children: [ Column( diff --git a/lib/screens/patients/patients_screen.dart b/lib/screens/patients/patients_screen.dart index 106cb6fe..68422e81 100644 --- a/lib/screens/patients/patients_screen.dart +++ b/lib/screens/patients/patients_screen.dart @@ -1,7 +1,5 @@ import 'package:flutter/material.dart'; -import 'package:hexcolor/hexcolor.dart'; -import '../../config/size_config.dart'; import '../../widgets/shared/app_scaffold_widget.dart'; import '../../widgets/shared/card_with_bg_widget.dart'; @@ -14,36 +12,21 @@ class PatientsScreen extends StatelessWidget { @override Widget build(BuildContext context) { return AppScaffold( - // pageOnly: false, - appBarTitle: 'Patients', - body: Stack( - children: [ - ClipPath( - clipper: CustomShapeClipper(), - child: Container( - height: SizeConfig.realScreenHeight * 0.40, - decoration: BoxDecoration(color: Hexcolor('#FFDDD9')))), - Positioned( - // key: , - // top: SizeConfig.realScreenHeight * 0.10, - child: Container( - // decoration: BoxDecoration(color: Colors.red), - // margin: EdgeInsets.symmetric(vertical: 500), - child: Column( - children: litems.map((item) { - return CardWithBgWidget( - line1Text: 'Fahad AlSlehm - 324599', - line2Text: '12/04/2020 - 02:00 PM', - // line3Text: '', - - heightPercentage: 0.15, - widthPercentage: 0.80); - }).toList(), - ), - ), - ) - ], - )); + appBarTitle: 'Patients', + body: Container( + child: Column( + children: litems.map((item) { + return CardWithBgWidget( + line1Text: 'Fahad AlSlehm - 324599', + line2Text: '12/04/2020 - 02:00 PM', + // line3Text: '', + + heightPercentage: 0.15, + widthPercentage: 0.80); + }).toList(), + ), + ), + ); } } diff --git a/lib/widgets/shared/app_scaffold_widget.dart b/lib/widgets/shared/app_scaffold_widget.dart index 1e0bff65..0993749f 100644 --- a/lib/widgets/shared/app_scaffold_widget.dart +++ b/lib/widgets/shared/app_scaffold_widget.dart @@ -1,3 +1,5 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; +import 'package:doctor_app_flutter/screens/patients/patients_screen.dart'; import 'package:hexcolor/hexcolor.dart'; import '../../presentation/doctor_app_icons.dart'; @@ -5,69 +7,98 @@ import '../../widgets/shared/app_drawer_widget.dart'; import 'package:flutter/material.dart'; class AppScaffold extends StatelessWidget { - AppScaffold( - {this.pageOnly, - this.appBarTitle, - this.showAppBar, - this.showBottomBar, - this.showAppDrawer, - this.body}); bool pageOnly = false; // bool showAll = bool showAppBar = true; bool showAppDrawer = true; bool showBottomBar = true; - String appBarTitle=''; + bool showbg = true; + bool showCurve = true; + String appBarTitle = ''; Widget body; + AppScaffold( + {this.pageOnly, + this.appBarTitle, + this.showAppBar, + this.showBottomBar, + this.showAppDrawer, + this.body, + this.showbg, + this.showCurve}); + @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Hexcolor('#FCF7F7'), - appBar: (pageOnly == true || showAppBar == false)?null:AppBar( - - elevation: 0, - backgroundColor: Hexcolor('#FFDDD9'), - textTheme: TextTheme( - title: TextStyle(color: Colors.black, fontWeight: FontWeight.bold)), - title: Text(appBarTitle), - leading: Builder(builder: (BuildContext context) { - return new GestureDetector( - onTap: () { - Scaffold.of(context).openDrawer(); - }, - child: IconButton( - icon: Icon(Icons.menu), - color: Colors.black, - onPressed: () => Scaffold.of(context).openDrawer(), - ), - ); - }), - centerTitle: true, - actions: [ - IconButton(icon: Icon(Icons.person), onPressed: null) - ], - ), - drawer: (pageOnly == true || showAppDrawer == false)?null:Theme( - data: Theme.of(context).copyWith( - canvasColor: Colors.transparent, - ), - child: SafeArea(child: AppDrawer()), - ), - // , - bottomNavigationBar: (pageOnly == true || showBottomBar == false)?null: BottomNavigationBar(items: [ - BottomNavigationBarItem( - icon: Icon(DoctorApp.home_icon), - title: Text('Home'), - backgroundColor: Colors.red, - activeIcon: Icon(Icons.home)), - BottomNavigationBarItem( - icon: new Icon(Icons.mail), - title: new Text('Messages'), - ), - BottomNavigationBarItem(icon: Icon(Icons.apps), title: Text('Menu')) - ]), - body: body, - ); + backgroundColor: + (pageOnly == true || showbg == false) ? null : Hexcolor('#FCF7F7'), + appBar: (pageOnly == true || showAppBar == false) + ? null + : AppBar( + elevation: 0, + backgroundColor: Hexcolor('#FFDDD9'), + textTheme: TextTheme( + title: TextStyle( + color: Colors.black, fontWeight: FontWeight.bold)), + title: Text(appBarTitle), + leading: Builder(builder: (BuildContext context) { + return new GestureDetector( + onTap: () { + Scaffold.of(context).openDrawer(); + }, + child: IconButton( + icon: Icon(Icons.menu), + color: Colors.black, + onPressed: () => Scaffold.of(context).openDrawer(), + ), + ); + }), + centerTitle: true, + actions: [ + IconButton(icon: Icon(Icons.person), onPressed: null) + ], + ), + drawer: (pageOnly == true || showAppDrawer == false) + ? null + : Theme( + data: Theme.of(context).copyWith( + canvasColor: Colors.transparent, + ), + child: SafeArea(child: AppDrawer()), + ), + // , + bottomNavigationBar: (pageOnly == true || showBottomBar == false) + ? null + : BottomNavigationBar(items: [ + BottomNavigationBarItem( + icon: Icon(DoctorApp.home_icon), + title: Text('Home'), + backgroundColor: Colors.red, + activeIcon: Icon(Icons.home)), + BottomNavigationBarItem( + icon: new Icon(Icons.mail), + title: new Text('Messages'), + ), + BottomNavigationBarItem( + icon: Icon(Icons.apps), title: Text('Menu')) + ]), + body: (pageOnly == true || showCurve == false) + ? body + : Stack( + children: [ + ClipPath( + clipper: CustomShapeClipper(), + child: Container( + height: SizeConfig.realScreenHeight * 0.40, + decoration: + BoxDecoration(color: Hexcolor('#FFDDD9')))), + Positioned( + // key: , + // top: SizeConfig.realScreenHeight * 0.10, + child: body) + ], + )); } } + + diff --git a/lib/widgets/shared/custom_shape_clipper.dart b/lib/widgets/shared/custom_shape_clipper.dart new file mode 100644 index 00000000..81f5ee20 --- /dev/null +++ b/lib/widgets/shared/custom_shape_clipper.dart @@ -0,0 +1,26 @@ +import 'package:flutter/material.dart'; + +class CustomShapeClipper extends CustomClipper { + @override + Path getClip(Size size) { + final Path path = Path(); + path.lineTo(0.0, size.height); + + var firstEndPoint = Offset(size.width * .5, size.height / 2); + var firstControlpoint = Offset(size.width * 0.25, size.height * 0.95 + 30); + path.quadraticBezierTo(firstControlpoint.dx, firstControlpoint.dy, + firstEndPoint.dx, firstEndPoint.dy); + + var secondEndPoint = Offset(size.width, size.height * 0.10); + var secondControlPoint = Offset(size.width * .75, size.height * .10 - 20); + path.quadraticBezierTo(secondControlPoint.dx, secondControlPoint.dy, + secondEndPoint.dx, secondEndPoint.dy); + + path.lineTo(size.width, 0.0); + path.close(); + return path; + } + + @override + bool shouldReclip(CustomClipper oldClipper) => true; +}