diff --git a/assets/fonts/DoctorApp.ttf b/assets/fonts/DoctorApp.ttf new file mode 100644 index 0000000..718a3af Binary files /dev/null and b/assets/fonts/DoctorApp.ttf differ diff --git a/assets/fonts/Work_Sans/OFL.txt b/assets/fonts/Work_Sans/OFL.txt new file mode 100644 index 0000000..5c0354e --- /dev/null +++ b/assets/fonts/Work_Sans/OFL.txt @@ -0,0 +1,93 @@ +Copyright (c) 2014-2015 Wei Huang (wweeiihhuuaanngg@gmail.com) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +http://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/assets/fonts/Work_Sans/WorkSans-Black.ttf b/assets/fonts/Work_Sans/WorkSans-Black.ttf new file mode 100644 index 0000000..fb74420 Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-Black.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-Bold.ttf b/assets/fonts/Work_Sans/WorkSans-Bold.ttf new file mode 100644 index 0000000..7caa359 Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-Bold.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-ExtraBold.ttf b/assets/fonts/Work_Sans/WorkSans-ExtraBold.ttf new file mode 100644 index 0000000..fd4b912 Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-ExtraBold.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-ExtraLight.ttf b/assets/fonts/Work_Sans/WorkSans-ExtraLight.ttf new file mode 100644 index 0000000..b97cf8c Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-ExtraLight.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-Light.ttf b/assets/fonts/Work_Sans/WorkSans-Light.ttf new file mode 100644 index 0000000..3e981fb Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-Light.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-Medium.ttf b/assets/fonts/Work_Sans/WorkSans-Medium.ttf new file mode 100644 index 0000000..7a2645b Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-Medium.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-Regular.ttf b/assets/fonts/Work_Sans/WorkSans-Regular.ttf new file mode 100644 index 0000000..0ac4520 Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-Regular.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-SemiBold.ttf b/assets/fonts/Work_Sans/WorkSans-SemiBold.ttf new file mode 100644 index 0000000..589a5f5 Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-SemiBold.ttf differ diff --git a/assets/fonts/Work_Sans/WorkSans-Thin.ttf b/assets/fonts/Work_Sans/WorkSans-Thin.ttf new file mode 100644 index 0000000..011fcd3 Binary files /dev/null and b/assets/fonts/Work_Sans/WorkSans-Thin.ttf differ diff --git a/assets/images/cs_logo_container.png b/assets/images/cs_logo_container.png new file mode 100644 index 0000000..5f93858 Binary files /dev/null and b/assets/images/cs_logo_container.png differ diff --git a/assets/images/undraw_connected_world_wuay.png b/assets/images/undraw_connected_world_wuay.png new file mode 100644 index 0000000..f1bd3f0 Binary files /dev/null and b/assets/images/undraw_connected_world_wuay.png differ diff --git a/lib/client/base_app_client.dart b/lib/client/base_app_client.dart new file mode 100644 index 0000000..ec90558 --- /dev/null +++ b/lib/client/base_app_client.dart @@ -0,0 +1,62 @@ +import 'dart:convert'; +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; +import 'package:diplomaticquarterapp/uitl/utils.dart'; +import 'package:http/http.dart' as http; + +AppSharedPreferences sharedPref = new AppSharedPreferences(); + +///Example +///await BaseAppClient.post('', +/// onSuccess: (dynamic response, int statusCode) {}, +/// onFailure: (String error, int statusCode) {}, +/// body: null); + +class BaseAppClient { + static post( + String endPoint, { + Map body, + Function(dynamic response, int statusCode) onSuccess, + Function(String error, int statusCode) onFailure, + }) async { + String url = BASE_URL + endPoint; + try { + + //Map profile = await sharedPref.getObj(DOCTOR_PROFILE); + // String token = await sharedPref.getString(TOKEN); + + print("URL : $url"); + print("Body : ${json.encode(body)}"); + + if (await Utils.checkConnection()) { + final response = await http.post(url, + body: json.encode(body), + headers: { + 'Content-Type': 'application/json', + 'Accept': 'application/json' + }); + final int statusCode = response.statusCode; + if (statusCode < 200 || statusCode >= 400 || json == null) { + onFailure('Error While Fetching data', statusCode); + } else { + var parsed = json.decode(response.body.toString()); + if (!parsed['IsAuthenticated']) { + // await helpers.logout(); + //helpers.showErrorToast('Your session expired Please login agian'); + // TODO create logout fun + } else if (parsed['MessageStatus'] == 1) { + onSuccess(parsed, statusCode); + } else { + onFailure(parsed['ErrorEndUserMessage'] ?? parsed['ErrorMessage'], + statusCode); + } + } + } else { + onFailure('Please Check The Internet Connection', -1); + } + } catch (e) { + print(e); + onFailure(e.toString(), -1); + } + } +} diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index cfa3067..7cb0159 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -6,5 +6,10 @@ const Map> localizedValues = { 'lanArabic': {'en': 'العربية', 'ar': 'العربية'}, 'cancel': {'en': 'CANCEL', 'ar': 'الغاء'}, 'done': {'en': 'DONE', 'ar': 'تأكيد'}, + 'replay2': {'en': 'Replay', 'ar': 'رد الطبيب'}, + 'home': {'en': 'Home', 'ar': 'الرئيسية'}, + 'services': {'en': 'SERVICES', 'ar': 'الخدمات'}, + 'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'}, + 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, }; diff --git a/lib/main.dart b/lib/main.dart index 42f2f02..ea3bf58 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,5 @@ import 'package:diplomaticquarterapp/pages/home_page.dart'; +import 'package:diplomaticquarterapp/pages/landing_page.dart'; import 'package:diplomaticquarterapp/providers/project_provider.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; @@ -60,6 +61,9 @@ class MyApp extends StatelessWidget { splashColor: Colors.transparent, primaryColor: Color.fromRGBO(78, 62, 253, 1.0), cursorColor: Color.fromRGBO(78, 62, 253, 1.0), + iconTheme:IconThemeData( + + ) , appBarTheme: AppBarTheme( color: Color.fromRGBO(247, 248, 251, 1), brightness: Brightness.light, @@ -71,9 +75,7 @@ class MyApp extends StatelessWidget { ), initialRoute: '/', routes: { - '/': (context) => MyHomePage( - title: 'Diplomatic Quarter App', - ) + '/': (context) => LandingPage() }, debugShowCheckedModeBanner: false, ), diff --git a/lib/pages/landing_page.dart b/lib/pages/landing_page.dart new file mode 100644 index 0000000..116abcd --- /dev/null +++ b/lib/pages/landing_page.dart @@ -0,0 +1,73 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/bottom_navigation/bottom_nav_bar.dart'; +import 'package:diplomaticquarterapp/widgets/drawer/app_drawer_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class LandingPage extends StatefulWidget { + @override + _LandingPageState createState() => _LandingPageState(); +} + +class _LandingPageState extends State { + int currentTab = 0; + PageController pageController; + + _changeCurrentTab(int tab) { + setState(() { + currentTab = tab; + pageController.jumpToPage(tab); + }); + } + + @override + void initState() { + super.initState(); + pageController = PageController(keepPage: true); + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + elevation: 0, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(getText(currentTab).toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.menu), + color: Colors.white, + onPressed: () => Scaffold.of(context).openDrawer(), + ); + }, + ), + centerTitle: true, + ), + drawer: SafeArea(child: AppDrawer()), + extendBody: true, + body: PageView( + physics: NeverScrollableScrollPhysics(), + controller: pageController, + children: [Container(), Container(), Container(), Container()], + ), + bottomNavigationBar: BottomNavBar(changeIndex: _changeCurrentTab), + ); + } + + getText(currentTab) { + switch (currentTab) { + case 0: + return TranslationBase.of(context).home; + case 1: + return 'asd'; + case 2: + return TranslationBase.of(context).mySchedule; + case 3: + return TranslationBase.of(context).services; + } + } +} diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 4c1b444..f9630b6 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -27,6 +27,18 @@ class TranslationBase { String get cancel => localizedValues['cancel'][locale.languageCode]; String get done => localizedValues['done'][locale.languageCode]; + + String get home => localizedValues['home'][locale.languageCode]; + + String get services => localizedValues['services'][locale.languageCode]; + + String get mySchedule => localizedValues['mySchedule'][locale.languageCode]; + + String get replay2 => localizedValues['replay2'][locale.languageCode]; + + String get logout => localizedValues['logout'][locale.languageCode]; + + } class TranslationBaseDelegate extends LocalizationsDelegate { diff --git a/lib/widgets/bottom_navigation/bottom_nav_bar.dart b/lib/widgets/bottom_navigation/bottom_nav_bar.dart new file mode 100644 index 0000000..3513bad --- /dev/null +++ b/lib/widgets/bottom_navigation/bottom_nav_bar.dart @@ -0,0 +1,89 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; + +import 'bottom_navigation_item.dart'; + +class BottomNavBar extends StatefulWidget { + final ValueChanged changeIndex; + + BottomNavBar({Key key, this.changeIndex}) : super(key: key); + + @override + _BottomNavBarState createState() => _BottomNavBarState(); +} + +class _BottomNavBarState extends State { + int _index = 0; + + _changeIndex(int index) { + widget.changeIndex(index); + setState(() { + _index = index; + }); + } + + @override + Widget build(BuildContext context) { + return BottomAppBar( + elevation: 4, + shape: CircularNotchedRectangle(), + color: Colors.white, + child: Padding( + padding: EdgeInsets.symmetric(horizontal: 18), + child: Row( + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + BottomNavigationItem( + icon: EvaIcons.home, + activeIcon: EvaIcons.home, + changeIndex: _changeIndex, + index: _index, + currentIndex: 0, + name: TranslationBase.of(context).home, + ), + BottomNavigationItem( + icon: EvaIcons.list, + activeIcon: EvaIcons.list, + changeIndex: _changeIndex, + index: _index, + currentIndex: 1, + name: TranslationBase.of(context).replay2, + ), + Expanded( + child: SizedBox( + height: 50, + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox(height: 22) + ], + ), + ), + ), + BottomNavigationItem( + icon:EvaIcons.person, + activeIcon: EvaIcons.person, + changeIndex: _changeIndex, + index: _index, + currentIndex: 2, + name: TranslationBase.of(context).mySchedule, + ), + BottomNavigationItem( + icon: EvaIcons.calendar, + activeIcon: EvaIcons.calendar, + changeIndex: _changeIndex, + index: _index, + currentIndex: 3, + name: TranslationBase.of(context).services, + ) + ], + ), + ), + ); + } +} diff --git a/lib/widgets/bottom_navigation/bottom_navigation_item.dart b/lib/widgets/bottom_navigation/bottom_navigation_item.dart new file mode 100644 index 0000000..b248e4a --- /dev/null +++ b/lib/widgets/bottom_navigation/bottom_navigation_item.dart @@ -0,0 +1,63 @@ +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; + +class BottomNavigationItem extends StatelessWidget { + final IconData icon; + final IconData activeIcon; + final ValueChanged changeIndex; + final int index; + final int currentIndex; + final String name; + + BottomNavigationItem( + {this.icon, + this.activeIcon, + this.changeIndex, + this.index, + this.currentIndex, + this.name}); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SizedBox( + height: 70.0, + child: Material( + type: MaterialType.transparency, + child: InkWell( + highlightColor: Colors.transparent, + splashColor: Colors.transparent, + onTap: () => changeIndex(currentIndex), + child: Column( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + SizedBox( + height: 15, + ), + Container( + child: Icon(currentIndex == index ? activeIcon : icon, + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).dividerColor, + size: 22.0), + ), + SizedBox( + height: 5, + ), + Texts( + name, + color: currentIndex == index + ? Theme.of(context).primaryColor + : Theme.of(context).dividerColor, + fontSize: 12, + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/data_display/list/ListContainer.dart b/lib/widgets/data_display/list/ListContainer.dart new file mode 100644 index 0000000..8a3bd47 --- /dev/null +++ b/lib/widgets/data_display/list/ListContainer.dart @@ -0,0 +1,32 @@ +import 'package:flutter/material.dart'; + +class ListContainer extends StatelessWidget { + final double size; + final EdgeInsets padding; + final Widget child; + + ListContainer({Key key, this.size, this.padding, this.child}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return FractionallySizedBox( + widthFactor: size ?? 0.9, + child: ClipRRect( + borderRadius: BorderRadius.circular(8.0), + child: Material( + color: Theme.of(context).backgroundColor, + child: Container( + padding: padding, + width: double.infinity, + decoration: BoxDecoration( + border: Border.all( + color: Theme.of(context).dividerColor, width: 2.0), + borderRadius: BorderRadius.circular(8.0)), + child: child, + ), + ), + ), + ); + } +} diff --git a/lib/widgets/data_display/list/ListItem.dart b/lib/widgets/data_display/list/ListItem.dart new file mode 100644 index 0000000..2917a1e --- /dev/null +++ b/lib/widgets/data_display/list/ListItem.dart @@ -0,0 +1,73 @@ +import 'package:eva_icons_flutter/eva_icons_flutter.dart'; +import 'package:flutter/material.dart'; + +class ListItem extends StatelessWidget { + final IconData icon; + final Function onTap; + final Color color; + final Color iconColor; + final bool disabled; + final bool arrowIcon; + final double arrowIconSize; + final Color arrowIconColor; + final EdgeInsets padding; + final Widget itemContent; + final BoxDecoration decoration; + + ListItem( + {Key key, + this.icon, + this.iconColor, + this.disabled: false, + this.onTap, + this.color, + this.arrowIcon = false, + this.padding, + this.itemContent, + this.arrowIconColor, + this.arrowIconSize = 20, + this.decoration}) + : super(key: key); + + @override + Widget build(BuildContext context) { + return IgnorePointer( + ignoring: disabled, + child: Container( + decoration: decoration != null ? decoration : BoxDecoration(), + child: InkWell( + onTap: () { + if (onTap != null) onTap(); + }, + child: Padding( + padding: padding != null + ? padding + : const EdgeInsets.symmetric(horizontal: 24.0, vertical: 16.0), + child: Row( + children: [ + if (icon != null) + Icon( + icon, + color: + iconColor ?? (color ?? Theme.of(context).primaryColor), + size: 19, + ), + if (icon != null) SizedBox(width: 18.0), + Opacity(opacity: 0.8, child: itemContent), + if (arrowIcon) Expanded(child: Container()), + if (arrowIcon) + Icon( + EvaIcons.chevronRight, + color: arrowIconColor != null + ? arrowIconColor + : Colors.grey[500], + size: arrowIconSize, + ) + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/widgets/data_display/text.dart b/lib/widgets/data_display/text.dart index b9ce5aa..f68644e 100644 --- a/lib/widgets/data_display/text.dart +++ b/lib/widgets/data_display/text.dart @@ -14,6 +14,7 @@ class Texts extends StatefulWidget { final bool readMore; final String style; final bool allowExpand; + final double fontSize; Texts(this.text, {Key key, @@ -28,7 +29,8 @@ class Texts extends StatefulWidget { this.maxLength = 60, this.maxLines, this.readMore = false, - this.style}) + this.style, + this.fontSize}) : super(key: key); @override @@ -207,8 +209,8 @@ class _TextsState extends State { : TextStyle( fontStyle: widget.italic ? FontStyle.italic : null, color: - widget.color != null ? widget.color : Colors.black, - fontSize: _getFontSize(), + widget.color ?? Colors.black, + fontSize: widget.fontSize ?? _getFontSize(), letterSpacing: widget.variant == "overline" ? 1.5 : null, fontWeight: _getFontWeight(), diff --git a/lib/widgets/drawer/app_drawer_widget.dart b/lib/widgets/drawer/app_drawer_widget.dart new file mode 100644 index 0000000..6474e05 --- /dev/null +++ b/lib/widgets/drawer/app_drawer_widget.dart @@ -0,0 +1,130 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/list/ListContainer.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; +import '../../config/size_config.dart'; +import 'drawer_item_widget.dart'; + + + +class AppDrawer extends StatefulWidget { + @override + _AppDrawerState createState() => _AppDrawerState(); +} + +class _AppDrawerState extends State { + @override + Widget build(BuildContext context) { + return ListContainer( + child: Container( + color: Colors.white, + child: Drawer( + child: Column( + children: [ + Expanded( + flex: 4, + child: ListView( + padding: EdgeInsets.zero, + children: [ + Container( + height: SizeConfig.heightMultiplier * 50, + child: InkWell( + child: DrawerHeader( + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + child: Image.asset('assets/images/logo.png'), + margin: EdgeInsets.only(top: 10, bottom: 15), + ), + SizedBox( + height: 1, + child: Container( + color: Colors.black26, + ), + ), + SizedBox(height: 15), + CircleAvatar( + radius: SizeConfig.imageSizeMultiplier * 12, + backgroundColor: Colors.white, + //TODO add backgroundImage: NetworkImage(''), + ), + Padding( + padding: EdgeInsets.only(top: 10), + child: Texts( + 'Patient', + color: Colors.black, + fontSize: SizeConfig.textMultiplier * 2, + )), + Texts("Director of medical records", + //TODO: Make The Dr Title Dynamic and check overflow issue. + + color: Colors.black87), + RaisedButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(18.0), + side: BorderSide(color: Colors.red), + ), + child: Texts( + TranslationBase.of(context).logout, + color: Colors.white, + ), + onPressed: () async { + Navigator.pop(context); + //TODO add await helpers.logout(); + }, + ), + ], + ), + ), + onTap: () { + //TODO add fun + }, + ), + ), + InkWell( + child: DrawerItem( + TranslationBase.of(context).settings, Icons.settings), + onTap: () { + Navigator.pop(context); + //TODO add fun + }, + ), + ], + ), + ), + Expanded( + flex: 1, + child: Column( + children: [ + Container( + // This align moves the children to the bottom + child: Align( + alignment: FractionalOffset.bottomCenter, + child: Container( + child: Column( + children: [ + Text("Powered by"), + Image.asset( + 'assets/images/cs_logo_container.png', + width: SizeConfig.imageSizeMultiplier * 30, + ) + ], + ), + ), + ), + ) + ], + ), + ) + ], + ), + ), + ), + ); + } + + drawerNavigator(context, routeName) { + Navigator.of(context).pushNamed(routeName); + } +} diff --git a/lib/widgets/drawer/drawer_item_widget.dart b/lib/widgets/drawer/drawer_item_widget.dart new file mode 100644 index 0000000..f7c6bf5 --- /dev/null +++ b/lib/widgets/drawer/drawer_item_widget.dart @@ -0,0 +1,55 @@ +import 'dart:ui'; +import 'package:diplomaticquarterapp/config/size_config.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'package:flutter/material.dart'; + +/// +class DrawerItem extends StatefulWidget { + final String title; + final String subTitle; + final IconData icon; + final Color textColor; + final Color iconColor; + + DrawerItem(this.title, this.icon, + {this.textColor = Colors.black, + this.iconColor = Colors.black87, + this.subTitle = ''}); + + @override + _DrawerItemState createState() => _DrawerItemState(); +} + +class _DrawerItemState extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10), + child: Row( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Icon( + widget.icon, + color: widget.iconColor, + size: SizeConfig.imageSizeMultiplier * 5, + ), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Texts( + widget.title, + color: widget.textColor, + fontSize: SizeConfig.textMultiplier * 2.3, + ), + Texts( + widget.subTitle, + color: widget.textColor, + fontSize: SizeConfig.textMultiplier * 2.5, + ), + ], + ), + ], + ), + ); + } +} diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart new file mode 100644 index 0000000..8954e40 --- /dev/null +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -0,0 +1,79 @@ +import 'package:diplomaticquarterapp/config/config.dart'; +import 'package:diplomaticquarterapp/providers/project_provider.dart'; +import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; +import 'file:///D:/Mohammad/diplomatic_quarter_app/lib/widgets/progress_indicator/app_loader_widget.dart'; +import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; +import 'package:hexcolor/hexcolor.dart'; +import 'package:provider/provider.dart'; + +class AppScaffold extends StatelessWidget { + final String appBarTitle; + final Widget body; + final bool isLoading; + final bool isShowAppBar; + + AppScaffold( + {@required this.body, + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = true}); + + @override + Widget build(BuildContext context) { + AppGlobal.context = context; + ProjectProvider projectProvider = Provider.of(context); + return Scaffold( + backgroundColor: Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar + ? AppBar( + elevation: 0, + backgroundColor: Theme.of(context).appBarTheme.color, + textTheme: TextTheme( + headline6: + TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + ), + title: Text(appBarTitle.toUpperCase()), + leading: Builder( + builder: (BuildContext context) { + return IconButton( + icon: Icon(Icons.arrow_back_ios), + color: Colors.white, + onPressed: () => Navigator.pop(context), + ); + }, + ), + centerTitle: true, + actions: [ + IconButton( + icon: Icon(FontAwesomeIcons.home), + color: Colors.white, + onPressed: () { + // TODO add navigator to home page + }, + ), + ], + ) + : null, + body: projectProvider.isInternetConnection + ? Stack(children: [body, buildAppLoaderWidget(isLoading)]) + : Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + "assets/images/undraw_connected_world_wuay.png", + height: 250, + ), + Texts('No Internet Connection') + ], + ), + ), + ); + } + + Widget buildAppLoaderWidget(bool isloading) { + return isloading ? AppLoaderWidget() : Container(); + } +} diff --git a/lib/widgets/progress_indicator/app_circular_progress_Indeicator.dart b/lib/widgets/progress_indicator/app_circular_progress_Indeicator.dart new file mode 100644 index 0000000..f76f52f --- /dev/null +++ b/lib/widgets/progress_indicator/app_circular_progress_Indeicator.dart @@ -0,0 +1,16 @@ +import 'package:flutter/material.dart'; + +/// Show Progress Indicator +class AppCircularProgressIndicator extends StatelessWidget { + const AppCircularProgressIndicator({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.all(8.0), + child: Center(child: const CircularProgressIndicator()), + ); + } +} diff --git a/lib/widgets/progress_indicator/app_loader_widget.dart b/lib/widgets/progress_indicator/app_loader_widget.dart new file mode 100644 index 0000000..3398495 --- /dev/null +++ b/lib/widgets/progress_indicator/app_loader_widget.dart @@ -0,0 +1,40 @@ +import 'package:flutter/material.dart'; +import 'package:progress_hud_v2/progress_hud.dart'; + +/// show app Loader +/// [backgroundColor] the background color for the app loader +/// [color] the color for the app loader +class AppLoaderWidget extends StatefulWidget { + AppLoaderWidget( + {Key key, + this.backgroundColor = Colors.black12, + this.color = Colors.black}) + : super(key: key); + + final Color backgroundColor; + final Color color; + + @override + _AppLoaderWidgetState createState() => new _AppLoaderWidgetState(); +} + +class _AppLoaderWidgetState extends State { + ProgressHUD _progressHUD; + + @override + void initState() { + super.initState(); + + /// create progress Hud Indicator + _progressHUD = new ProgressHUD( + backgroundColor: widget.backgroundColor, + color: widget.color, + borderRadius: 5.0, + ); + } + + @override + Widget build(BuildContext context) { + return Positioned(child: _progressHUD); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 0715bf6..94f1bba 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -78,33 +78,14 @@ flutter: uses-material-design: true - # To add assets to your application, add an assets section, like this: # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware. - - # For details regarding adding assets from package dependencies, see - # https://flutter.dev/assets-and-images/#from-packages - - # To add custom fonts to your application, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts from package dependencies, - # see https://flutter.dev/custom-fonts/#from-packages + assets: + - assets/images/ + + fonts: + - family: WorkSans + fonts: + - asset: assets/fonts/Work_Sans/WorkSans-Regular.ttf + - asset: assets/fonts/Work_Sans/WorkSans-Bold.ttf + - asset: assets/fonts/Work_Sans/WorkSans-Bold.ttf + weight: 700