From eeb073fb17e167ab909a477e376a27da8e2e4888 Mon Sep 17 00:00:00 2001 From: Sultan Khan Date: Mon, 8 Feb 2021 18:39:09 +0300 Subject: [PATCH] voice command --- lib/widgets/others/app_scaffold_widget.dart | 112 ++++++++++---------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/lib/widgets/others/app_scaffold_widget.dart b/lib/widgets/others/app_scaffold_widget.dart index 3fce4b51..6a242c7d 100644 --- a/lib/widgets/others/app_scaffold_widget.dart +++ b/lib/widgets/others/app_scaffold_widget.dart @@ -13,8 +13,6 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/others/bottom_bar.dart'; import 'package:diplomaticquarterapp/widgets/progress_indicator/app_loader_widget.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_svg/flutter_svg.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -48,74 +46,79 @@ class AppScaffold extends StatelessWidget { final List imagesInfo; AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); AppScaffold( {@required this.body, - this.appBarTitle = '', - this.isLoading = false, - this.isShowAppBar = false, - this.hasAppBarParam, - this.bottomSheet, - this.baseViewModel, - this.floatingActionButton, - this.isPharmacy = false, - this.title, - this.description, - this.isShowDecPage = true, - this.isBottomBar, - this.backgroundColor, - this.preferredSize = 0.0, - this.appBarIcons, - this.infoList, this.imagesInfo}); + this.appBarTitle = '', + this.isLoading = false, + this.isShowAppBar = false, + this.hasAppBarParam, + this.bottomSheet, + this.baseViewModel, + this.floatingActionButton, + this.isPharmacy = false, + this.title, + this.description, + this.isShowDecPage = true, + this.isBottomBar, + this.backgroundColor, + this.preferredSize = 0.0, + this.appBarIcons, + this.infoList, + this.imagesInfo}); @override Widget build(BuildContext context) { AppGlobal.context = context; return Scaffold( backgroundColor: - backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, - appBar: isShowAppBar? AppBarWidget( - appBarTitle:appBarTitle, - appBarIcons:appBarIcons, - isPharmacy: isPharmacy, - isShowDecPage: isShowDecPage, - ):null, + backgroundColor ?? Theme.of(context).scaffoldBackgroundColor, + appBar: isShowAppBar + ? AppBarWidget( + appBarTitle: appBarTitle, + appBarIcons: appBarIcons, + isPharmacy: isPharmacy, + isShowDecPage: isShowDecPage, + ) + : null, bottomSheet: bottomSheet, body: (!Provider.of(context, listen: false).isLogin && - isShowDecPage) + isShowDecPage) ? NotAutPage( - title: title ?? appBarTitle, - description: description, - infoList: infoList, - imagesInfo: imagesInfo, - ) + title: title ?? appBarTitle, + description: description, + infoList: infoList, + imagesInfo: imagesInfo, + ) : baseViewModel != null - ? NetworkBaseView( - child: body, - baseViewModel: baseViewModel, - ) - : body, + ? NetworkBaseView( + child: body, + baseViewModel: baseViewModel, + ) + : body, ); } buildAppLoaderWidget(bool isLoading) { return isLoading ? AppLoaderWidget() : Container(); } - } class AppBarWidget extends StatelessWidget with PreferredSizeWidget { final AuthenticatedUserObject authenticatedUserObject = - locator(); + locator(); final String appBarTitle; final List appBarIcons; final bool isPharmacy; final bool isShowDecPage; - AppBarWidget({this.appBarTitle, this.appBarIcons, - this.isPharmacy = true, this.isShowDecPage = true}); + AppBarWidget( + {this.appBarTitle, + this.appBarIcons, + this.isPharmacy = true, + this.isShowDecPage = true}); @override Widget build(BuildContext context) { @@ -127,10 +130,9 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { return AppBar( elevation: 0, backgroundColor: - isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, + isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color, textTheme: TextTheme( - headline6: - TextStyle(color: Colors.white, fontWeight: FontWeight.bold), + headline6: TextStyle(color: Colors.white, fontWeight: FontWeight.bold), ), title: Text( authenticatedUserObject.isLogin || !isShowDecPage @@ -139,8 +141,7 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { style: TextStyle( fontWeight: FontWeight.bold, color: Colors.white, - fontFamily: - projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), + fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), leading: Builder( builder: (BuildContext context) { return ArrowBack(); @@ -150,27 +151,24 @@ class AppBarWidget extends StatelessWidget with PreferredSizeWidget { actions: [ isPharmacy ? IconButton( - icon: Icon(Icons.shopping_cart), - color: Colors.white, - onPressed: () { - Navigator.of(context) - .popUntil(ModalRoute.withName('/')); - }) + icon: Icon(Icons.shopping_cart), + color: Colors.white, + onPressed: () { + Navigator.of(context).popUntil(ModalRoute.withName('/')); + }) : Container(), - IconButton( + IconButton( icon: Icon(FontAwesomeIcons.home), color: Colors.white, onPressed: () { Navigator.pushAndRemoveUntil( context, - MaterialPageRoute( - builder: (context) => LandingPage()), - (Route r) => false); + MaterialPageRoute(builder: (context) => LandingPage()), + (Route r) => false); }, ), if (appBarIcons != null) ...appBarIcons ], - ); }