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; +}