Bug Fixes

merge-requests/426/merge
Mirza.Shafique 5 years ago
parent cbb9151b62
commit 06c5ee269b

@ -0,0 +1,53 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="612px" height="612px" viewBox="0 0 612 612" style="enable-background:new 0 0 612 612;" xml:space="preserve">
<g>
<g id="_x32__22_">
<g>
<path d="M535.5,0h-459C34.253,0,0,34.253,0,76.5v459C0,577.747,34.253,612,76.5,612h459c42.247,0,76.5-34.253,76.5-76.5v-459
C612,34.253,577.747,0,535.5,0z M229.5,459c10.557,0,19.125,8.568,19.125,19.125s-8.568,19.125-19.125,19.125h-95.089
c-5.355,0-10.156-2.219-13.617-5.757c-3.71-3.137-6.043-7.707-6.043-13.368V382.5c0-10.557,8.568-19.125,19.125-19.125
S153,371.943,153,382.5l-0.421,49.075l91.379-91.38l27.043,27.043L179.239,459H229.5z M243.958,271.824l-91.379-91.398L153,229.5
c0,10.557-8.568,19.125-19.125,19.125s-19.125-8.568-19.125-19.125v-95.625c0-5.661,2.333-10.232,6.043-13.388
c3.461-3.519,8.281-5.737,13.617-5.737H229.5c10.557,0,19.125,8.568,19.125,19.125S240.057,153,229.5,153h-50.261l91.781,91.781
L243.958,271.824z M497.25,478.125c0,5.661-2.333,10.231-6.044,13.388c-3.461,3.538-8.28,5.737-13.616,5.737H382.5
c-10.557,0-19.125-8.568-19.125-19.125S371.943,459,382.5,459h50.261l-91.781-91.781l27.043-27.042l91.379,91.379L459,382.5
c0-10.557,8.568-19.125,19.125-19.125s19.125,8.568,19.125,19.125V478.125z M497.25,229.5c0,10.557-8.568,19.125-19.125,19.125
S459,240.057,459,229.5l0.421-49.075l-91.38,91.379l-27.042-27.043L432.761,153H382.5c-10.557,0-19.125-8.568-19.125-19.125
s8.568-19.125,19.125-19.125h95.09c5.336,0,10.155,2.219,13.616,5.757c3.711,3.136,6.044,7.707,6.044,13.368V229.5z"/>
</g>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.0 KiB

@ -14,6 +14,7 @@ import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:diplomaticquarterapp/widgets/photo_view_page.dart'; import 'package:diplomaticquarterapp/widgets/photo_view_page.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'new_cmc_step_tow_page.dart'; import 'new_cmc_step_tow_page.dart';
@ -124,10 +125,8 @@ class _NewCMCStepOnePageState extends State<NewCMCStepOnePage> {
), ),
margin: EdgeInsets.all(12), margin: EdgeInsets.all(12),
child: IconButton( child: IconButton(
icon: Icon( icon: SvgPicture.asset("assets/images/new/ic_zoom.svg",color: Colors.white,),
Icons.view_carousel_rounded, padding: EdgeInsets.all(12),
color: Colors.white,
),
onPressed: () { onPressed: () {
showDraggableDialog(context, PhotoViewPage(projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png")); showDraggableDialog(context, PhotoViewPage(projectViewModel.isArabic ? "assets/images/cc_ar.png" : "assets/images/cc_en.png"));
}, },

@ -145,6 +145,7 @@ class CovidDirveThruQuestionsState extends State<CovidDirveThruQuestions> {
itemBuilder: (ctx, idx) { itemBuilder: (ctx, idx) {
var obj = qa[idx]; var obj = qa[idx];
var qtext = isArabic ? obj["questionAR"] : obj["questionEN"]; var qtext = isArabic ? obj["questionAR"] : obj["questionEN"];
print("dddddddddddddd " + obj["ans"].toString());
return Padding( return Padding(
padding: const EdgeInsets.symmetric(vertical: 10), padding: const EdgeInsets.symmetric(vertical: 10),
@ -170,6 +171,7 @@ class CovidDirveThruQuestionsState extends State<CovidDirveThruQuestions> {
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
obj["ans"] = newValue; obj["ans"] = newValue;
checkAllChecked();
}); });
}), }),
Text( Text(
@ -192,6 +194,7 @@ class CovidDirveThruQuestionsState extends State<CovidDirveThruQuestions> {
onChanged: (newValue) { onChanged: (newValue) {
setState(() { setState(() {
obj["ans"] = newValue; obj["ans"] = newValue;
checkAllChecked();
}); });
}), }),
Text( Text(
@ -228,7 +231,7 @@ class CovidDirveThruQuestionsState extends State<CovidDirveThruQuestions> {
child: MaterialButton( child: MaterialButton(
height: 50, height: 50,
elevation: 0, elevation: 0,
color: CustomColors.accentColor, color: all2 ? CustomColors.accentColor : CustomColors.grey,
disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25), disabledColor: Theme.of(context).appBarTheme.color.withOpacity(0.25),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)),
child: Text( child: Text(
@ -249,6 +252,17 @@ class CovidDirveThruQuestionsState extends State<CovidDirveThruQuestions> {
)); ));
} }
bool all2 = false;
checkAllChecked() {
all2 = true;
qa.forEach((element) {
if (element["ans"] == 2 || element["ans"] == null) {
all2 = false;
}
});
}
next() async { next() async {
bool all = true; bool all = true;
qa.forEach((element) { qa.forEach((element) {

@ -117,6 +117,7 @@ class _CovidPaymentDetailsState extends State<CovidPaymentDetails> {
onTap: () { onTap: () {
setState(() { setState(() {
widget.selectedProcedure = widget.proceduresList[index]; widget.selectedProcedure = widget.proceduresList[index];
getPaymentInfo(context, widget.projectID.toString(), widget.selectedProcedure.procedureID);
}); });
}, },
child: ListTile( child: ListTile(

@ -4,6 +4,7 @@ import 'package:diplomaticquarterapp/models/Appointments/PatientShareResposne.da
import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart'; import 'package:diplomaticquarterapp/models/Authentication/authenticated_user.dart';
import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/QRCode.dart';
import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart'; import 'package:diplomaticquarterapp/pages/ToDoList/payment_method_select.dart';
import 'package:diplomaticquarterapp/pages/landing/landing_page.dart';
import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart'; import 'package:diplomaticquarterapp/services/appointment_services/GetDoctorsList.dart';
import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart';
@ -251,7 +252,16 @@ class _CovidPaymentSummaryState extends State<CovidPaymentSummary> {
onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) { onBrowserExit(AppoitmentAllHistoryResultList appo, bool isPaymentMade) {
print("onBrowserExit Called!!!!"); print("onBrowserExit Called!!!!");
if (isPaymentMade) checkPaymentStatus(appo); if (isPaymentMade) {
checkPaymentStatus(appo);
} else {
print("onBrowserExit Payment Not made");
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (context) => LandingPage()),
(Route<dynamic> route) => false,
);
}
} }
checkPaymentStatus(AppoitmentAllHistoryResultList appo) { checkPaymentStatus(AppoitmentAllHistoryResultList appo) {

@ -137,19 +137,20 @@ class LoggedSliderView extends StatelessWidget {
padding: const EdgeInsets.only(left: 20, right: 20), padding: const EdgeInsets.only(left: 20, right: 20),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( flex: 3, Expanded(
flex: 3,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
'assets/images/new/height.svg', 'assets/images/new/height.svg',
width: 12, width: 11,
height: 12, height: 11,
), ),
mWidth(6), mWidth(6),
Texts( Texts(
"${TranslationBase.of(context).height}: ${model.heightCm} ${TranslationBase.of(context).cm}", "${TranslationBase.of(context).height}: ${model.heightCm} ${TranslationBase.of(context).cm}",
color: Colors.white, color: Colors.white,
fontSize: 10, fontSize: 8,
) )
], ],
), ),
@ -157,16 +158,21 @@ class LoggedSliderView extends StatelessWidget {
SizedBox( SizedBox(
width: 3, width: 3,
), ),
Expanded( flex: 3, Expanded(
flex: 3,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
'assets/images/new/weight.svg', 'assets/images/new/weight.svg',
width: 12, width: 11,
height: 12, height: 11,
), ),
mWidth(6), mWidth(6),
Texts('${TranslationBase.of(context).weight}: ${model.weightKg} ${TranslationBase.of(context).kg}', color: Colors.white, fontSize: 10) Texts(
'${TranslationBase.of(context).weight}: ${model.weightKg} ${TranslationBase.of(context).kg}',
color: Colors.white,
fontSize: 8,
)
], ],
), ),
), ),
@ -179,11 +185,15 @@ class LoggedSliderView extends StatelessWidget {
children: <Widget>[ children: <Widget>[
SvgPicture.asset( SvgPicture.asset(
'assets/images/new/blood.svg', 'assets/images/new/blood.svg',
width: 12, width: 11,
height: 12, height: 11,
), ),
mWidth(6), mWidth(6),
Texts('${TranslationBase.of(context).bloodType1} ${model.booldType}', color: Colors.white, fontSize: 10) Texts(
'${TranslationBase.of(context).bloodType1} ${model.booldType}',
color: Colors.white,
fontSize: 8,
)
], ],
), ),
), ),

