improve home page to match the xd
parent
cc7fedc8f5
commit
a5ea23c38e
@ -0,0 +1,41 @@
|
|||||||
|
// ignore: must_be_immutable
|
||||||
|
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class Label extends StatelessWidget {
|
||||||
|
Label({
|
||||||
|
Key key, this.firstLine, this.secondLine, this.color,
|
||||||
|
}) : super(key: key);
|
||||||
|
final String firstLine;
|
||||||
|
final String secondLine;
|
||||||
|
Color color;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if(color == null) {
|
||||||
|
color = Color(0xFF2E303A);
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
AppText(
|
||||||
|
firstLine,
|
||||||
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() *3 ,
|
||||||
|
// fontWeight: FontWeight.bold,
|
||||||
|
color: color,
|
||||||
|
fontHeight: .5,
|
||||||
|
),
|
||||||
|
AppText(
|
||||||
|
secondLine,
|
||||||
|
color: color,
|
||||||
|
fontSize: SizeConfig.getTextMultiplierBasedOnWidth() * 5,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,205 @@
|
|||||||
|
// ignore: must_be_immutable
|
||||||
|
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/enum/viewstate.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/authentication_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/dashboard_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||||
|
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/patients/profile/profile-welcome-widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
|
||||||
|
import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart';
|
||||||
|
import 'package:flutter/cupertino.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
// ignore: must_be_immutable
|
||||||
|
class HomeScreenHeader extends StatefulWidget with PreferredSizeWidget {
|
||||||
|
|
||||||
|
final DashboardViewModel model;
|
||||||
|
|
||||||
|
double height = SizeConfig.heightMultiplier *
|
||||||
|
(SizeConfig.isHeightVeryShort ? 10 : 6);
|
||||||
|
|
||||||
|
HomeScreenHeader({Key key, this.model}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_HomeScreenHeaderState createState() => _HomeScreenHeaderState();
|
||||||
|
|
||||||
|
@override
|
||||||
|
// TODO: implement preferredSize
|
||||||
|
Size get preferredSize => Size(double.maxFinite,height);
|
||||||
|
}
|
||||||
|
|
||||||
|
class _HomeScreenHeaderState extends State<HomeScreenHeader> {
|
||||||
|
ProjectViewModel projectsProvider;
|
||||||
|
var clinicId;
|
||||||
|
|
||||||
|
AuthenticationViewModel authenticationViewModel;
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
ProjectViewModel projectsProvider = Provider.of<ProjectViewModel>(context);
|
||||||
|
authenticationViewModel = Provider.of<AuthenticationViewModel>(context);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
color: Colors.grey[100],
|
||||||
|
child: Stack(children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Image.asset(
|
||||||
|
'assets/images/menu.png',
|
||||||
|
width: SizeConfig.widthMultiplier * 7,
|
||||||
|
),
|
||||||
|
iconSize: SizeConfig.heightMultiplier * 2,
|
||||||
|
color: Colors.black,
|
||||||
|
onPressed: () => Scaffold.of(context).openDrawer(),
|
||||||
|
),
|
||||||
|
Column(
|
||||||
|
children: <Widget>[
|
||||||
|
ProfileWelcomeWidget(
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
width: MediaQuery
|
||||||
|
.of(context)
|
||||||
|
.size
|
||||||
|
.width * .6,
|
||||||
|
child: projectsProvider.doctorClinicsList.length >
|
||||||
|
0
|
||||||
|
? Stack(
|
||||||
|
children: [
|
||||||
|
DropdownButtonHideUnderline(
|
||||||
|
child: DropdownButton(
|
||||||
|
dropdownColor: Colors.white,
|
||||||
|
iconEnabledColor: Colors.black,
|
||||||
|
isExpanded: true,
|
||||||
|
value: clinicId == null
|
||||||
|
? projectsProvider
|
||||||
|
.doctorClinicsList[0].clinicID
|
||||||
|
: clinicId,
|
||||||
|
iconSize: SizeConfig.widthMultiplier * 7,
|
||||||
|
elevation: 16,
|
||||||
|
selectedItemBuilder:
|
||||||
|
(BuildContext context) {
|
||||||
|
return projectsProvider
|
||||||
|
.doctorClinicsList
|
||||||
|
.map((item) {
|
||||||
|
return Row(
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment.end,
|
||||||
|
children: <Widget>[
|
||||||
|
Column(
|
||||||
|
mainAxisAlignment:
|
||||||
|
MainAxisAlignment
|
||||||
|
.center,
|
||||||
|
children: [
|
||||||
|
Container(
|
||||||
|
padding:
|
||||||
|
EdgeInsets.all(2),
|
||||||
|
margin:
|
||||||
|
EdgeInsets.all(2),
|
||||||
|
decoration:
|
||||||
|
new BoxDecoration(
|
||||||
|
color:
|
||||||
|
Colors.red[800],
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius
|
||||||
|
.circular(
|
||||||
|
20),
|
||||||
|
),
|
||||||
|
constraints:
|
||||||
|
BoxConstraints(
|
||||||
|
minWidth: SizeConfig
|
||||||
|
.widthMultiplier * 5.5,
|
||||||
|
minHeight: SizeConfig
|
||||||
|
.widthMultiplier * 5,
|
||||||
|
),
|
||||||
|
child: Center(
|
||||||
|
child: AppText(
|
||||||
|
projectsProvider
|
||||||
|
.doctorClinicsList
|
||||||
|
.length
|
||||||
|
.toString(),
|
||||||
|
color:
|
||||||
|
Colors.white,
|
||||||
|
fontSize:
|
||||||
|
projectsProvider
|
||||||
|
.isArabic
|
||||||
|
? SizeConfig
|
||||||
|
.widthMultiplier * 3.5
|
||||||
|
: SizeConfig
|
||||||
|
.widthMultiplier * 3,
|
||||||
|
textAlign:
|
||||||
|
TextAlign
|
||||||
|
.center,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
AppText(item.clinicName,
|
||||||
|
fontSize: SizeConfig
|
||||||
|
.getTextMultiplierBasedOnWidth(
|
||||||
|
width: MediaQuery
|
||||||
|
.of(context)
|
||||||
|
.size
|
||||||
|
.width * .6) * 5,
|
||||||
|
color: Colors.black,
|
||||||
|
textOverflow: TextOverflow
|
||||||
|
.ellipsis,
|
||||||
|
fontWeight:
|
||||||
|
FontWeight.bold,
|
||||||
|
textAlign: TextAlign.end),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}).toList();
|
||||||
|
},
|
||||||
|
onChanged: (newValue) async {
|
||||||
|
setState(() {
|
||||||
|
clinicId = newValue;
|
||||||
|
});
|
||||||
|
|
||||||
|
GifLoaderDialogUtils.showMyDialog(
|
||||||
|
context);
|
||||||
|
await widget.model.changeClinic(newValue,
|
||||||
|
authenticationViewModel);
|
||||||
|
GifLoaderDialogUtils.hideDialog(
|
||||||
|
context);
|
||||||
|
if (widget.model.state ==
|
||||||
|
ViewState.ErrorLocal) {
|
||||||
|
DrAppToastMsg.showErrorToast(
|
||||||
|
widget.model.error);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
items: projectsProvider
|
||||||
|
.doctorClinicsList
|
||||||
|
.map((item) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
child: AppText(
|
||||||
|
item.clinicName,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
),
|
||||||
|
value: item.clinicID,
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: AppText(
|
||||||
|
TranslationBase
|
||||||
|
.of(context)
|
||||||
|
.noClinic),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
isClinic: true,
|
||||||
|
height: widget.height,
|
||||||
|
),
|
||||||
|
])
|
||||||
|
]));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue