voice command

merge-update-with-lab-changes
Sultan Khan 5 years ago
parent 3ac69692be
commit eeb073fb17

@ -13,8 +13,6 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart';
import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.dart';
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/robosearch.dart';
import 'package:diplomaticquarterapp/widgets/robo-search/search.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -48,74 +46,79 @@ class AppScaffold extends StatelessWidget {
final List<ImagesInfo> imagesInfo; final List<ImagesInfo> imagesInfo;
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
AppScaffold( AppScaffold(
{@required this.body, {@required this.body,
this.appBarTitle = '', this.appBarTitle = '',
this.isLoading = false, this.isLoading = false,
this.isShowAppBar = false, this.isShowAppBar = false,
this.hasAppBarParam, this.hasAppBarParam,
this.bottomSheet, this.bottomSheet,
this.baseViewModel, this.baseViewModel,
this.floatingActionButton, this.floatingActionButton,
this.isPharmacy = false, this.isPharmacy = false,
this.title, this.title,
this.description, this.description,
this.isShowDecPage = true, this.isShowDecPage = true,
this.isBottomBar, this.isBottomBar,
this.backgroundColor, this.backgroundColor,
this.preferredSize = 0.0, this.preferredSize = 0.0,
this.appBarIcons, this.appBarIcons,
this.infoList, this.imagesInfo}); this.infoList,
this.imagesInfo});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
AppGlobal.context = context; AppGlobal.context = context;
return Scaffold( return Scaffold(
backgroundColor: backgroundColor:
backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, backgroundColor ?? Theme.of(context).scaffoldBackgroundColor,
appBar: isShowAppBar? AppBarWidget( appBar: isShowAppBar
appBarTitle:appBarTitle, ? AppBarWidget(
appBarIcons:appBarIcons, appBarTitle: appBarTitle,
isPharmacy: isPharmacy, appBarIcons: appBarIcons,
isShowDecPage: isShowDecPage, isPharmacy: isPharmacy,
):null, isShowDecPage: isShowDecPage,
)
: null,
bottomSheet: bottomSheet, bottomSheet: bottomSheet,
body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && body: (!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
isShowDecPage) isShowDecPage)
? NotAutPage( ? NotAutPage(
title: title ?? appBarTitle, title: title ?? appBarTitle,
description: description, description: description,
infoList: infoList, infoList: infoList,
imagesInfo: imagesInfo, imagesInfo: imagesInfo,
) )
: baseViewModel != null : baseViewModel != null
? NetworkBaseView( ? NetworkBaseView(
child: body, child: body,
baseViewModel: baseViewModel, baseViewModel: baseViewModel,
) )
: body, : body,
); );
} }
buildAppLoaderWidget(bool isLoading) { buildAppLoaderWidget(bool isLoading) {
return isLoading ? AppLoaderWidget() : Container(); return isLoading ? AppLoaderWidget() : Container();
} }
} }
class AppBarWidget extends StatelessWidget with PreferredSizeWidget { class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject = final AuthenticatedUserObject authenticatedUserObject =
locator<AuthenticatedUserObject>(); locator<AuthenticatedUserObject>();
final String appBarTitle; final String appBarTitle;
final List<Widget> appBarIcons; final List<Widget> appBarIcons;
final bool isPharmacy; final bool isPharmacy;
final bool isShowDecPage; final bool isShowDecPage;
AppBarWidget({this.appBarTitle, this.appBarIcons, AppBarWidget(
this.isPharmacy = true, this.isShowDecPage = true}); {this.appBarTitle,
this.appBarIcons,
this.isPharmacy = true,
this.isShowDecPage = true});
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -127,10 +130,9 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
return AppBar( return AppBar(
elevation: 0, elevation: 0,
backgroundColor: backgroundColor:
isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
textTheme: TextTheme( textTheme: TextTheme(
headline6: headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
TextStyle(color: Colors.white, fontWeight: FontWeight.bold),
), ),
title: Text( title: Text(
authenticatedUserObject.isLogin || !isShowDecPage authenticatedUserObject.isLogin || !isShowDecPage
@ -139,8 +141,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Colors.white, color: Colors.white,
fontFamily: fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder( leading: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return ArrowBack(); return ArrowBack();
@ -150,27 +151,24 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget {
actions: <Widget>[ actions: <Widget>[
isPharmacy isPharmacy
? IconButton( ? IconButton(
icon: Icon(Icons.shopping_cart), icon: Icon(Icons.shopping_cart),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context).popUntil(ModalRoute.withName('/'));
.popUntil(ModalRoute.withName('/')); })
})
: Container(), : Container(),
IconButton( IconButton(
icon: Icon(FontAwesomeIcons.home), icon: Icon(FontAwesomeIcons.home),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
context, context,
MaterialPageRoute( MaterialPageRoute(builder: (context) => LandingPage()),
builder: (context) => LandingPage()), (Route<dynamic> r) => false);
(Route<dynamic> r) => false);
}, },
), ),
if (appBarIcons != null) ...appBarIcons if (appBarIcons != null) ...appBarIcons
], ],
); );
} }

Loading…
Cancel
Save