@ -2,6 +2,7 @@ import 'package:diplomaticquarterapp/core/enum/viewstate.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/TabBarWidget.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/app_toast.dart'; import 'package:diplomaticquarterapp/uitl/app_toast.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
@ -49,6 +50,7 @@ class _WeightHomePageState extends State<WeightHomePage> with SingleTickerProvid
showNewAppBar: true, showNewAppBar: true,
showNewAppBarTitle: true, showNewAppBarTitle: true,
appBarTitle: TranslationBase.of(context).weight, appBarTitle: TranslationBase.of(context).weight,
backgroundColor: CustomColors.appBackgroudGrey2Color,
appBarIcons: [ appBarIcons: [
IconButton( IconButton(
icon: Icon(Icons.email), icon: Icon(Icons.email),
@ -106,35 +108,22 @@ class _WeightHomePageState extends State<WeightHomePage> with SingleTickerProvid
) )
], ],
), ),
floatingActionButton: Stack( floatingActionButton: FloatingActionButton(
children: [ child: Icon(
Positioned( Icons.add,
bottom: 80, color: Colors.white,
right: projectViewModel.isArabic ? MediaQuery.of(context).size.width * .85 : 0, ),
child: InkWell( backgroundColor: CustomColors.accentColor,
onTap: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: AddWeightPage( page: AddWeightPage(
model: model, model: model,
))); ),
}, ),
child: Container( );
width: 55, },
height: 55,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryColor,
),
child: Center(
child: Icon(
Icons.add,
color: Colors.white,
),
),
)))
],
), ),
), ),
), ),

@ -2,9 +2,11 @@ import "package:collection/collection.dart";
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/MonthLineChartCurved.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -20,62 +22,74 @@ class WeightMonthlyPage extends StatelessWidget {
this.model, this.model,
}) : super(key: key); }) : super(key: key);
List<List> monthlyGroup = []; List<List> monthlyGroup = [];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context); ProjectViewModel projectViewModel = Provider.of(context);
groupData(); groupData();
return AppScaffold( return AppScaffold(
isShowDecPage: false, isShowDecPage: false,
backgroundColor: CustomColors.appBackgroudGrey2Color,
body: ListView( body: ListView(
children: [ children: [
Container( Card(
width: double.maxFinite, shape: cardRadius(12),
color: Colors.white, elevation: 1,
child: MonthLineChartCurved( margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
horizontalInterval: 1.0, child: MonthLineChartCurved(
title: TranslationBase.of(context).weight, horizontalInterval: 1.0,
timeSeries: model.weighMonthTimeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesData, title: TranslationBase.of(context).weight,
indexes: model.weighMonthTimeSeriesData.length ~/ 5.5, timeSeries: model.weighMonthTimeSeriesData.isEmpty ? [TimeSeriesSales3(0, 0.0)] : model.weighMonthTimeSeriesData,
)), indexes: model.weighMonthTimeSeriesData.length ~/ 5.5,
SizedBox( ),
height: 12,
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Texts(TranslationBase.of(context).details),
), ),
Container( Card(
padding: EdgeInsets.all(10), shape: cardRadius(12),
color: Colors.transparent, elevation: 1,
margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: [
model.weighMonthTimeSeriesData.isEmpty Padding(
? Container( padding: const EdgeInsets.all(8.0),
child: Center( child: Texts(TranslationBase.of(context).details),
child: Texts(TranslationBase.of(context).noDataAvailable), ),
), Container(
) padding: EdgeInsets.all(10),
: Column(children: [ color: Colors.transparent,
for (var monthly in monthlyGroup) child: Column(
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [ crossAxisAlignment: CrossAxisAlignment.start,
Container( children: <Widget>[
width: double.maxFinite, model.weighMonthTimeSeriesData.isEmpty
padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5), ? Container(
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)), child: Center(
child: Texts(monthly[0])), child: Texts(TranslationBase.of(context).noDataAvailable),
Table( ),
columnWidths: {
0: FlexColumnWidth(2.5),
// 2: FlexColumnWidth(1.8),
},
children: fullData(context, projectViewModel, monthly[1]),
) )
]) : Column(children: [
]) for (var monthly in monthlyGroup)
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: double.maxFinite,
padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: Texts(monthly[0])),
Table(
columnWidths: {
0: FlexColumnWidth(2.5),
// 2: FlexColumnWidth(1.8),
},
children: fullData(context, projectViewModel, monthly[1]),
)
])
])
],
),
)
], ],
), ),
) ),
mHeight(80),
], ],
), ),
); );

