profile screen and extentions class

merge-requests/12/head
unknown 6 years ago
parent 2cc929fa88
commit 8c83166c40

@ -0,0 +1,63 @@
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/app_texts_widget.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';
class ProfileScreen extends StatefulWidget {
ProfileScreen({Key key, this.title}) : super(key: key);
final String title;
@override
_ProfileScreenState createState() => _ProfileScreenState();
}
class _ProfileScreenState extends State<ProfileScreen> {
@override
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle:'Profile',
body:ListView(
padding: EdgeInsets.zero,
children: <Widget>[
Container(
height: SizeConfig.heightMultiplier * 30,
child: DrawerHeader(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
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,
fontSize: SizeConfig.textMultiplier * 3,
)),
AppText("Director of medical records",)
],
),
),
),
RoundedContainer(child: ListView(children: <Widget>[
DrawerItem("Gender", Icons.person_pin, color: Colors.black, subTitle: "Male",),
DrawerItem("Clinic", Icons.build, color: Colors.black, subTitle: "Neurology Clinic",),
DrawerItem("Hospital", Icons.local_hospital, color: Colors.black, subTitle: "Al-Takkassussi",),
DrawerItem("Speciality", Icons.crop_square, color: Colors.black, subTitle: "being great",),
],),
width: SizeConfig.screenWidth*0.70,
height: SizeConfig.screenHeight*0.40,
),
]
));
}
}

@ -0,0 +1,8 @@
extension Extension on Object {
bool isNullOrEmpty() => this == null || this == '';
bool isNullEmptyOrFalse() => this == null || this == '' || !this;
bool isNullEmptyZeroOrFalse() =>
this == null || this == '' || !this || this == 0;
}

@ -1,6 +1,8 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../util/extenstions.dart';
// OWNER : Ibrahim albitar
// DATE : 12-04-2020
@ -17,6 +19,7 @@ class AppText extends StatefulWidget {
final double marginRight;
final double marginBottom;
final double marginLeft;
final bool visibility;
AppText(this.data,
{this.color = Colors.black,
@ -27,7 +30,8 @@ class AppText extends StatefulWidget {
this.marginTop = 0,
this.marginRight = 0,
this.marginBottom = 0,
this.marginLeft = 0,});
this.marginLeft = 0,
this.visibility = true});
@override
_AppTextState createState() => _AppTextState();
@ -37,20 +41,23 @@ class _AppTextState extends State<AppText> {
@override
Widget build(BuildContext context) {
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),
return Visibility(
visible: widget.visibility,
child: 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),
),
),
);
}

@ -2,6 +2,7 @@ import 'dart:ui';
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/material.dart';
import '../../util/extenstions.dart';
import '../shared/app_texts_widget.dart';
@ -12,9 +13,12 @@ import '../shared/app_texts_widget.dart';
class DrawerItem extends StatefulWidget {
final String title;
final String subTitle;
final IconData icon;
final Color color;
DrawerItem(this.title, this.icon);
DrawerItem(this.title, this.icon,{this.color, this.subTitle = ''});
@override
_DrawerItemState createState() => _DrawerItemState();
@ -30,15 +34,27 @@ class _DrawerItemState extends State<DrawerItem> {
children: <Widget>[
Icon(
widget.icon,
color: Colors.white,
color: widget.color??Colors.white,
size: SizeConfig.imageSizeMultiplier * 7,
),
AppText(
widget.title,
color: Colors.white,
fontWeight: FontWeight.bold,
margin: 10,
fontSize: SizeConfig.textMultiplier * 2.5,
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AppText(
widget.title,
color: widget.color??Colors.white,
fontWeight: FontWeight.bold,
margin: 5,
fontSize: SizeConfig.textMultiplier * 2.5,
),
AppText(
widget.subTitle,
visibility: !widget.subTitle.isNullOrEmpty(),
color: widget.color??Colors.white,
marginLeft: 5,
fontSize: SizeConfig.textMultiplier * 2.5,
),
],
),
],
));

@ -14,7 +14,7 @@ description: A new Flutter project.
version: 1.0.0+1
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.6.0 <3.0.0"
dependencies:
flutter:

Loading…
Cancel
Save