import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/service/AuthenticatedUserObject.dart'; import 'package:diplomaticquarterapp/core/viewModels/base_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/pages/landing/landing_page.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:provider/provider.dart'; import '../../locator.dart'; import 'arrow_back.dart'; import 'network_base_view.dart'; import 'not_auh_page.dart'; // ignore: must_be_immutable class AppScaffold extends StatelessWidget { final String appBarTitle; final Widget body; final Widget bottomSheet; final bool isLoading; final bool isShowAppBar; final bool hasAppBarParam; final BaseViewModel baseViewModel; final bool isBottomBar; final Widget floatingActionButton; final String title; final String description; final bool isShowDecPage; final List infoList; final List imagesInfo; AuthenticatedUserObject authenticatedUserObject = locator(); AppScaffold( {@required this.body, this.appBarTitle = '', this.isLoading = false, this.isShowAppBar = false, this.hasAppBarParam, this.bottomSheet, this.baseViewModel, this.floatingActionButton, this.title, this.description, this.isShowDecPage = true, this.isBottomBar, this.infoList, this.imagesInfo}); @override Widget build(BuildContext context) { AppGlobal.context = context; ProjectViewModel projectViewModel = Provider.of(context); return Scaffold( backgroundColor: Theme.of(context).scaffoldBackgroundColor, appBar: isShowAppBar ? AppBar( elevation: 0, backgroundColor: Theme.of(context).appBarTheme.color, textTheme: TextTheme( headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), title: Text( authenticatedUserObject.isLogin || !isShowDecPage ? appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle, style: TextStyle( fontWeight: FontWeight.bold, color: Colors.white, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { return ArrowBack(); }, ), centerTitle: true, actions: [ IconButton( icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { Navigator.pushAndRemoveUntil( context, MaterialPageRoute(builder: (context) => LandingPage()), (Route r) => false); }, ), ], ) : null, body: (!Provider.of(context, listen: false).isLogin && isShowDecPage) ? NotAutPage( title: title?? appBarTitle, description: description, infoList: infoList, imagesInfo: imagesInfo, ) : baseViewModel != null ? NetworkBaseView( child: body, baseViewModel: baseViewModel, ) : body, bottomSheet: (Provider.of(context, listen: false).isLogin || !isShowDecPage) ? bottomSheet : null, ); } }