@ -1,9 +1,11 @@
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -25,46 +27,64 @@ class WeightWeeklyPage extends StatelessWidget {
return AppScaffold( return AppScaffold(
isShowDecPage: false, isShowDecPage: false,
backgroundColor: CustomColors.appBackgroudGrey2Color,
body: ListView( body: ListView(
children: [ children: [
Container( // Container(
margin: EdgeInsets.only(top: 12, left: 8, right: 8), // margin: EdgeInsets.only(top: 12, left: 8, right: 8),
color: Colors.white, // color: Colors.white,
// child: LineChartCurved(
// horizontalInterval: 1.0,
// title: TranslationBase.of(context).weight,
// timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData,
// indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0,
// ),
// ),
Card(
shape: cardRadius(12),
elevation: 1,
margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: LineChartCurved( child: LineChartCurved(
horizontalInterval: 1.0,
title: TranslationBase.of(context).weight, title: TranslationBase.of(context).weight,
timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData, timeSeries: model.weightWeekTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightWeekTimeSeriesData,
indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0, indexes: model.weightWeekTimeSeriesData.length ~/ 5.5 ?? 0,
), ),
), ),
SizedBox( Card(
height: 12, shape: cardRadius(12),
), elevation: 1,
Padding( margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
padding: const EdgeInsets.all(8.0), child: Column(crossAxisAlignment: CrossAxisAlignment.start,
child: Texts(TranslationBase.of(context).details), children: [
), Padding(
Container( padding: const EdgeInsets.all(8.0),
padding: EdgeInsets.all(10), child: Texts(TranslationBase.of(context).details),
color: Colors.transparent, ),
child: Column( Container(
crossAxisAlignment: CrossAxisAlignment.start, padding: EdgeInsets.all(10),
children: <Widget>[ color: Colors.transparent,
model.weightWeekTimeSeriesData.isEmpty child: Column(
? Container( crossAxisAlignment: CrossAxisAlignment.start,
child: Center( children: <Widget>[
child: Texts(TranslationBase.of(context).noDataAvailable), model.weightWeekTimeSeriesData.isEmpty
), ? Container(
) child: Center(
: Table( child: Texts(TranslationBase.of(context).noDataAvailable),
columnWidths: { ),
0: FlexColumnWidth(2.5), )
}, : Table(
children: fullData(context, projectViewModel, model), columnWidths: {
), 0: FlexColumnWidth(2.5),
},
children: fullData(context, projectViewModel, model),
),
],
),
)
], ],
), ),
) ),
mHeight(80),
], ],
), ),
); );

@ -2,9 +2,11 @@ import "package:collection/collection.dart";
import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/weight_pressure_view_model.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart'; import 'package:diplomaticquarterapp/pages/medical/my_trackers/widget/LineChartCurved.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/date_uitl.dart'; import 'package:diplomaticquarterapp/uitl/date_uitl.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils.dart'; import 'package:diplomaticquarterapp/uitl/utils.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart'; import 'package:diplomaticquarterapp/widgets/charts/app_time_series_chart.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
@ -26,55 +28,63 @@ class WeightYearPage extends StatelessWidget {
groupData(); groupData();
return AppScaffold( return AppScaffold(
isShowDecPage: false, isShowDecPage: false,
backgroundColor: CustomColors.appBackgroudGrey2Color,
body: ListView( body: ListView(
children: [ children: [
Container( Card(
width: double.maxFinite, shape: cardRadius(12),
color: Colors.white, elevation: 1,
margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: LineChartCurved( child: LineChartCurved(
horizontalInterval: 2.0, horizontalInterval: 2.0,
title: TranslationBase.of(context).weight, title: TranslationBase.of(context).weight,
timeSeries: model.weightYearTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesData, timeSeries: model.weightYearTimeSeriesData.isEmpty ? [TimeSeriesSales2(DateTime.now(), 0.0)] : model.weightYearTimeSeriesData,
indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "", indexes: model.weightYearTimeSeriesData.length ~/ 5.5 ?? "",
)), )),
SizedBox(
height: 12, Card(
), shape: cardRadius(12),
Padding( elevation: 1,
padding: const EdgeInsets.all(8.0), margin: EdgeInsets.only(left: 16, top: 16, right: 16, bottom: 8),
child: Texts(TranslationBase.of(context).details),
),
Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,children: [ Padding(
children: <Widget>[ padding: const EdgeInsets.all(8.0),
model.weightYearTimeSeriesData.isEmpty child: Texts(TranslationBase.of(context).details),
? Container(
child: Center(
child: Texts(TranslationBase.of(context).noDataAvailable),
),
)
: Column(children: [
for (var monthly in monthlyGroup)
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: double.maxFinite,
padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: Texts(monthly[0])),
Table(
columnWidths: {
0: FlexColumnWidth(2.5),
},
children: fullData(context, projectViewModel, monthly[1]),
)
])
]),
],
), ),
) Container(
padding: EdgeInsets.all(10),
color: Colors.transparent,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
model.weightYearTimeSeriesData.isEmpty
? Container(
child: Center(
child: Texts(TranslationBase.of(context).noDataAvailable),
),
)
: Column(children: [
for (var monthly in monthlyGroup)
Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
Container(
width: double.maxFinite,
padding: EdgeInsets.only(top: 10, bottom: 10, left: 5, right: 5),
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(5)),
child: Texts(monthly[0])),
Table(
columnWidths: {
0: FlexColumnWidth(2.5),
},
children: fullData(context, projectViewModel, monthly[1]),
)
])
]),
],
),
)],
),
),
mHeight(80),
], ],
), ),
); );

