import 'package:doctor_app_flutter/routes.dart'; import 'package:doctor_app_flutter/widgets/shared/profile_image_widget.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; //====== Color backGroundcolorhex=Colors.teal;//Hexcolor('#88b74093');//Hexcolor('#FCF7F7'); //====== AppScaffold( {this.pageOnly, this.appBarTitle, this.showAppBar, this.showBottomBar, this.showAppDrawer = true, this.body, this.showbg, this.showCurve, this.isloading = false, this.current, this.backGroundcolorhex }); @override Widget build(BuildContext context) { return Scaffold( backgroundColor:Hexcolor('#F5F5F5'), // (pageOnly == true || showbg == false) ? null : Hexcolor('#FCF7F7'), appBar: (pageOnly == true || showAppBar == false) ? null : AppBar( elevation: 0, backgroundColor:Hexcolor('#515B5D'), //Hexcolor('#FFDDD9'), textTheme: TextTheme( title: TextStyle( color: Colors.white, fontWeight: FontWeight.bold)),//Colors.black title: Text(appBarTitle.toUpperCase()), leading: Builder(builder: (BuildContext context) { return IconButton( icon: showAppDrawer ? Icon(Icons.menu) : Icon(Icons.arrow_back_ios), color: Colors.white,//Colors.black, onPressed: () => showAppDrawer ? Scaffold.of(context).openDrawer() : Navigator.pop(context), ); }), centerTitle: true, actions: [ // IconButton(icon: Icon(Icons.person), onPressed: null) ProfileImageWidget( height: 50, width: 50, url: "https://hmgwebservices.com/Images/MobileImages/DUBAI/unkown_female.png", ) ], ), 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: [body, buildAppLoaderWidget(isloading)]) : Stack( children: [ ClipPath( clipper: CustomShapeClipper(), child: Container( height: SizeConfig.realScreenHeight * 0.40, decoration: BoxDecoration(color: Hexcolor('#F5F5F5')))),//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: } } } }