add base client, landing page, bottom_nav_bar , List Container, List Item, drawer progress indicator and asset file
parent
3ed5c3878f
commit
19676549e1
Binary file not shown.
@ -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.
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
After Width: | Height: | Size: 8.5 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 81 KiB |
@ -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<String, dynamic> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<LandingPage> {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -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<int> changeIndex;
|
||||
|
||||
BottomNavBar({Key key, this.changeIndex}) : super(key: key);
|
||||
|
||||
@override
|
||||
_BottomNavBarState createState() => _BottomNavBarState();
|
||||
}
|
||||
|
||||
class _BottomNavBarState extends State<BottomNavBar> {
|
||||
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: <Widget>[
|
||||
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,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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<int> 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: <Widget>[
|
||||
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,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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: <Widget>[
|
||||
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,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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<AppDrawer> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ListContainer(
|
||||
child: Container(
|
||||
color: Colors.white,
|
||||
child: Drawer(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
flex: 4,
|
||||
child: ListView(
|
||||
padding: EdgeInsets.zero,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: SizeConfig.heightMultiplier * 50,
|
||||
child: InkWell(
|
||||
child: DrawerHeader(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
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: <Widget>[
|
||||
Container(
|
||||
// This align moves the children to the bottom
|
||||
child: Align(
|
||||
alignment: FractionalOffset.bottomCenter,
|
||||
child: Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Text("Powered by"),
|
||||
Image.asset(
|
||||
'assets/images/cs_logo_container.png',
|
||||
width: SizeConfig.imageSizeMultiplier * 30,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
drawerNavigator(context, routeName) {
|
||||
Navigator.of(context).pushNamed(routeName);
|
||||
}
|
||||
}
|
||||
@ -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<DrawerItem> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(top: 5, bottom: 5, left: 10, right: 10),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
widget.icon,
|
||||
color: widget.iconColor,
|
||||
size: SizeConfig.imageSizeMultiplier * 5,
|
||||
),
|
||||
Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Texts(
|
||||
widget.title,
|
||||
color: widget.textColor,
|
||||
fontSize: SizeConfig.textMultiplier * 2.3,
|
||||
),
|
||||
Texts(
|
||||
widget.subTitle,
|
||||
color: widget.textColor,
|
||||
fontSize: SizeConfig.textMultiplier * 2.5,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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: <Widget>[
|
||||
IconButton(
|
||||
icon: Icon(FontAwesomeIcons.home),
|
||||
color: Colors.white,
|
||||
onPressed: () {
|
||||
// TODO add navigator to home page
|
||||
},
|
||||
),
|
||||
],
|
||||
)
|
||||
: null,
|
||||
body: projectProvider.isInternetConnection
|
||||
? Stack(children: <Widget>[body, buildAppLoaderWidget(isLoading)])
|
||||
: Center(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
Image.asset(
|
||||
"assets/images/undraw_connected_world_wuay.png",
|
||||
height: 250,
|
||||
),
|
||||
Texts('No Internet Connection')
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget buildAppLoaderWidget(bool isloading) {
|
||||
return isloading ? AppLoaderWidget() : Container();
|
||||
}
|
||||
}
|
||||
@ -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()),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -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<AppLoaderWidget> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue