You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
doctor_app_flutter/lib/widgets/shared/app_scaffold_widget.dart

155 lines
5.3 KiB
Dart

import 'package:doctor_app_flutter/routes.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
import '../../config/size_config.dart';
import '../../presentation/doctor_app_icons.dart';
import '../../widgets/shared/app_drawer_widget.dart';
import '../../widgets/shared/app_loader_widget.dart';
import '../../widgets/shared/custom_shape_clipper.dart';
class AppScaffold extends StatelessWidget {
bool pageOnly = false;
// bool showAll =
bool showAppBar = true;
bool showAppDrawer = true;
bool showBottomBar = true;
bool showbg = true;
bool showCurve = true;
String appBarTitle = '';
Widget body;
bool isloading = false;
int current;
AppScaffold(
{this.pageOnly,
this.appBarTitle,
this.showAppBar,
this.showBottomBar,
this.showAppDrawer = true,
this.body,
this.showbg,
this.showCurve,
this.isloading = false,
this.current});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor:
(pageOnly == true || showbg == false) ? null : Hexcolor('#FCF7F7'),
appBar: (pageOnly == true || showAppBar == false)
? null
: AppBar(
elevation: 0,
backgroundColor: Hexcolor('#FFDDD9'),
textTheme: TextTheme(
title: TextStyle(
color: Colors.black, fontWeight: FontWeight.bold)),
title: Text(appBarTitle.toUpperCase()),
leading: Builder(builder: (BuildContext context) {
return IconButton(
icon: showAppDrawer
? Icon(Icons.menu)
: Icon(Icons.arrow_back_ios),
color: Colors.black,
onPressed: () => showAppDrawer
? Scaffold.of(context).openDrawer()
: Navigator.pop(context),
);
}),
centerTitle: true,
actions: <Widget>[
IconButton(icon: Icon(Icons.person), onPressed: null)
],
),
drawer: (pageOnly == true || showAppDrawer == false)
? null
: Theme(
data: Theme.of(context).copyWith(
canvasColor: Colors.transparent,
),
child: SafeArea(child: AppDrawer()),
),
// ,
bottomNavigationBar: (pageOnly == true || showBottomBar == false)
? null
: BottomNavigationBar(
items: [
BottomNavigationBarItem(
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,
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,
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(
children: <Widget>[
ClipPath(
clipper: CustomShapeClipper(),
child: Container(
height: SizeConfig.realScreenHeight * 0.40,
decoration:
BoxDecoration(color: Hexcolor('#FFDDD9')))),
Positioned(
// key: ,
// top: SizeConfig.realScreenHeight * 0.10,
child: body),
buildAppLoaderWidget(isloading)
],
));
}
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:
}
}
}
}