diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 7ef74d57..475a7e68 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -1,4 +1,6 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; +import '../widgets/shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; @@ -29,10 +31,9 @@ class _DashboardScreenState extends State { flex: 1, child: Container( margin: EdgeInsets.all(10), - child: Text( + child: AppText( "Today's Statistics", - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 18), + fontWeight: FontWeight.bold, ), alignment: Alignment.centerLeft, )), @@ -43,7 +44,7 @@ class _DashboardScreenState extends State { children: [ Expanded( flex: 2, - child: RoundedContainer(CircularPercentIndicator( + child: RoundedContainer(child:CircularPercentIndicator( radius: 90.0, animation: true, animationDuration: 1200, @@ -52,18 +53,16 @@ class _DashboardScreenState extends State { center: Column( mainAxisAlignment: MainAxisAlignment.center, children: [ - new Text( + AppText( "38", - style: new TextStyle( fontWeight: FontWeight.bold, - fontSize: 24.0), + fontSize: SizeConfig.textMultiplier * 4 ), - new Text( + AppText( "Out-Patients", - style: new TextStyle( fontWeight: FontWeight.normal, - fontSize: 11.0, - color: Colors.grey[800]), + fontSize: SizeConfig.textMultiplier * 1.5, + color: Colors.grey[800] ), ], ), @@ -171,10 +170,9 @@ class _DashboardScreenState extends State { flex: 1, child: Container( margin: EdgeInsets.all(10), - child: Text( + child: AppText( "Patient Services", - style: TextStyle( - fontWeight: FontWeight.bold, fontSize: 15), + fontWeight: FontWeight.bold, ), alignment: Alignment.centerLeft, )), diff --git a/lib/widgets/dashboard/dashboard_item_icons_texts.dart b/lib/widgets/dashboard/dashboard_item_icons_texts.dart index feee3e93..527d8a8b 100644 --- a/lib/widgets/dashboard/dashboard_item_icons_texts.dart +++ b/lib/widgets/dashboard/dashboard_item_icons_texts.dart @@ -1,6 +1,7 @@ -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import '../shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import '../shared/app_texts_widget.dart'; class DashboardItemIconText extends StatefulWidget { @@ -23,7 +24,7 @@ class _DashboardItemTextsState extends State { @override Widget build(BuildContext context) { return new RoundedContainer( - Stack( + child:Stack( children: [ Align( alignment: FractionalOffset.topLeft, @@ -35,8 +36,8 @@ class _DashboardItemTextsState extends State { mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end, children: [ - Text(widget.value, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 21),), - Text(widget.label, style: TextStyle(fontWeight: FontWeight.normal, fontSize: 14),), + AppText(widget.value,), + Text(widget.label), ],)) ), diff --git a/lib/widgets/dashboard/dashboard_item_texts_widget.dart b/lib/widgets/dashboard/dashboard_item_texts_widget.dart index 9bfff90f..d7c11f5b 100644 --- a/lib/widgets/dashboard/dashboard_item_texts_widget.dart +++ b/lib/widgets/dashboard/dashboard_item_texts_widget.dart @@ -1,5 +1,6 @@ -import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; +import '../shared/rounded_container_widget.dart'; +import '../shared/app_texts_widget.dart'; import 'package:flutter/material.dart'; class DashboardItemTexts extends StatefulWidget { @@ -22,16 +23,17 @@ DashboardItemTexts(this.label, this.value, {this.backgroundColor = Colors.white, class _DashboardItemTextsState extends State { @override Widget build(BuildContext context) { - return new RoundedContainer(Stack( + return new RoundedContainer( + child:Stack( children: [ Align( alignment: FractionalOffset.topLeft, - child:Container(margin: EdgeInsets.all(5), child: Text(widget.label),) + child:Container(margin: EdgeInsets.all(5), child: AppText(widget.label),) ), Align( alignment: FractionalOffset.bottomRight, - child: Container(margin: EdgeInsets.all(10), child: Text(widget.value, style: TextStyle(fontWeight: FontWeight.bold, fontSize: 21),),) + child: Container(margin: EdgeInsets.all(10), child: AppText(widget.value, fontWeight: FontWeight.bold),) ), ],) ,backgroundColor: widget.backgroundColor, showBorder: widget.showBorder, borderColor: widget.borderColor, margin: 4,); diff --git a/lib/widgets/shared/app_drawer_widget.dart b/lib/widgets/shared/app_drawer_widget.dart index 042f6751..ea6ac000 100644 --- a/lib/widgets/shared/app_drawer_widget.dart +++ b/lib/widgets/shared/app_drawer_widget.dart @@ -1,7 +1,10 @@ +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/widgets/shared/drawer_item_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:flutter/material.dart'; +import 'app_texts_widget.dart'; + // OWNER : Ibrahim albitar // DATE : 06-04-2020 // DESCRIPTION : Custom App Drawer for app. @@ -14,40 +17,55 @@ class AppDrawer extends StatefulWidget { class _AppDrawerState extends State { @override Widget build(BuildContext context) { - return - - RoundedContainer( - Drawer( - child: ListView( - padding: EdgeInsets.zero, - children: [ - DrawerHeader( - child: Column( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - CircleAvatar( - radius: 40, - backgroundImage: NetworkImage("https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png"), - backgroundColor: Colors.transparent, - ), - Padding(padding: EdgeInsets.only(top: 10), child: Text("Dr. Chris evans", style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold , color: Colors.white), )), - Text("Director of medical records", style: TextStyle(fontSize: 14, fontWeight: FontWeight.normal, color: Colors.white),) - ], - ), - decoration: BoxDecoration( - color: Color(0x58434F) + return RoundedContainer( + child: Container( + margin: EdgeInsets.only(top: SizeConfig.heightMultiplier * 9), + child: Drawer( + child: ListView( + padding: EdgeInsets.zero, + children: [ + Container( + height: SizeConfig.heightMultiplier * 30, + child: DrawerHeader( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + backgroundImage: NetworkImage( + "https://p.kindpng.com/picc/s/404-4042774_profile-photo-circle-circle-profile-picture-png-transparent.png"), + backgroundColor: Colors.transparent, + ), + Padding( + padding: EdgeInsets.only(top: 10), + child: AppText( + "Dr. Chris evans", + fontWeight: FontWeight.bold, + color: Colors.white, + fontSize: SizeConfig.textMultiplier * 3, + )), + AppText("Director of medical records", + fontWeight: FontWeight.normal, color: Colors.white) + ], + ), + ), + ), + DrawerItem("My Schedule", Icons.table_chart), + DrawerItem("Settings", Icons.settings), + DrawerItem("QR Reader", Icons.search), + ] + ) ), ), - DrawerItem() - ]) - ), - margin: 0, - customCornerRaduis: true, - topRight: 30, - bottomRight: 30, - backgroundColor: Color(0xff58434F), + width: SizeConfig.realScreenWidth * 0.55, + margin: 0, + customCornerRaduis: true, + topRight: 30, + bottomRight: 30, + backgroundColor: Color(0xff58434F), ); } + drawerNavigator(context, routeName) { Navigator.of(context).pushNamed(routeName); } diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 8b05ed78..835323f3 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -3,28 +3,55 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; // OWNER : Ibrahim albitar -// DATE : 05-04-2020 -// DESCRIPTION : Customization for Texts in app +// DATE : 12-04-2020 +// DESCRIPTION : Customization for Texts in app -class AppTexts extends StatefulWidget{ +class AppText extends StatefulWidget { + final String data; + final Color color; + final FontWeight fontWeight; + final double fontSize; + final String fontFamily; + final double margin; + final double marginTop; + final double marginRight; + final double marginBottom; + final double marginLeft; - final String data; - final Color textColor; - final FontWeight fontWeight; - final double fontSize; - final String fontFamily; - -AppTexts(this.data, {this.textColor = Colors.black, this.fontWeight = FontWeight.normal, this.fontSize = 22, this.fontFamily = 'WorkSans'}); + AppText(this.data, + {this.color = Colors.black, + this.fontWeight = FontWeight.normal, + this.fontSize, + this.fontFamily = 'WorkSans', + this.margin, + this.marginTop = 0, + this.marginRight = 0, + this.marginBottom = 0, + this.marginLeft = 0,}); @override - _AppTextsState createState() => _AppTextsState(); - + _AppTextState createState() => _AppTextState(); } - class _AppTextsState extends State{ +class _AppTextState extends State { @override Widget build(BuildContext context) { - return Text(widget.data,style: TextStyle(color: widget.textColor, fontWeight: widget.fontWeight, fontSize: widget.fontSize, fontFamily: widget.fontFamily),); + + return Container( + margin: widget.margin != null ? EdgeInsets.all(widget.margin) : EdgeInsets.only( + top: widget.marginTop, + right: widget.marginRight, + bottom: widget.marginBottom, + left: widget.marginLeft + ), + child: Text( + widget.data, + style: TextStyle( + color: widget.color, + fontWeight: widget.fontWeight, + fontSize: widget.fontSize ?? (SizeConfig.textMultiplier * 2), + fontFamily: widget.fontFamily), + ), + ); } - - } \ No newline at end of file +} diff --git a/lib/widgets/shared/card_with_bg_widget.dart b/lib/widgets/shared/card_with_bg_widget.dart index 9b4bf4ff..1936b586 100644 --- a/lib/widgets/shared/card_with_bg_widget.dart +++ b/lib/widgets/shared/card_with_bg_widget.dart @@ -23,7 +23,7 @@ class CardWithBgWidget extends StatelessWidget { return Stack( children: [ RoundedContainer( - Container( + child:Container( height: SizeConfig.screenHeight * heightPercentage, width: SizeConfig.screenWidth * widthPercentage, ), @@ -36,7 +36,7 @@ class CardWithBgWidget extends StatelessWidget { Positioned( left: 10, child: RoundedContainer( - Container( + child:Container( padding: const EdgeInsets.all(15.0), height: SizeConfig.screenHeight * heightPercentage, width: SizeConfig.screenWidth * widthPercentage, diff --git a/lib/widgets/shared/drawer_item_widget.dart b/lib/widgets/shared/drawer_item_widget.dart index 430fc33e..fdf035be 100644 --- a/lib/widgets/shared/drawer_item_widget.dart +++ b/lib/widgets/shared/drawer_item_widget.dart @@ -1,6 +1,6 @@ import 'dart:ui'; -import 'package:doctor_app_flutter/presentation/doctor_app_icons.dart'; +import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:flutter/material.dart'; import '../shared/app_texts_widget.dart'; @@ -10,6 +10,12 @@ import '../shared/app_texts_widget.dart'; // DESCRIPTION : Custom Drawer item for app. class DrawerItem extends StatefulWidget { + + final String title; + final IconData icon; + + DrawerItem(this.title, this.icon); + @override _DrawerItemState createState() => _DrawerItemState(); } @@ -17,11 +23,24 @@ class DrawerItem extends StatefulWidget { class _DrawerItemState extends State { @override Widget build(BuildContext context) { - return Row( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - Icon(DoctorApp.home_icon,color: Colors.white,), - AppTexts("data", textColor: Colors.white, fontWeight: FontWeight.bold), - ],); + return Container( + margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + widget.icon, + color: Colors.white, + size: SizeConfig.imageSizeMultiplier * 7, + ), + AppText( + widget.title, + color: Colors.white, + fontWeight: FontWeight.bold, + margin: 10, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ], + )); } -} \ No newline at end of file +} diff --git a/lib/widgets/shared/rounded_container_widget.dart b/lib/widgets/shared/rounded_container_widget.dart index 8b071cf9..8ffedd20 100644 --- a/lib/widgets/shared/rounded_container_widget.dart +++ b/lib/widgets/shared/rounded_container_widget.dart @@ -5,6 +5,8 @@ import 'package:flutter/material.dart'; // DESCRIPTION : Custom widget for rounded container and custom decoration class RoundedContainer extends StatefulWidget { + final double width; + final double height; final double raduis; final Color backgroundColor; final double margin; @@ -16,12 +18,14 @@ class RoundedContainer extends StatefulWidget { final double bottomRight; final double topRight; final double bottomLeft; - final Widget widget; + final Widget child; final double borderWidth; RoundedContainer( - this.widget, - {this.raduis = 10, + {@required this.child, + this.width, + this.height, + this.raduis = 10, this.backgroundColor = Colors.white, this.margin = 10, this.elevation = 1, @@ -43,8 +47,8 @@ class _RoundedContainerState extends State { @override Widget build(BuildContext context) { return Container( - height: null, - width: null, + width: widget.width, + height: widget.height, margin: EdgeInsets.all(widget.margin), decoration: widget.showBorder == true ? BoxDecoration( @@ -71,7 +75,7 @@ class _RoundedContainerState extends State { : BorderRadius.circular(widget.raduis), ), color: widget.backgroundColor, - child: widget.widget, + child: widget.child, )); } }