@ -36,7 +36,7 @@ class LineChartCurved extends StatelessWidget {
), ),
Text( Text(
title, title,
style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox( SizedBox(
@ -44,7 +44,7 @@ class LineChartCurved extends StatelessWidget {
), ),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.only(right: 18.0, left: 16.0, top: 15, bottom: 15), padding: const EdgeInsets.only(right: 18.0, left: 16.0),
child: LineChart( child: LineChart(
sampleData1(context), sampleData1(context),
swapAnimationDuration: const Duration(milliseconds: 250), swapAnimationDuration: const Duration(milliseconds: 250),
@ -80,6 +80,83 @@ class LineChartCurved extends StatelessWidget {
} }
} }
} }
// LineChartData sampleData1(context) {
// return LineChartData(
// lineTouchData: LineTouchData(
// touchTooltipData: LineTouchTooltipData(
// tooltipBgColor: Colors.white,
// ),
// touchCallback: (LineTouchResponse touchResponse) {},
// handleBuiltInTouches: true,
// ),
// gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
// titlesData: FlTitlesData(
// bottomTitles: SideTitles(
// showTitles: true,
// getTextStyles: (value) => const TextStyle(
// color: Colors.black,
// fontSize: 10,
// ),
// // rotateAngle: 90,
// //rotateAngle:-65,
// margin: 22,
// getTitles: (value) {
// if (timeSeries.length < 15) {
// if (timeSeries.length > value.toInt()) {
// return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
// } else
// return '';
// } else {
// if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
// if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
// if (xAxixs.contains(value.toInt())) {
// return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
// }
// }
// return '';
// },
// ),
// leftTitles: SideTitles(
// showTitles: true,
// // interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200,
// interval: 3,
// getTextStyles: (value) => const TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.bold,
// fontSize: 10,
// ),
//
// margin: 12,
// ),
// ),
// borderData: FlBorderData(
// show: true,
// border: const Border(
// bottom: BorderSide(
// color: Colors.black,
// width: 0.5,
// ),
// left: BorderSide(
// color: Colors.black,
// ),
// right: BorderSide(
// color: Colors.black,
// ),
// top: BorderSide(
// color: Colors.transparent,
// ),
// ),
// ),
// minX: 0,
// maxX: (timeSeries.length - 1).toDouble(),
// maxY: getMaxY() + 0.3,
// minY: 0,
// //getMinY(),
// lineBarsData: getData(context),
// );
// }
LineChartData sampleData1(context) { LineChartData sampleData1(context) {
return LineChartData( return LineChartData(
lineTouchData: LineTouchData( lineTouchData: LineTouchData(
@ -89,8 +166,7 @@ class LineChartCurved extends StatelessWidget {
touchCallback: (LineTouchResponse touchResponse) {}, touchCallback: (LineTouchResponse touchResponse) {},
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData( gridData: FlGridData(show: true, drawVerticalLine: true, drawHorizontalLine: true, horizontalInterval: 14, verticalInterval: 14),
horizontalInterval: horizontalInterval, show: true, drawVerticalLine: true, drawHorizontalLine: true),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: SideTitles(
showTitles: true, showTitles: true,
@ -98,8 +174,7 @@ class LineChartCurved extends StatelessWidget {
color: Colors.black, color: Colors.black,
fontSize: 10, fontSize: 10,
), ),
// rotateAngle: 90, rotateAngle: -65,
//rotateAngle:-65,
margin: 22, margin: 22,
getTitles: (value) { getTitles: (value) {
if (timeSeries.length < 15) { if (timeSeries.length < 15) {
@ -108,10 +183,8 @@ class LineChartCurved extends StatelessWidget {
} else } else
return ''; return '';
} else { } else {
if (value.toInt() == 0) if (value.toInt() == 0) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; if (value.toInt() == timeSeries.length - 1) return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
if (value.toInt() == timeSeries.length - 1)
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
if (xAxixs.contains(value.toInt())) { if (xAxixs.contains(value.toInt())) {
return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}'; return '${timeSeries[value.toInt()].time.month}/ ${timeSeries[value.toInt()].time.year}';
} }
@ -121,13 +194,21 @@ class LineChartCurved extends StatelessWidget {
), ),
leftTitles: SideTitles( leftTitles: SideTitles(
showTitles: true, showTitles: true,
interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200,
getTextStyles: (value) => const TextStyle( getTextStyles: (value) => const TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 10, fontSize: 10,
), ),
interval: 3.0,
// interval: getMaxY() - getMinY() <= 500
// ? getMaxY() - getMinY() <= 50
// ? 10
// : 10
// : getMaxY() - getMinY() <= 1000
// ? 100
// : getMaxY() - getMinY() >= 10000
// ? 5000
// : 200,
margin: 12, margin: 12,
), ),
), ),
@ -149,14 +230,14 @@ class LineChartCurved extends StatelessWidget {
), ),
), ),
), ),
minX: 0, minX: 0,
maxX: (timeSeries.length - 1).toDouble(), maxX: (timeSeries.length - 1).toDouble(),
maxY: getMaxY() + 0.3, maxY: getMaxY() + 0.3,
minY: 0,//getMinY(), minY: 0,
//getMinY(),
lineBarsData: getData(context), lineBarsData: getData(context),
); );
} }
double getMaxY() { double getMaxY() {
double max = 0; double max = 0;
timeSeries.forEach((element) { timeSeries.forEach((element) {
@ -180,9 +261,6 @@ class LineChartCurved extends StatelessWidget {
List<LineChartBarData> getData(context) { List<LineChartBarData> getData(context) {
List<FlSpot> spots = List(); List<FlSpot> spots = List();
if (timeSeries.length == 0) {
spots.add(FlSpot(0, 0));
}
for (int index = 0; index < timeSeries.length; index++) { for (int index = 0; index < timeSeries.length; index++) {
spots.add(FlSpot(index.toDouble(), timeSeries[index].sales)); spots.add(FlSpot(index.toDouble(), timeSeries[index].sales));
} }
@ -191,9 +269,8 @@ class LineChartCurved extends StatelessWidget {
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [secondaryColor], colors: [secondaryColor],
barWidth: 5, barWidth: 1.5,
isStrokeCapRound: true, isStrokeCapRound: true,
curveSmoothness: 0.12,
dotData: FlDotData( dotData: FlDotData(
show: false, show: false,
), ),

@ -36,7 +36,7 @@ class MonthLineChartCurved extends StatelessWidget {
), ),
Text( Text(
title, title,
style: TextStyle(color: Colors.black, fontSize: 15, letterSpacing: 2), style: TextStyle(color: Colors.black, fontSize: 16, letterSpacing: -0.64, fontWeight: FontWeight.w600),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
SizedBox( SizedBox(
@ -91,7 +91,12 @@ class MonthLineChartCurved extends StatelessWidget {
handleBuiltInTouches: true, handleBuiltInTouches: true,
), ),
gridData: FlGridData( gridData: FlGridData(
horizontalInterval: horizontalInterval, show: true, drawVerticalLine: true, drawHorizontalLine: true), horizontalInterval: 12,
show: true,
drawVerticalLine: true,
drawHorizontalLine: true,
verticalInterval: 12,
),
titlesData: FlTitlesData( titlesData: FlTitlesData(
bottomTitles: SideTitles( bottomTitles: SideTitles(
showTitles: true, showTitles: true,
@ -111,7 +116,11 @@ class MonthLineChartCurved extends StatelessWidget {
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 10, fontSize: 10,
), ),
interval:getMaxY() - getMinY() <=500?50:getMaxY() - getMinY() <=1000?100:200, interval: getMaxY() - getMinY() <= 500
? 50
: getMaxY() - getMinY() <= 1000
? 100
: 200,
// getTitles: (value) { // getTitles: (value) {
// if (value.toInt() == 0) // if (value.toInt() == 0)
@ -184,7 +193,7 @@ class MonthLineChartCurved extends StatelessWidget {
spots: spots, spots: spots,
isCurved: true, isCurved: true,
colors: [secondaryColor], colors: [secondaryColor],
barWidth: 5, barWidth: 1.5,
isStrokeCapRound: true, isStrokeCapRound: true,
curveSmoothness: 0.0, curveSmoothness: 0.0,
dotData: FlDotData( dotData: FlDotData(

@ -7,9 +7,12 @@ import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer
import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart'; import 'package:diplomaticquarterapp/core/viewModels/AlHabibMedicalService/add_new_address_Request_Model.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/ComprehensiveMedicalCheckup/NewCMC/cmc_location_page.dart';
import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart'; import 'package:diplomaticquarterapp/pages/AlHabibMedicalService/HomeHealthCare/NewHomeHealthCare/location_page.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/select_location_dialog.dart';
@ -28,20 +31,13 @@ class PrescriptionDeliveryAddressPage extends StatefulWidget {
final List<PrescriptionReport> prescriptionReportList; final List<PrescriptionReport> prescriptionReportList;
final List<PrescriptionReportEnh> prescriptionReportEnhList; final List<PrescriptionReportEnh> prescriptionReportEnhList;
const PrescriptionDeliveryAddressPage( const PrescriptionDeliveryAddressPage({Key key, this.prescriptions, this.prescriptionReportList, this.prescriptionReportEnhList}) : super(key: key);
{Key key,
this.prescriptions,
this.prescriptionReportList,
this.prescriptionReportEnhList})
: super(key: key);
@override @override
_PrescriptionDeliveryAddressPageState createState() => _PrescriptionDeliveryAddressPageState createState() => _PrescriptionDeliveryAddressPageState();
_PrescriptionDeliveryAddressPageState();
} }
class _PrescriptionDeliveryAddressPageState class _PrescriptionDeliveryAddressPageState extends State<PrescriptionDeliveryAddressPage> {
extends State<PrescriptionDeliveryAddressPage> {
AddressInfo _selectedAddress; AddressInfo _selectedAddress;
Completer<GoogleMapController> _controller = Completer(); Completer<GoogleMapController> _controller = Completer();
@ -79,218 +75,252 @@ class _PrescriptionDeliveryAddressPageState
return BaseView<PrescriptionDeliveryViewModel>( return BaseView<PrescriptionDeliveryViewModel>(
onModelReady: (model) => model.getCustomerInfo(), onModelReady: (model) => model.getCustomerInfo(),
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).shippingAddresss, appBarTitle: TranslationBase.of(context).shippingAddresss,
baseViewModel: model, baseViewModel: model,
body: Container( showNewAppBarTitle: true,
height: MediaQuery.of(context).size.height * 0.65, showNewAppBar: true,
child: SingleChildScrollView( backgroundColor: CustomColors.appBackgroudGrey2Color,
physics: BouncingScrollPhysics(), body: Container(
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, children: [
children: [ Expanded(
SizedBox( child: SingleChildScrollView(
height: 8, physics: BouncingScrollPhysics(),
), child: Column(
InkWell( crossAxisAlignment: CrossAxisAlignment.center,
onTap: () { children: [
confirmSelectLocationDialog(model.addressesList); Card(
}, margin: EdgeInsets.only(left: 12, right: 12, bottom: 12, top: 12),
child: Container( shape: cardRadius(12),
margin: EdgeInsets.only(left: 10, right: 10, top: 15), elevation: 3,
height: 50, child: Container(
decoration: BoxDecoration( child: InkWell(
border: Border.all(color: Colors.grey), onTap: () => confirmSelectLocationDialog(model.addressesList),
borderRadius: BorderRadius.circular(7), child: Container(
color: Colors.white, padding: EdgeInsets.all(8),
shape: BoxShape.rectangle, width: double.infinity,
), // height: 65,
child: Row( decoration: BoxDecoration(
mainAxisAlignment: MainAxisAlignment.spaceBetween, borderRadius: BorderRadius.circular(10),
children: <Widget>[ color: Colors.white,
Expanded( ),
child: Padding( child: Row(
padding: const EdgeInsets.all(8.0), mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Container( children: [
child: Text( Expanded(
getAddressName(), child: Text(
), getAddressName(),
margin: EdgeInsets.only(left: 10, right: 10), style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 12,
letterSpacing: -0.45,
),
),
),
Icon(Icons.arrow_drop_down)
],
), ),
), ),
), ),
Icon( height: 50,
Icons.arrow_drop_down, width: double.infinity,
size: 22, ),
color: Colors.grey,
)
],
), ),
), InkWell(
), onTap: () async {
SizedBox( Navigator.push(
height: 10, context,
), FadePage(
_selectedAddress == null page: LocationPage(
? Container( latitude: latitude,
child: Image.asset( longitude: longitude,
projectViewModel.isArabic )),
? 'assets/images/pharmacy/shipping_image_ar.png' ).then((value) {
: 'assets/images/pharmacy/shipping_image.png', if (value != null && value is AddNewAddressRequestModel) {
height: 300, setState(() {
), _selectedAddress = AddressInfo(
) id: value.customer.id.toString(),
: Padding( email: value.customer.email,
padding: const EdgeInsets.all(8.0), firstName: value.customer.addresses[0].firstName,
child: Column( lastName: value.customer.addresses[0].lastName,
crossAxisAlignment: CrossAxisAlignment.start, address1: value.customer.addresses[0].address1,
children: [ address2: value.customer.addresses[0].address2,
Padding( city: value.customer.addresses[0].city,
padding: const EdgeInsets.all(8.0), country: value.customer.addresses[0].country,
child: Container( phoneNumber: value.customer.addresses[0].phoneNumber,
decoration: BoxDecoration( latLong: value.customer.addresses[0].latLong,
border: Border.all(color: Colors.grey)), company: value.customer.addresses[0].company,
height: 200, countryId: value.customer.addresses[0].countryId,
child: GoogleMap( createdOnUtc: value.customer.addresses[0].createdOnUtc,
mapType: MapType.normal, customerAttributes: value.customer.addresses[0].customerAttributes,
markers: markers, faxNumber: value.customer.addresses[0].faxNumber,
initialCameraPosition: _kGooglePlex, province: value.customer.addresses[0].province,
onMapCreated: stateProvinceId: value.customer.addresses[0].stateProvinceId,
(GoogleMapController controller) { zipPostalCode: value.customer.addresses[0].zipPostalCode,
_controller.complete(controller); );
}, List latLongArr = _selectedAddress.latLong.split(',');
latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]);
markers = Set();
markers.add(
Marker(
markerId: MarkerId(
_selectedAddress.latLong.hashCode.toString(),
),
position: LatLng(latitude, longitude),
), ),
);
_kGooglePlex = CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.4746,
);
});
}
});
},
child: Padding(
padding: EdgeInsets.only(left: 12, right: 12, bottom: 16, top: 8),
child: Row(
children: [
Icon(Icons.add_circle_outline_sharp),
mWidth(12),
Text(
TranslationBase.of(context).addNewAddress,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w600,
letterSpacing: -0.46,
), ),
), ),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).shippingAddresss),
SizedBox(
height: 10,
),
Texts(
'${model.user.firstName} ${model.user.lastName}'),
SizedBox(
height: 10,
),
Texts(_selectedAddress.address1),
SizedBox(
height: 10,
),
Texts(_selectedAddress.address2),
SizedBox(
height: 10,
),
Texts(_selectedAddress.city +
" " +
_selectedAddress.country),
], ],
), ),
),
),
if (_selectedAddress != null)
Card(
shape: cardRadius(12),
color: Colors.white,
margin: EdgeInsets.all(12),
child: Padding(
padding: const EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Texts(
TranslationBase.of(context).selectAddress + ":",
fontSize: 12,
color: CustomColors.grey,
fontWeight: FontWeight.w600,
),
mHeight(12),
Container(
height: 175,
decoration: containerColorRadiusBorder(Colors.white, 12, Colors.grey),
clipBehavior: Clip.antiAlias,
child: Card(
shape: cardRadius(12),
clipBehavior: Clip.antiAlias,
elevation: 0,
margin: const EdgeInsets.all(0),
// child: GoogleMap(
// mapType: MapType.normal,
// markers: markers,
// initialCameraPosition: _kGooglePlex,
// onMapCreated: (GoogleMapController controller) {
// _controller.complete(controller);
// },
// ),
child: Image.network(
"https://maps.googleapis.com/maps/api/staticmap?center=" +
_kGooglePlex.target.latitude.toString() +
"," +
_kGooglePlex.target.longitude.toString() +
"&zoom=16&size=600x300&maptype=roadmap&markers=color:red%7C" +
_kGooglePlex.target.latitude.toString() +
"," +
_kGooglePlex.target.longitude.toString() +
"&key=AIzaSyCyDbWUM9d_sBUGIE8PcuShzPaqO08NSC8",
width: double.infinity,
height: double.infinity,
fit: BoxFit.cover,
),
),
),
SizedBox(
height: 10,
),
Texts(
TranslationBase.of(context).shippingAddresss + ":",
fontSize: 12,
color: CustomColors.grey,
fontWeight: FontWeight.w600,
),
SizedBox(
height: 2,
),
Texts(
'${model.user.firstName} ${model.user.lastName}',
fontSize: 12,
fontWeight: FontWeight.w600,
),
Texts(
_selectedAddress.address1,
fontSize: 12,
fontWeight: FontWeight.w600,
),
Texts(
_selectedAddress.address2,
fontSize: 12,
fontWeight: FontWeight.w600,
),
Texts(
_selectedAddress.city + " " + _selectedAddress.country,
fontSize: 12,
fontWeight: FontWeight.w600,
),
],
),
),
) )
], ],
),
),
), ),
), Card(
), shape: cardRadius(0),
bottomSheet: Container( margin: EdgeInsets.zero,
width: double.infinity, elevation: 20,
height: MediaQuery.of(context).size.height * 0.25, child: Container(
color: Colors.grey[100], width: double.infinity,
child: Column( padding: EdgeInsets.only(left: 16, right: 16, top: 16),
children: <Widget>[
Divider(),
Container(
width: MediaQuery.of(context).size.width * 0.8,
child: Button( child: Button(
label: label: TranslationBase.of(context).continues.toUpperCase(),
TranslationBase.of(context).addNewAddress.toUpperCase(), disabled: _selectedAddress == null,
backgroundColor: _selectedAddress == null ? CustomColors.grey2 : CustomColors.accentColor,
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
FadePage( FadePage(
page: LocationPage( page: PrescriptionOrderOverview(
latitude: latitude, latitude: latitude,
longitude: longitude, longitude: longitude,
)), prescriptionReportEnhList: widget.prescriptionReportEnhList,
).then((value) { prescriptionReportList: widget.prescriptionReportList,
if (value != null && prescriptions: widget.prescriptions,
value is AddNewAddressRequestModel) { selectedAddress: _selectedAddress,
setState(() { ),
_selectedAddress = AddressInfo( ),
id: value.customer.id.toString(), );
email: value.customer.email,
firstName: value.customer.addresses[0].firstName,
lastName: value.customer.addresses[0].lastName,
address1: value.customer.addresses[0].address1,
address2: value.customer.addresses[0].address2,
city: value.customer.addresses[0].city,
country: value.customer.addresses[0].country,
phoneNumber: value.customer.addresses[0].phoneNumber,
latLong: value.customer.addresses[0].latLong,
company: value.customer.addresses[0].company,
countryId: value.customer.addresses[0].countryId,
createdOnUtc: value.customer.addresses[0].createdOnUtc,
customerAttributes: value.customer.addresses[0].customerAttributes,
faxNumber: value.customer.addresses[0].faxNumber,
province: value.customer.addresses[0].province,
stateProvinceId: value.customer.addresses[0].stateProvinceId,
zipPostalCode: value.customer.addresses[0].zipPostalCode,
);
List latLongArr = _selectedAddress.latLong.split(',');
latitude = double.parse(latLongArr[0]);
longitude = double.parse(latLongArr[1]);
markers = Set();
markers.add(
Marker(
markerId: MarkerId(
_selectedAddress.latLong.hashCode.toString(),
),
position: LatLng(latitude, longitude),
),
);
_kGooglePlex = CameraPosition(
target: LatLng(latitude, longitude),
zoom: 14.4746,
);
});
}
});
}, },
), ),
), ),
Container( ),
width: MediaQuery.of(context).size.width * 0.8, ],
child: Button( ),
label: ),
TranslationBase.of(context).continues.toUpperCase(), ),
disabled: _selectedAddress == null,
backgroundColor: _selectedAddress == null
? Colors.green[300]
: Colors.green[700],
onTap: () {
Navigator.push(
context,
FadePage(
page: PrescriptionOrderOverview(
latitude: latitude,
longitude: longitude,
prescriptionReportEnhList:
widget.prescriptionReportEnhList,
prescriptionReportList:
widget.prescriptionReportList,
prescriptions: widget.prescriptions,
selectedAddress: _selectedAddress,
),
),
);
},
))
],
),
)),
); );
} }

@ -5,8 +5,10 @@ import 'package:diplomaticquarterapp/core/model/prescriptions/prescription_repor
import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart'; import 'package:diplomaticquarterapp/core/service/AlHabibMedicalService/customer_addresses_service.dart';
import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart'; import 'package:diplomaticquarterapp/core/viewModels/medical/PrescriptionDeliveryViewModel.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart'; import 'package:diplomaticquarterapp/widgets/buttons/secondary_button.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart'; import 'package:diplomaticquarterapp/widgets/dialogs/ConfirmWithMessageDialog.dart';
@ -30,146 +32,145 @@ class PrescriptionOrderOverview extends StatelessWidget {
isShowAppBar: true, isShowAppBar: true,
appBarTitle: TranslationBase.of(context).orderOverview, appBarTitle: TranslationBase.of(context).orderOverview,
baseViewModel: model, baseViewModel: model,
showNewAppBar: true,
showNewAppBarTitle: true,
backgroundColor: CustomColors.appBackgroudGrey2Color,
body: Container( body: Container(
height: MediaQuery.of(context).size.height * 0.8, height: double.infinity,
child: Column( child: Column(
children: [ children: [
if (!prescriptions.isInOutPatient) Expanded(
...List.generate( child: Column(
prescriptionReportList.length, children: [
(index) => Container( if (!prescriptions.isInOutPatient)
width: double.infinity, ...List.generate(
margin: EdgeInsets.only(top: 10, left: 10, right: 10), prescriptionReportList.length,
padding: EdgeInsets.all(8.0), (index) => Container(
decoration: BoxDecoration( width: double.infinity,
color: Colors.white, margin: EdgeInsets.only(top: 10, left: 10, right: 10),
borderRadius: BorderRadius.all( padding: EdgeInsets.all(8.0),
Radius.circular(10.0), decoration: BoxDecoration(
), color: Colors.white,
border: Border.all(color: Colors.grey[200], width: 0.5), borderRadius: BorderRadius.all(
), Radius.circular(10.0),
),
border: Border.all(color: Colors.grey[200], width: 0.5),
),
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReportList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
SizedBox(
width: 10,
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Center(
child: Texts(
prescriptionReportList[index].itemDescription.isNotEmpty ? prescriptionReportList[index].itemDescription : prescriptionReportList[index].itemDescriptionN)),
)),
],
),
))
else
...List.generate(
prescriptionReportEnhList.length,
(index) => Card(
margin: EdgeInsets.all(12.0),
color: Colors.white,
shape: cardRadius(12),
elevation: 4,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
ClipRRect( Padding(
borderRadius: BorderRadius.all(Radius.circular(5)), padding: const EdgeInsets.all(8.0),
child: Image.network( child: ClipRRect(
prescriptionReportList[index].imageSRCUrl, borderRadius: BorderRadius.all(Radius.circular(5)),
fit: BoxFit.cover, child: Image.network(
width: 60, prescriptionReportEnhList[index].imageSRCUrl,
height: 70, fit: BoxFit.cover,
width: 60,
height: 60,
),
), ),
), ),
SizedBox(
width: 10,
),
Expanded( Expanded(
child: Padding( child: Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Column(
child: Texts( crossAxisAlignment: CrossAxisAlignment.start,
prescriptionReportList[index].itemDescription.isNotEmpty ? prescriptionReportList[index].itemDescription : prescriptionReportList[index].itemDescriptionN)), children: <Widget>[
)), Texts(prescriptionReportEnhList[index].itemDescription),
Icon( ],
Icons.arrow_forward_ios, ),
size: 18, ),
color: Colors.grey[500], ),
)
], ],
), ),
))
else
...List.generate(
prescriptionReportEnhList.length,
(index) => Container(
margin: EdgeInsets.all(8.0),
color: Colors.white,
child: Row(
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(5)),
child: Image.network(
prescriptionReportEnhList[index].imageSRCUrl,
fit: BoxFit.cover,
width: 60,
height: 70,
),
),
SizedBox(
width: 10,
),
Expanded(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Texts(prescriptionReportEnhList[index].itemDescription),
],
),
),
), ),
Icon( )
Icons.arrow_forward_ios, ],
size: 18, ),
color: Colors.grey[500],
)
],
),
),
)
],
),
),
bottomSheet: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height * 0.15,
color: Colors.grey[100],
child: Column(
children: <Widget>[
SizedBox(
height: 12,
), ),
Container( Card(
width: MediaQuery.of(context).size.width * 0.8, shape: cardRadius(0),
child: SecondaryButton( margin: EdgeInsets.zero,
label: TranslationBase.of(context).submit.toUpperCase(), elevation: 20,
color: Colors.green[800], child: Container(
onTap: () async { width: double.infinity,
showDialog( margin: EdgeInsets.all(12),
context: context, child: SecondaryButton(
child: ConfirmWithMessageDialog( label: TranslationBase.of(context).submit.toUpperCase(),
message: TranslationBase.of(context).confirmPrescription, color: CustomColors.accentColor,
okTitle: TranslationBase.of(context).ok, onTap: () async {
onTap: () async { showDialog(
GifLoaderDialogUtils.showMyDialog(context); context: context,
await model child: ConfirmWithMessageDialog(
.insertDeliveryOrder( message: TranslationBase.of(context).confirmPrescription,
lineItemNo: 0, okTitle: TranslationBase.of(context).ok,
longitude: longitude, onTap: () async {
latitude: latitude, GifLoaderDialogUtils.showMyDialog(context);
appointmentNo: prescriptions.appointmentNo, await model
dischargeID: prescriptions.dischargeNo, .insertDeliveryOrder(
createdBy: model.user.patientID) lineItemNo: 0,
.then((value) { longitude: longitude,
GifLoaderDialogUtils.hideDialog(context); latitude: latitude,
if (model.state == ViewState.ErrorLocal) appointmentNo: prescriptions.appointmentNo,
showErrorDialog(context, model.error); dischargeID: prescriptions.dischargeNo,
else { createdBy: model.user.patientID)
Navigator.pop(context); .then((value) {
Navigator.pop(context); GifLoaderDialogUtils.hideDialog(context);
Navigator.pop(context, true); if (model.state == ViewState.ErrorLocal)
} showErrorDialog(context, model.error);
}).catchError((e) { else {
GifLoaderDialogUtils.hideDialog(context); Navigator.pop(context);
}); Navigator.pop(context);
}, Navigator.pop(context, true);
), }
); }).catchError((e) {
}, GifLoaderDialogUtils.hideDialog(context);
)) });
},
),
);
},
)),
)
], ],
), ),
), ),
), ),
); );
} }

