video call camera view issue fix, barcode plugin change, smart watches improvements.

merge-requests/575/head
Sikander Saleem 3 years ago
parent caec2c4ca4
commit 628439ddf8

@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/model/qr/qr_parking_model.dart'; import 'package:diplomaticquarterapp/core/model/qr/qr_parking_model.dart';
@ -16,7 +16,7 @@ class QrViewModel extends BaseViewModel {
readQr() async { readQr() async {
//TODO fix the barcode scan //TODO fix the barcode scan
String result = await BarcodeScanner.scan(); String result = (await BarcodeScanner.scan())?.rawContent;
var data = json.decode(result); var data = json.decode(result);
var qRParkingID = data['QRParkingID']; var qRParkingID = data['QRParkingID'];
setState(ViewState.BusyLocal); setState(ViewState.BusyLocal);

@ -34,8 +34,10 @@ class _CamViewWidgetState extends State<CamViewWidget> {
child: Stack( child: Stack(
children: [ children: [
FractionallySizedBox( FractionallySizedBox(
heightFactor: 1, widthFactor: 1, heightFactor: 1,
widthFactor: 1,
child: Container( child: Container(
color: Colors.black87,
child: RTCVideoView(widget.remoteRenderer, mirror: true), child: RTCVideoView(widget.remoteRenderer, mirror: true),
), ),
), ),

@ -339,6 +339,12 @@ class _LandingPageState extends State<LandingPage> with WidgetsBindingObserver {
LandingPage.incomingCallData = IncomingCallData.fromJson(myMap); LandingPage.incomingCallData = IncomingCallData.fromJson(myMap);
if (!isPageNavigated) { if (!isPageNavigated) {
isPageNavigated = true; isPageNavigated = true;
Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) { Navigator.push(context, MaterialPageRoute(builder: (context) => IncomingCall(incomingCallData: LandingPage.incomingCallData))).then((value) {
Future.delayed(Duration(seconds: 5), () { Future.delayed(Duration(seconds: 5), () {
isPageNavigated = false; isPageNavigated = false;

@ -1,4 +1,4 @@
import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart'; import 'package:diplomaticquarterapp/core/service/client/base_app_client.dart';
@ -86,9 +86,9 @@ class _LandingPagePharmacyState extends State<LandingPagePharmacy> {
void _scanQrAndGetProduct() async { void _scanQrAndGetProduct() async {
try { try {
String result = await BarcodeScanner.scan(); ScanResult result = await BarcodeScanner.scan();
try { try {
String barcode = result; String barcode = result?.rawContent;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) { await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) {
print(response); print(response);

@ -348,11 +348,11 @@ class _IncomingCallState extends State<IncomingCall> with SingleTickerProviderSt
// ConferencePage(roomModel: roomModel), // ConferencePage(roomModel: roomModel),
// ), // ),
// ); // );
await _controller.dispose();
await Navigator.of(context).pushReplacement( await Navigator.of(context).pushReplacement(
MaterialPageRoute( MaterialPageRoute(
fullscreenDialog: true, fullscreenDialog: true,
builder: (BuildContext context) => CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID), builder: (BuildContext context) => CallHomePage(receiverId: widget.incomingCallData.receiverID, callerId: widget.incomingCallData.callerID),
), ),
); );
} catch (err) { } catch (err) {

@ -36,40 +36,29 @@ class _HealthDataListState extends State<HealthDataList> {
appBarTitle: TranslationBase.of(context).smartWatches, appBarTitle: TranslationBase.of(context).smartWatches,
isShowAppBar: true, isShowAppBar: true,
showNewAppBar: true, showNewAppBar: true,
backgroundColor: Color(0xffF7F7F7),
showNewAppBarTitle: true, showNewAppBarTitle: true,
body: Container( body: Column(
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Expanded(
width: double.infinity,
height: 20,
),
Padding(
padding: EdgeInsets.only(left: 12, right: 12),
child: GridView.builder( child: GridView.builder(
shrinkWrap: true, physics: BouncingScrollPhysics(),
primary: false,
physics: NeverScrollableScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12), gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 3, childAspectRatio: 2 / 2, crossAxisSpacing: 12, mainAxisSpacing: 12),
padding: EdgeInsets.zero, padding: EdgeInsets.all(21),
itemCount: myMedicalList.length, itemCount: myMedicalList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return myMedicalList[index]; return myMedicalList[index];
}, },
), ),
), ),
syncHealthDataButton(),
], ],
), ),
),
),
bottomSheet: syncHealthDataButton(),
); );
} }
List<Widget> myOptionsList(BuildContext context) { List<Widget> myOptionsList(BuildContext context) {
List<Widget> medical = List(); List<Widget> medical = [];
medical.add(InkWell( medical.add(InkWell(
onTap: () => Navigator.push( onTap: () => Navigator.push(

@ -44,46 +44,48 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
isShowDecPage: true, isShowDecPage: true,
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
backgroundColor: Color(0xffF7F7F7),
description: TranslationBase.of(context).infoHealthData, description: TranslationBase.of(context).infoHealthData,
imagesInfo: [ imagesInfo: [
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'), ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/0.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/0.png'),
ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png') ImagesInfo(imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/health-data/ar/1.png')
], ],
body: Container( body: Column(
children: [
Expanded(
child: Container(
child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(), child: Platform.isIOS ? _getAppleWatchInstructions() : _getGoogleWatchInstructions(),
), ),
bottomSheet: Container( ),
color: Theme.of(context).scaffoldBackgroundColor, DefaultButton(
padding: EdgeInsets.fromLTRB(15.0, 0.0, 15.0, 30.0),
child: DefaultButton(
TranslationBase.of(context).continues, TranslationBase.of(context).continues,
() { () {
_openHealthDataList(); _openHealthDataList();
}, },
color: Color(0xff359846), color: Color(0xff359846),
), ).insideContainer
],
), ),
); );
} }
_getAppleWatchInstructions() { _getAppleWatchInstructions() {
return SingleChildScrollView( return SingleChildScrollView(
child: Column( padding: EdgeInsets.all(21),
crossAxisAlignment: CrossAxisAlignment.start, physics: BouncingScrollPhysics(),
mainAxisSize: MainAxisSize.min,
children: [
Container(
width: double.infinity,
margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Text(
margin: EdgeInsets.only(top: 10.0, bottom: 10.0), TranslationBase.of(context).supportedWatches,
child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
letterSpacing: -1.2,
color: Color(0xff2E303A),
), ),
Container( ),
child: Row( Row(
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
@ -121,7 +123,6 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
), ),
], ],
), ),
),
Container( Container(
margin: EdgeInsets.only(top: 10.0), margin: EdgeInsets.only(top: 10.0),
child: Row( child: Row(
@ -245,27 +246,34 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
], ],
), ),
), ),
Container( SizedBox(height: 12),
margin: EdgeInsets.fromLTRB(10.0, 30.0, 10.0, 10.0), Text(
child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), TranslationBase.of(context).syncInstructionsIntro1,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
), ),
Container(
margin: EdgeInsets.all(10.0),
child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)),
), ),
SizedBox(height: 12),
Text(
TranslationBase.of(context).syncInstructionsIntro2,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
),
),
SizedBox(height: 12),
InkWell( InkWell(
onTap: () { onTap: () {
showInstructionsDialog(); showInstructionsDialog();
}, },
child: Padding(
padding: const EdgeInsets.only(left: 10.0, right: 10.0),
child: Text(TranslationBase.of(context).watchInstructions, child: Text(TranslationBase.of(context).watchInstructions,
style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)), style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)),
), ),
),
],
),
),
], ],
), ),
); );
@ -273,14 +281,19 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
_getGoogleWatchInstructions() { _getGoogleWatchInstructions() {
return SingleChildScrollView( return SingleChildScrollView(
child: Container( padding: EdgeInsets.all(21),
width: double.infinity, physics: BouncingScrollPhysics(),
margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Text(
child: Text(TranslationBase.of(context).supportedWatches, style: TextStyle(fontSize: 22.0, fontWeight: FontWeight.w600)), TranslationBase.of(context).supportedWatches,
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.w600,
letterSpacing: -1.2,
color: Color(0xff2E303A),
),
), ),
Container( Container(
child: Row( child: Row(
@ -421,36 +434,48 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
], ],
), ),
), ),
SizedBox(height: 12),
InkWell( InkWell(
onTap: () { onTap: () {
launch("https://wearos.google.com/#find-your-watch"); launch("https://wearos.google.com/#find-your-watch");
}, },
child: Container( child: Text(
margin: EdgeInsets.only(top: 20.0), TranslationBase.of(context).moreSupportedWatches,
child: Text(TranslationBase.of(context).moreSupportedWatches, style: TextStyle(fontSize: 14.0, color: Colors.blue, decoration: TextDecoration.underline, letterSpacing: -0.36)), style: TextStyle(fontSize: 14.0, color: Colors.blue, fontWeight: FontWeight.w600, decoration: TextDecoration.underline, letterSpacing: -0.56),
), ),
), ),
Container( SizedBox(height: 12),
margin: EdgeInsets.only(top: 10.0, bottom: 10.0), Text(
child: Text(TranslationBase.of(context).syncInstructionsIntro1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), TranslationBase.of(context).syncInstructionsIntro1,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
), ),
Container(
margin: EdgeInsets.only(top: 10.0, bottom: 10.0),
child: Text(TranslationBase.of(context).syncInstructionsIntro2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)),
), ),
SizedBox(height: 12),
Text(
TranslationBase.of(context).syncInstructionsIntro2,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
fontWeight: FontWeight.w600,
color: Color(0xff575757),
),
),
SizedBox(height: 12),
InkWell( InkWell(
onTap: () { onTap: () {
showInstructionsDialog(); showInstructionsDialog();
}, },
child: Padding( child: Text(
padding: const EdgeInsets.only(top: 10.0, bottom: 10.0), TranslationBase.of(context).watchInstructions,
child: Text(TranslationBase.of(context).watchInstructions, style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline),
style: TextStyle(color: CustomColors.accentColor, fontWeight: FontWeight.w600, letterSpacing: -0.64, decoration: TextDecoration.underline)),
), ),
), ),
], ],
), ),
),
); );
} }
@ -470,21 +495,22 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
children: [ children: [
Container( Container(
width: 350.0, width: 350.0,
padding: EdgeInsets.all(21),
color: Colors.white, color: Colors.white,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Row(
width: MediaQuery.of(context).size.width,
padding: EdgeInsets.all(20.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text(TranslationBase.of(context).smartWatches, style: TextStyle(fontSize: 22.0, color: Colors.black, fontWeight: FontWeight.w600, letterSpacing: -0.64)), Text(
TranslationBase.of(context).smartWatches,
style: TextStyle(fontSize: 18.0, color: Color(0xff2E303A), fontWeight: FontWeight.w600, letterSpacing: -1.2),
),
IconButton( IconButton(
icon: Icon( icon: Icon(
Icons.close, Icons.close,
color: Colors.black, color: Color(0xff2E303A),
), ),
onPressed: () { onPressed: () {
Navigator.pop(context); Navigator.pop(context);
@ -492,47 +518,84 @@ class _SmartWatchInstructionsState extends State<SmartWatchInstructions> {
), ),
], ],
), ),
Text(
TranslationBase.of(context).syncInstructionsIntro3,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
), ),
Container(
margin: EdgeInsets.fromLTRB(20.0, 0.0, 20.0, 10.0),
child: Text(TranslationBase.of(context).syncInstructionsIntro3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)),
), ),
SizedBox(height: 12),
Platform.isIOS Platform.isIOS
? Column( ? Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Text(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), TranslationBase.of(context).iosInstructions1,
child: Text(TranslationBase.of(context).iosInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
), ),
Container(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0),
child: Text(TranslationBase.of(context).iosInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)),
), ),
Container( SizedBox(height: 12),
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 21.0), Text(
child: Text(TranslationBase.of(context).iosInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), TranslationBase.of(context).iosInstructions2,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
),
),
SizedBox(height: 12),
Text(
TranslationBase.of(context).iosInstructions3,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
),
), ),
], ],
) )
: Column( : Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container( Text(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), TranslationBase.of(context).androidInstructions1,
child: Text(TranslationBase.of(context).androidInstructions1, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
), ),
Container(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0),
child: Text(TranslationBase.of(context).androidInstructions2, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)),
), ),
Container( SizedBox(height: 12),
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0), Text(
child: Text(TranslationBase.of(context).androidInstructions3, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)), TranslationBase.of(context).androidInstructions2,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
),
),
SizedBox(height: 12),
Text(
TranslationBase.of(context).androidInstructions3,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
),
),
SizedBox(height: 12),
Text(
TranslationBase.of(context).androidInstructions4,
style: TextStyle(
fontSize: 14.0,
letterSpacing: -0.56,
color: Color(0xff575757),
), ),
Container(
margin: EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 10.0),
child: Text(TranslationBase.of(context).androidInstructions4, style: TextStyle(fontSize: 14.0, letterSpacing: -0.36)),
), ),
], ],
), ),

@ -11,13 +11,7 @@ import 'package:flutter/material.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class syncHealthDataButton extends StatefulWidget { class syncHealthDataButton extends StatefulWidget {
double marginTop; syncHealthDataButton();
double hight;
double minWidth;
syncHealthDataButton({this.marginTop, this.hight, this.minWidth});
@override @override
_syncHealthDataButtonState createState() => _syncHealthDataButtonState(); _syncHealthDataButtonState createState() => _syncHealthDataButtonState();
@ -50,16 +44,7 @@ class _syncHealthDataButtonState extends State<syncHealthDataButton> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( return DefaultButton(TranslationBase.of(context).syncHealthData, () => readAll()).insideContainer;
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(20.0),
child: DefaultButton(TranslationBase.of(context).syncHealthData, () {
print("ReadAll");
readAll();
}),
),
);
} }
void readAll() async { void readAll() async {

@ -1,6 +1,6 @@
import 'dart:convert'; import 'dart:convert';
import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:diplomaticquarterapp/core/enum/viewstate.dart'; import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacy_categorise_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
@ -277,7 +277,7 @@ class _PharmacyCategorisePageState extends State<PharmacyCategorisePage> {
/// When give qr we will change this method to get data /// When give qr we will change this method to get data
/// var result = await BarcodeScanner.scan(); /// var result = await BarcodeScanner.scan();
/// int patientID = get from qr result /// int patientID = get from qr result
String result = await BarcodeScanner.scan(); String result = (await BarcodeScanner.scan())?.rawContent;
var data = json.decode(result); var data = json.decode(result);
if (data != null) { if (data != null) {
var qRParkingID = data['QRParkingID']; var qRParkingID = data['QRParkingID'];

@ -1,20 +1,9 @@
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_flexible_toast/flutter_flexible_toast.dart'; import 'package:fluttertoast/fluttertoast.dart';
class AppToast { class AppToast {
/// show long toast message
/// [message] to show for user
/// [timeInSeconds] how many second the toast will appear to the user
/// [toastLength] the time we show the message but should be Toast.LENGTH_SHORT , Toast.LENGTH_LONG
/// [toastGravity] the position of the toast in the screen
/// [backgroundColor] the background color of the toast
/// [textColor] the text color of the toast
/// [icon] the icon you want include in the toast
/// [radius] the radius of the toast
/// [elevation] an overlay color will be applied to indicate elevation.
/// [imageSize] image size inside the toast
static void showToast({ static void showToast({
@required String message, @required String message,
Toast toastLength, Toast toastLength,
@ -23,34 +12,14 @@ class AppToast {
ToastGravity toastGravity, ToastGravity toastGravity,
Color backgroundColor, Color backgroundColor,
Color textColor, Color textColor,
ICON icon,
int radius, int radius,
int elevation, int elevation,
int imageSize, int imageSize,
}) { }) {
FlutterFlexibleToast.showToast( Fluttertoast.showToast(
message: message, msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: backgroundColor, textColor: textColor, fontSize: fontSize);
toastLength: toastLength,
timeInSeconds: timeInSeconds,
fontSize: fontSize,
toastGravity: toastGravity,
backgroundColor: backgroundColor,
textColor: textColor,
icon: icon,
radius: radius,
elevation: elevation,
imageSize: imageSize);
} }
/// show Success toast message
/// [message] to show for user
/// [timeInSeconds] how many second the toast will appear to the user
/// [toastLength] the time we show the message but should be Toast.LENGTH_SHORT , Toast.LENGTH_LONG
/// [toastGravity] the position of the toast in the screen
/// [textColor] the text color of the toast
/// [radius] the radius of the toast
/// [elevation] an overlay color will be applied to indicate elevation.
/// [imageSize] image size inside the toast
static void showSuccessToast({ static void showSuccessToast({
@required String message, @required String message,
Toast toastLength = Toast.LENGTH_LONG, Toast toastLength = Toast.LENGTH_LONG,
@ -62,29 +31,9 @@ class AppToast {
int elevation, int elevation,
int imageSize = 32, int imageSize = 32,
}) { }) {
FlutterFlexibleToast.showToast( Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.green, textColor: textColor, fontSize: fontSize);
message: message,
toastLength: toastLength,
timeInSeconds: timeInSeconds = 2,
fontSize: fontSize,
toastGravity: toastGravity,
backgroundColor: Colors.green,
textColor: textColor,
icon: ICON.SUCCESS,
radius: radius,
elevation: elevation,
imageSize: imageSize);
} }
/// show Error toast message
/// [message] to show for user
/// [timeInSeconds] how many second the toast will appear to the user
/// [toastLength] the time we show the message but should be Toast.LENGTH_SHORT , Toast.LENGTH_LONG
/// [toastGravity] the position of the toast in the screen
/// [textColor] the text color of the toast
/// [radius] the radius of the toast
/// [elevation] an overlay color will be applied to indicate elevation.
/// [imageSize] image size inside the toast
static void showErrorToast({ static void showErrorToast({
@required String message, @required String message,
Toast toastLength = Toast.LENGTH_LONG, Toast toastLength = Toast.LENGTH_LONG,
@ -96,30 +45,15 @@ class AppToast {
int elevation, int elevation,
int imageSize = 32, int imageSize = 32,
}) { }) {
FlutterFlexibleToast.showToast( Fluttertoast.showToast(msg: message, toastLength: toastLength, gravity: toastGravity, timeInSecForIosWeb: timeInSeconds, backgroundColor: Colors.red, textColor: textColor, fontSize: fontSize);
message: message,
toastLength: toastLength,
timeInSeconds: timeInSeconds,
fontSize: fontSize,
toastGravity: toastGravity,
backgroundColor: Colors.red,
textColor: textColor,
icon: ICON.CLOSE,
radius: radius,
elevation: elevation,
imageSize: imageSize
);
} }
/// cancel toast
void cancelToast() { void cancelToast() {
FlutterFlexibleToast.cancel(); Fluttertoast.cancel();
} }
void backWithEmpty() { void backWithEmpty() {
AppToast.showErrorToast( AppToast.showErrorToast(message: TranslationBase.of(AppGlobal.context).empty);
message: TranslationBase.of(AppGlobal.context).empty);
Navigator.of(AppGlobal.context).pop(); Navigator.of(AppGlobal.context).pop();
} }

@ -1,6 +1,6 @@
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:barcode_scan_fix/barcode_scan.dart'; import 'package:barcode_scan2/barcode_scan2.dart';
import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/config/config.dart';
import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart'; import 'package:diplomaticquarterapp/core/model/ImagesInfo.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart'; import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
@ -135,8 +135,7 @@ class AppScaffold extends StatefulWidget {
} }
class _AppScaffoldState extends State<AppScaffold> { class _AppScaffoldState extends State<AppScaffold> {
AuthenticatedUserObject authenticatedUserObject = AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
AppBarWidget appBar; AppBarWidget appBar;
@override @override
@ -185,8 +184,7 @@ class _AppScaffoldState extends State<AppScaffold> {
builder: (BuildContext context) { builder: (BuildContext context) {
return InkWell( return InkWell(
onTap: () { onTap: () {
Provider.of<PharmacyPagesViewModel>(context, listen: false) Provider.of<PharmacyPagesViewModel>(context, listen: false).changeCurrentTab(0);
.changeCurrentTab(0);
}, },
child: Container( child: Container(
height: 2.0, height: 2.0,
@ -216,12 +214,9 @@ class _AppScaffoldState extends State<AppScaffold> {
AppGlobal.context = context; AppGlobal.context = context;
PharmacyPagesViewModel pagesViewModel = Provider.of(context); PharmacyPagesViewModel pagesViewModel = Provider.of(context);
bool isUserNotLogin = bool isUserNotLogin = (!Provider.of<ProjectViewModel>(context, listen: false).isLogin && widget.isShowDecPage);
(!Provider.of<ProjectViewModel>(context, listen: false).isLogin &&
widget.isShowDecPage);
return Scaffold( return Scaffold(
backgroundColor: backgroundColor: widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
widget.backgroundColor ?? CustomColors.appBackgroudGrey2Color,
// appBar: widget.isShowPharmacyAppbar // appBar: widget.isShowPharmacyAppbar
// ? pharmacyAppbar() // ? pharmacyAppbar()
@ -254,8 +249,7 @@ class _AppScaffoldState extends State<AppScaffold> {
isPharmacy: widget.isPharmacy, isPharmacy: widget.isPharmacy,
showPharmacyCart: widget.showPharmacyCart, showPharmacyCart: widget.showPharmacyCart,
isOfferPackages: widget.isOfferPackages, isOfferPackages: widget.isOfferPackages,
showOfferPackagesCart: showOfferPackagesCart: widget.showOfferPackagesCart,
widget.showOfferPackagesCart,
isShowDecPage: widget.isShowDecPage, isShowDecPage: widget.isShowDecPage,
backButtonTab: widget.backButtonTab, backButtonTab: widget.backButtonTab,
) )
@ -294,22 +288,17 @@ class _AppScaffoldState extends State<AppScaffold> {
widget.changeCurrentTab(value); widget.changeCurrentTab(value);
} else { } else {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(
locator<NavigationService>().navigatorKey.currentContext, locator<NavigationService>().navigatorKey.currentContext, MaterialPageRoute(builder: (context) => LandingPagePharmacy(currentTab: value)), (Route<dynamic> r) => false);
MaterialPageRoute(
builder: (context) => LandingPagePharmacy(currentTab: value)),
(Route<dynamic> r) => false);
} }
} }
void _scanQrAndGetProduct() async { void _scanQrAndGetProduct() async {
try { try {
String result = await BarcodeScanner.scan(); String result = (await BarcodeScanner.scan())?.rawContent;
try { try {
String barcode = result; String barcode = result;
GifLoaderDialogUtils.showMyDialog(context); GifLoaderDialogUtils.showMyDialog(context);
await BaseAppClient() await BaseAppClient().getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode", onSuccess: (dynamic response, int statusCode) {
.getPharmacy("$GET_PHARMACY_PRODUCTs_BY_SKU$barcode",
onSuccess: (dynamic response, int statusCode) {
print(response); print(response);
var product = PharmacyProduct.fromJson(response["products"][0]); var product = PharmacyProduct.fromJson(response["products"][0]);
GifLoaderDialogUtils.hideDialog(context); GifLoaderDialogUtils.hideDialog(context);
@ -319,8 +308,7 @@ class _AppScaffoldState extends State<AppScaffold> {
AppToast.showErrorToast(message: "Product not found"); AppToast.showErrorToast(message: "Product not found");
}); });
} catch (apiEx) { } catch (apiEx) {
AppToast.showErrorToast( AppToast.showErrorToast(message: "Something went wrong, please try again");
message: "Something went wrong, please try again");
} }
} catch (barcodeEx) {} } catch (barcodeEx) {}
} }
@ -330,10 +318,7 @@ class _AppScaffoldState extends State<AppScaffold> {
} }
buildBodyWidget(context) { buildBodyWidget(context) {
return Stack(children: <Widget>[ return Stack(children: <Widget>[widget.body, widget.isHelp == true ? RobotIcon() : Container()]);
widget.body,
widget.isHelp == true ? RobotIcon() : Container()
]);
} }
} }
@ -347,16 +332,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
final List<Widget> appBarIcons; final List<Widget> appBarIcons;
Function onTap; Function onTap;
NewAppBarWidget( NewAppBarWidget({Key key, this.showTitle = false, this.showDropDown = false, this.title = "", this.dropDownList, this.appBarIcons, this.dropdownIndexValue, this.dropDownIndexChange, this.onTap})
{Key key,
this.showTitle = false,
this.showDropDown = false,
this.title = "",
this.dropDownList,
this.appBarIcons,
this.dropdownIndexValue,
this.dropDownIndexChange,
this.onTap})
: super(key: key); : super(key: key);
@override @override
@ -381,13 +357,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
title, title,
maxLines: 1, maxLines: 1,
style: TextStyle( style: TextStyle(
fontSize: 24, fontSize: 24, fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'), fontWeight: FontWeight.w700, color: Color(0xff2B353E), letterSpacing: -1.44, height: 35 / 24),
fontFamily:
(projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
fontWeight: FontWeight.w700,
color: Color(0xff2B353E),
letterSpacing: -1.44,
height: 35 / 24),
), ),
), ),
if (showDropDown) if (showDropDown)
@ -399,8 +369,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
alignedDropdown: true, alignedDropdown: true,
child: DropdownButton<int>( child: DropdownButton<int>(
iconEnabledColor: CustomColors.grey2, iconEnabledColor: CustomColors.grey2,
style: TextStyle( style: TextStyle(color: CustomColors.lightGreyColor, fontSize: 12),
color: CustomColors.lightGreyColor, fontSize: 12),
dropdownColor: CustomColors.lightGreyColor, dropdownColor: CustomColors.lightGreyColor,
value: dropdownIndexValue, value: dropdownIndexValue,
items: [ items: [
@ -411,9 +380,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
dropDownList[i], dropDownList[i],
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontFamily: (projectViewModel.isArabic fontFamily: (projectViewModel.isArabic ? 'Cairo' : 'Poppins'),
? 'Cairo'
: 'Poppins'),
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Color(0xff2B2E31), color: Color(0xff2B2E31),
letterSpacing: -.48, letterSpacing: -.48,
@ -455,8 +422,7 @@ class NewAppBarWidget extends StatelessWidget with PreferredSizeWidget {
} }
class AppBarWidget extends StatefulWidget with PreferredSizeWidget { class AppBarWidget extends StatefulWidget with PreferredSizeWidget {
final AuthenticatedUserObject authenticatedUserObject = final AuthenticatedUserObject authenticatedUserObject = locator<AuthenticatedUserObject>();
locator<AuthenticatedUserObject>();
final String appBarTitle; final String appBarTitle;
final bool showHomeAppBarIcon; final bool showHomeAppBarIcon;
@ -509,22 +475,12 @@ class AppBarWidgetState extends State<AppBarWidget> {
return AppBar( return AppBar(
elevation: 0, elevation: 0,
backgroundColor: widget.isPharmacy backgroundColor: widget.isPharmacy ? Colors.green : Theme.of(context).appBarTheme.color,
? Colors.green
: Theme.of(context).appBarTheme.color,
textTheme: TextTheme( textTheme: TextTheme(
headline6: TextStyle( headline6: TextStyle(color: Theme.of(context).textTheme.headline1.color, fontWeight: FontWeight.bold),
color: Theme.of(context).textTheme.headline1.color,
fontWeight: FontWeight.bold),
), ),
title: Text( title: Text(widget.authenticatedUserObject.isLogin || !widget.isShowDecPage ? widget.appBarTitle.toUpperCase() : TranslationBase.of(context).serviceInformationTitle,
widget.authenticatedUserObject.isLogin || !widget.isShowDecPage style: TextStyle(fontWeight: FontWeight.bold, color: Theme.of(context).textTheme.headline1.color, fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
? widget.appBarTitle.toUpperCase()
: TranslationBase.of(context).serviceInformationTitle,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Theme.of(context).textTheme.headline1.color,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')),
leading: Builder( leading: Builder(
builder: (BuildContext context) { builder: (BuildContext context) {
return ArrowBack( return ArrowBack(
@ -538,8 +494,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
? IconButton( ? IconButton(
icon: Badge( icon: Badge(
badgeContent: Text( badgeContent: Text(
orderPreviewViewModel.cartResponse.quantityCount orderPreviewViewModel.cartResponse.quantityCount.toString(),
.toString(),
style: TextStyle(color: Colors.white), style: TextStyle(color: Colors.white),
), ),
child: Icon(Icons.shopping_cart)), child: Icon(Icons.shopping_cart)),
@ -554,10 +509,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
position: BadgePosition.topStart(top: -15, start: -10), position: BadgePosition.topStart(top: -15, start: -10),
badgeContent: Text( badgeContent: Text(
_badgeText, _badgeText,
style: TextStyle( style: TextStyle(fontSize: 9, color: Colors.white, fontWeight: FontWeight.normal),
fontSize: 9,
color: Colors.white,
fontWeight: FontWeight.normal),
), ),
child: Icon(Icons.shopping_cart)), child: Icon(Icons.shopping_cart)),
color: Colors.white, color: Colors.white,
@ -571,10 +523,7 @@ class AppBarWidgetState extends State<AppBarWidget> {
icon: Icon(FontAwesomeIcons.home), icon: Icon(FontAwesomeIcons.home),
color: Colors.white, color: Colors.white,
onPressed: () { onPressed: () {
Navigator.pushAndRemoveUntil( Navigator.pushAndRemoveUntil(context, MaterialPageRoute(builder: (context) => LandingPage()), (Route<dynamic> r) => false);
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> r) => false);
// Cart Click Event // Cart Click Event
if (_onCartClick != null) _onCartClick(); if (_onCartClick != null) _onCartClick();

@ -53,7 +53,8 @@ dependencies:
maps_launcher: ^2.0.1 maps_launcher: ^2.0.1
url_launcher: ^6.0.15 url_launcher: ^6.0.15
shared_preferences: ^2.0.9 shared_preferences: ^2.0.9
flutter_flexible_toast: ^0.1.4 # flutter_flexible_toast: ^0.1.4
fluttertoast: ^8.0.8
firebase_messaging: ^11.1.0 firebase_messaging: ^11.1.0
firebase_analytics: ^8.3.4 firebase_analytics: ^8.3.4
# Progress bar # Progress bar
@ -91,7 +92,8 @@ dependencies:
flutter_polyline_points: ^1.0.0 flutter_polyline_points: ^1.0.0
location: ^4.3.0 location: ^4.3.0
# Qr code Scanner # Qr code Scanner
barcode_scan_fix: ^1.0.2 # barcode_scan_fix: ^1.0.2
barcode_scan2: ^4.1.4
# Rating Stars # Rating Stars
rating_bar: ^0.2.0 rating_bar: ^0.2.0
@ -134,7 +136,7 @@ dependencies:
jiffy: ^4.1.0 jiffy: ^4.1.0
#Flutter WebRTC #Flutter WebRTC
flutter_webrtc: ^0.7.1 flutter_webrtc: ^0.8.0
screen: ^0.0.5 screen: ^0.0.5

Loading…
Cancel
Save