fix bottom bar by Elham && mohammad

merge-requests/43/head
Elham Rababah 6 years ago
parent 5e6722dde0
commit c4c8609f3a

@ -1,3 +1,7 @@
import 'package:doctor_app_flutter/screens/doctor/message_screen.dart';
import 'package:doctor_app_flutter/screens/doctor/services_screen.dart';
import './screens/doctor/my_schedule_screen.dart';
import './screens/QR_reader_screen.dart';
import './screens/auth/change_password_screen.dart';
@ -8,7 +12,6 @@ import './screens/blood_bank_screen.dart';
import './screens/dashboard_screen.dart';
import 'screens/doctor/doctor_reply_screen.dart';
import './screens/medicine/medicine_search_screen.dart';
import './screens/my_schedule_screen.dart';
import './screens/patients/profile/patient_profile_screen.dart';
import './screens/patients/patient_search_screen.dart';
import './screens/patients/patients_screen.dart';
@ -16,7 +19,7 @@ import './screens/patients/profile/vital_sign/vital_sign_screen.dart';
import './screens/profile_screen.dart';
import './screens/settings/settings_screen.dart';
const String INIT_ROUTE = LOGIN; //PATIENT_SEARCH;
const String INIT_ROUTE = LOGIN;
const String HOME = '/';
const String LOGIN = 'login';
const String PROFILE = 'profile';
@ -30,6 +33,9 @@ const String PATIENTS = 'patients/patients';
const String PATIENTS_PROFILE = 'patients/patients-profile';
const String BLOOD_BANK = 'blood-bank';
const String DOCTOR_REPLY = 'doctor-reply';
const String MESSAGES = 'messages';
const String SERVICES = 'services';
const String MEDICINE_SEARCH = 'medicine-search';
const String SETTINGS = 'settings';
const String VITAL_SIGN = 'vital-sign';
@ -50,5 +56,7 @@ var routes = {
VERIFY_ACCOUNT: (_) => VerifyAccountScreen(),
VERIFICATION_METHODS: (_) => VerificationMethodsScreen(),
PATIENTS_PROFILE: (_) => PatientProfileScreen(),
VITAL_SIGN: (_) => VitalSignScreen()
VITAL_SIGN: (_) => VitalSignScreen(),
MESSAGES: (_) => MessagesScreen(),
SERVICES: (_) => ServicesScreen()
};