@ -137,15 +137,6 @@ class LineChartCurved extends StatelessWidget {
fontSize: 10, fontSize: 10,
), ),
interval: 3.0, interval: 3.0,
// interval: getMaxY() - getMinY() <= 500
// ? getMaxY() - getMinY() <= 50
// ? 10
// : 10
// : getMaxY() - getMinY() <= 1000
// ? 100
// : getMaxY() - getMinY() >= 10000
// ? 5000
// : 200,
margin: 12, margin: 12,
), ),
), ),

@ -10,15 +10,7 @@ import 'package:provider/provider.dart';
/// [loading] show the progress indicator /// [loading] show the progress indicator
/// [elevation] color elevation value /// [elevation] color elevation value
class Button extends StatefulWidget { class Button extends StatefulWidget {
Button( Button({Key key, this.label: "", this.icon, this.onTap, this.backgroundColor, this.loading: false, this.elevation: true, this.disabled = false}) : super(key: key);
{Key key,
this.label: "",
this.icon,
this.onTap,
this.backgroundColor,
this.loading: false,
this.elevation: true, this.disabled=false})
: super(key: key);
final String label; final String label;
final Widget icon; final Widget icon;
@ -37,17 +29,11 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
AnimationController _animationController; AnimationController _animationController;
Animation _animation; Animation _animation;
PermissionService permission = new PermissionService(); PermissionService permission = new PermissionService();
@override @override
void initState() { void initState() {
_animationController = AnimationController( _animationController = AnimationController(vsync: this, lowerBound: 0.7, upperBound: 1.0, duration: Duration(milliseconds: 120));
vsync: this, _animation = CurvedAnimation(parent: _animationController, curve: Curves.easeOutQuad, reverseCurve: Curves.easeOutQuad);
lowerBound: 0.7,
upperBound: 1.0,
duration: Duration(milliseconds: 120));
_animation = CurvedAnimation(
parent: _animationController,
curve: Curves.easeOutQuad,
reverseCurve: Curves.easeOutQuad);
_animation.addListener(() { _animation.addListener(() {
setState(() { setState(() {
_buttonSize = _animation.value; _buttonSize = _animation.value;
@ -64,10 +50,7 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
Widget _buildIcon() { Widget _buildIcon() {
if (widget.icon != null && (widget.label != null && widget.label != "")) { if (widget.icon != null && (widget.label != null && widget.label != "")) {
return Container( return Container(margin: EdgeInsets.only(right: 12.0), height: 24.0, child: widget.icon);
margin: EdgeInsets.only(right: 12.0),
height: 24.0,
child: widget.icon);
} else if (widget.icon != null) { } else if (widget.icon != null) {
return Container( return Container(
height: 18.0, height: 18.0,
@ -94,33 +77,19 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
onTapCancel: () { onTapCancel: () {
_animationController.forward(); _animationController.forward();
}, },
onTap: () =>{ widget.disabled ? null : widget.onTap(), }, onTap: () => {
widget.disabled ? null : widget.onTap(),
},
behavior: HitTestBehavior.opaque, behavior: HitTestBehavior.opaque,
child: Transform.scale( child: Transform.scale(
scale: _buttonSize, scale: _buttonSize,
child: AnimatedContainer( child: AnimatedContainer(
duration: Duration(milliseconds: 150), duration: Duration(milliseconds: 150),
margin: margin: EdgeInsets.only(bottom: widget.label.isNotEmpty ? 14.0 : 0.0),
EdgeInsets.only(bottom: widget.label.isNotEmpty ? 14.0 : 0.0), padding: EdgeInsets.symmetric(vertical: widget.label != null && widget.label.isNotEmpty ? 12.0 : 12.0, horizontal: widget.label != null && widget.label.isNotEmpty ? 22.0 : 19),
padding: EdgeInsets.symmetric( decoration: BoxDecoration(borderRadius: BorderRadius.all(Radius.circular(10.0)), color: widget.backgroundColor ?? Theme.of(context).primaryColor, boxShadow: [
vertical: widget.label != null && widget.label.isNotEmpty BoxShadow(color: Color.fromRGBO(120, 71, 80, widget.elevation ? 0.28 : 0.0), spreadRadius: _buttonSize < 1.0 ? -(1 - _buttonSize) * 50 : 0.0, offset: Offset(0, 7.0), blurRadius: 24.0)
? 12.0 ]),
: 15.0,
horizontal: widget.label != null && widget.label.isNotEmpty
? 22.0
: 19),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
color: widget.backgroundColor ?? Theme.of(context).primaryColor,
boxShadow: [
BoxShadow(
color: Color.fromRGBO(
120, 71, 80, widget.elevation ? 0.28 : 0.0),
spreadRadius:
_buttonSize < 1.0 ? -(1 - _buttonSize) * 50 : 0.0,
offset: Offset(0, 7.0),
blurRadius: 24.0)
]),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -145,10 +114,11 @@ class _ButtonState extends State<Button> with TickerProviderStateMixin {
padding: EdgeInsets.only(bottom: 3.0), padding: EdgeInsets.only(bottom: 3.0),
child: Text(widget.label, child: Text(widget.label,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 17.0, fontSize: 16.0,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'WorkSans')), letterSpacing: -0.48,
)),
) )
], ],
), ),

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -8,74 +10,89 @@ class ConfirmWithMessageDialog extends StatelessWidget {
final String okTitle; final String okTitle;
final GestureTapCallback onTap; final GestureTapCallback onTap;
const ConfirmWithMessageDialog( const ConfirmWithMessageDialog({Key key, this.message, this.okTitle, this.onTap}) : super(key: key);
{Key key, this.message, this.okTitle, this.onTap})
: super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SimpleDialog( return SimpleDialog(
contentPadding: EdgeInsets.fromLTRB(28.0, 24.0, 28.0, 0.0), contentPadding: EdgeInsets.fromLTRB(12.0, 12.0, 12.0, 12.0),
title: Center(
child: Texts(
TranslationBase.of(context).confirm,
color: Colors.black,
),
),
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Center( Text(
child: Texts( TranslationBase.of(context).confirm,
message, style: TextStyle(
fontSize: 14,
color: Colors.black, color: Colors.black,
fontSize: 22,
letterSpacing: -0.94,
fontWeight: FontWeight.bold,
), ),
), ),
SizedBox( Text(
height: 5, message,
), style: TextStyle(
Divider(), fontSize: 14,
SizedBox( color: CustomColors.grey,
height: 5.0, fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
), ),
mHeight(20),
Container( Container(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
InkWell( Expanded(
onTap: () { child: InkWell(
Navigator.pop(context); onTap: () {
}, Navigator.pop(context);
child: Container( },
child: Center( child: Container(
child: Texts( decoration: containerRadius(CustomColors.darkGreyColor, 6),
TranslationBase.of(context).cancel, padding: EdgeInsets.all(6),
color: Colors.red, child: Center(
child: Text(
TranslationBase.of(context).cancel,
style: TextStyle(
color: Colors.black,
fontSize: 16,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
), ),
), ),
), ),
), ),
mWidth(12),
InkWell( Expanded(
onTap: () { child: InkWell(
Navigator.pop(context); onTap: () {
onTap(); Navigator.pop(context);
}, onTap();
child: Container( },
child: Center( child: Container(
child: Texts(okTitle), decoration: containerRadius(CustomColors.accentColor, 6),
padding: EdgeInsets.all(6),
child: Center(
child: Text(
okTitle,
style: TextStyle(
color: Colors.white,
fontSize: 16,
letterSpacing: -0.48,
fontWeight: FontWeight.w600,
),
),
),
), ),
), ),
), ),
], ],
), ),
), ),
SizedBox(
height: 20.0,
),
], ],
) )
], ],

@ -1,4 +1,6 @@
import 'package:diplomaticquarterapp/theme/colors.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/uitl/utils_new.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart'; import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -13,33 +15,34 @@ class ConfirmDialog {
final Function okFunction; final Function okFunction;
final Function cancelFunction; final Function cancelFunction;
ConfirmDialog( ConfirmDialog({@required this.context, this.title, @required this.confirmMessage, @required this.okText, @required this.cancelText, @required this.okFunction, @required this.cancelFunction});
{@required this.context,
this.title,
@required this.confirmMessage,
@required this.okText,
@required this.cancelText,
@required this.okFunction,
@required this.cancelFunction});
showAlertDialog(BuildContext context) { showAlertDialog(BuildContext context) {
// set up the buttons // set up the buttons
Widget cancelButton = FlatButton(
child: Texts(this.cancelText),
onPressed: () {
Navigator.of(context).pop();
cancelFunction();
});
Widget continueButton = FlatButton(child: Texts(okText), onPressed: okFunction);
// set up the AlertDialog // set up the AlertDialog
AlertDialog alert = AlertDialog( // AlertDialog alert = AlertDialog(
title: title != null ? Text(title) : Text(TranslationBase.of(context).confirm), // title: title != null ? Text(title) : Text(TranslationBase.of(context).confirm),
content: Text(this.confirmMessage), // content: Text(this.confirmMessage),
actions: [ // actions: [
cancelButton, // cancelButton,
continueButton, // continueButton,
], // ],
// );
Dialog alert = Dialog(
child: Container(
color: Colors.transparent,
child: Mdialog(
context,
title != null ? title : TranslationBase.of(context).confirm,
confirmMessage,
okText,
cancelText,
cancelFunction: cancelFunction,
okFunction: okFunction,
),
),
); );
// show the dialog // show the dialog
@ -54,5 +57,84 @@ class ConfirmDialog {
static closeAlertDialog(BuildContext context) { static closeAlertDialog(BuildContext context) {
Navigator.of(context).pop(); Navigator.of(context).pop();
} }
}
class Mdialog extends StatelessWidget {
String title;
String description;
final Function okFunction;
final Function cancelFunction;
final okText;
final cancelText;
BuildContext _context;
Mdialog(this._context, this.title, this.description, this.okText, this.cancelText, {this.okFunction, this.cancelFunction});
@override
Widget build(BuildContext context) {
return Container(
decoration: containerRadius(Colors.white, 12),
padding: EdgeInsets.all(20),
clipBehavior: Clip.antiAlias,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
// title != null ? title : TranslationBase.of(context).confirm,
title,
style: TextStyle(
fontSize: 24,
letterSpacing: -0.94,
fontWeight: FontWeight.w600,
),
),
Text(
// this.confirmMessage,
description,
style: TextStyle(
fontSize: 12,
letterSpacing: -0.48,
color: CustomColors.grey,
fontWeight: FontWeight.w600,
),
),
mHeight(16),
Row(
children: [
Expanded(
child: InkWell(
onTap: () {
Navigator.of(_context).pop();
cancelFunction();
},
child: Container(
decoration: containerRadius(CustomColors.lightGreyColor, 12),
padding: EdgeInsets.only(top: 8,bottom: 8),
child: Center(child: Texts(cancelText)),
),
),
),
mWidth(8),
Expanded(
child: InkWell(
onTap: okFunction,
child: Container(
decoration: containerRadius(CustomColors.accentColor, 12),
padding: EdgeInsets.only(top: 8,bottom: 8),
child: Center(
child: Texts(
okText,
color: Colors.white,
),
),
),
),
)
],
)
],
),
);
}
} }

Loading…
Cancel
Save