@ -27,6 +27,7 @@ class _DashboardScreenState extends State<DashboardScreen> {
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: 'Home',
current: 0,
body: Container(
child: Column(
children: <Widget>[

@ -0,0 +1,15 @@
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
class MessagesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppScaffold(
current: 1,
appBarTitle: 'Messages',
body: Center(
child: Text('Messages heeer'),
),
);
}
}

@ -4,9 +4,9 @@ import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indei
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../config/size_config.dart';
import '../widgets/shared/app_scaffold_widget.dart';
import '../widgets/shared/card_with_bg_widget.dart';
import '../../config/size_config.dart';
import '../../widgets/shared/app_scaffold_widget.dart';
import '../../widgets/shared/card_with_bg_widget.dart';
class MyScheduleScreen extends StatelessWidget {
ScheduleProvider scheduleProvider;

@ -0,0 +1,15 @@
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:flutter/material.dart';
class ServicesScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return AppScaffold(
current: 2,
appBarTitle: 'Services',
body: Center(
child: Text('Services heeer'),
),
);
}
}

@ -85,6 +85,7 @@ class _PatientSearchScreenState extends State<PatientSearchScreen> {
Widget build(BuildContext context) {
return AppScaffold(
appBarTitle: "SEARCH FOR PATIENT",
current: 1,
body: ListView(
children: <Widget>[
RoundedContainer(

@ -1,11 +1,10 @@
import 'package:doctor_app_flutter/providers/schedule_provider.dart';
import 'package:doctor_app_flutter/routes.dart';
import 'package:doctor_app_flutter/screens/my_schedule_screen.dart';
import 'package:doctor_app_flutter/screens/profile_screen.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../../config/size_config.dart';
import '../../providers/schedule_provider.dart';
import '../../routes.dart';
import '../../screens/doctor/my_schedule_screen.dart';
import '../../widgets/shared/drawer_item_widget.dart';
import '../../widgets/shared/rounded_container_widget.dart';
import 'app_texts_widget.dart';

@ -1,3 +1,4 @@
import 'package:doctor_app_flutter/routes.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
@ -18,6 +19,7 @@ class AppScaffold extends StatelessWidget {
String appBarTitle = '';
Widget body;
bool isloading = false;
int current;
AppScaffold(
{this.pageOnly,
@ -28,7 +30,8 @@ class AppScaffold extends StatelessWidget {
this.body,
this.showbg,
this.showCurve,
this.isloading = false});
this.isloading = false,
this.current});
@override
Widget build(BuildContext context) {
@ -46,9 +49,13 @@ class AppScaffold extends StatelessWidget {
title: Text(appBarTitle.toUpperCase()),
leading: Builder(builder: (BuildContext context) {
return IconButton(
icon: showAppDrawer ? Icon(Icons.menu) : Icon(Icons.arrow_back_ios) ,
icon: showAppDrawer
? Icon(Icons.menu)
: Icon(Icons.arrow_back_ios),
color: Colors.black,
onPressed: () => showAppDrawer? Scaffold.of(context).openDrawer() : Navigator.pop(context),
onPressed: () => showAppDrawer
? Scaffold.of(context).openDrawer()
: Navigator.pop(context),
);
}),
centerTitle: true,
@ -67,19 +74,43 @@ class AppScaffold extends StatelessWidget {
// ,
bottomNavigationBar: (pageOnly == true || showBottomBar == false)
? null
: BottomNavigationBar(items: [
: BottomNavigationBar(
items: [
BottomNavigationBarItem(
icon: Icon(DoctorApp.home_icon),
title: Text('Home'),
backgroundColor: Colors.red,
activeIcon: Icon(Icons.home)),
icon: Icon(
Icons.home,
color: current == 0 ? Colors.red : Colors.grey,
),
title: Text(
'Home',
style: TextStyle(
color: current == 0 ? Colors.red : Colors.grey),
),
backgroundColor: Colors.green,
// activeIcon: Icon(DoctorApp.home_icon)
),
BottomNavigationBarItem(
icon: new Icon(Icons.mail),
title: new Text('Messages'),
icon: new Icon(
Icons.mail,
color: current == 1 ? Colors.red : Colors.grey,
),
title: new Text('Messages',
style: TextStyle(
color: current == 1 ? Colors.red : Colors.grey)),
// backgroundColor: current == 1?Colors.red:Colors.grey,
),
BottomNavigationBarItem(
icon: Icon(Icons.apps), title: Text('Menu'))
]),
icon: Icon(
Icons.apps,
color: current == 2 ? Colors.red : Colors.grey,
),
title: Text('Menu',
style: TextStyle(
color: current == 2 ? Colors.red : Colors.grey)),
)
],
onTap: (index) => navigatot(index, context),
),
body: (pageOnly == true || showCurve == false)
? Stack(children: <Widget>[body, buildAppLoaderWidget(isloading)])
: Stack(
@ -102,4 +133,22 @@ class AppScaffold extends StatelessWidget {
Widget buildAppLoaderWidget(bool isloading) {
return isloading ? AppLoaderWidget() : Container();
}
navigatot(index, context) {
print('index :${index} current : ${current}');
if (index != current) {
switch (index) {
case 0:
Navigator.of(context).pushReplacementNamed(HOME);
break;
case 1:
Navigator.of(context).pushReplacementNamed(MESSAGES);
break;
case 2:
Navigator.of(context).pushReplacementNamed(SERVICES);
break;
default:
}
}
}
}

Loading…
Cancel
Save