first step form redesign pharmacy page

merge-requests/964/head
Elham Rababh 4 years ago
parent 6905ed702e
commit 1789eb8c5b

@ -1,21 +1,28 @@
import 'dart:convert'; import 'dart:convert';
import 'dart:typed_data'; import 'dart:typed_data';
import 'package:doctor_app_flutter/config/config.dart';
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/service/AnalyticsService.dart';
import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/medicine_view_model.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart'; import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
import 'package:doctor_app_flutter/screens/base/base_view.dart'; import 'package:doctor_app_flutter/screens/base/base_view.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart'; import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/util/helpers.dart'; import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/medicine/medicine_item_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:maps_launcher/maps_launcher.dart'; import 'package:maps_launcher/maps_launcher.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
import '../../locator.dart';
DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
class PharmaciesListScreen extends StatefulWidget { class PharmaciesListScreen extends StatefulWidget {
@ -42,7 +49,10 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
builder: (_, model, w) => AppScaffold( builder: (_, model, w) => AppScaffold(
baseViewModel: model, baseViewModel: model,
appBarTitle: TranslationBase.of(context).pharmaciesList, appBarTitle: TranslationBase.of(context).pharmaciesList,
body: Container( body: Center(
child: FractionallySizedBox(
widthFactor: 0.95,
child: Container(
height: SizeConfig.screenHeight, height: SizeConfig.screenHeight,
child: ListView( child: ListView(
shrinkWrap: true, shrinkWrap: true,
@ -50,68 +60,14 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
physics: const AlwaysScrollableScrollPhysics(), physics: const AlwaysScrollableScrollPhysics(),
children: <Widget>[ children: <Widget>[
model.pharmaciesList.length > 0 model.pharmaciesList.length > 0
? RoundedContainer( ? MedicineItemWidget(
child: Row( label: model.pharmaciesList[0]["ItemDescription"],
children: <Widget>[ url: widget.url,
Expanded( showArrow: false,
flex: 1, showPrice: true,
child: ClipRRect( price: model.pharmaciesList[0]["SellingPrice"]
borderRadius:
BorderRadius.all(Radius.circular(7)),
child: widget.url != null
? Image.network(
widget.url,
height:
SizeConfig.imageSizeMultiplier * 21,
width:
SizeConfig.imageSizeMultiplier * 20,
fit: BoxFit.cover,
)
: Container(),
),
),
Expanded(
flex: 3,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
AppText(
TranslationBase.of(context).description,
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
model.pharmaciesList[0]["ItemDescription"],
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
AppText(
TranslationBase.of(context).price,
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 2,
fontWeight: FontWeight.bold,
),
AppText(
model.pharmaciesList[0]["SellingPrice"]
.toString(), .toString(),
marginLeft: 10,
marginTop: 0,
marginRight: 10,
marginBottom: 10,
),
],
),
) )
],
))
: Container(), : Container(),
Container( Container(
margin: EdgeInsets.only( margin: EdgeInsets.only(
@ -141,9 +97,10 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
? 0 ? 0
: model.pharmaciesList.length, : model.pharmaciesList.length,
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return RoundedContainer( return CardWithBgWidget(
margin: EdgeInsets.only(top: 5), bgColor: Colors.transparent,
child: Row( hasBorder: false,
widget: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
flex: 1, flex: 1,
@ -153,8 +110,10 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
child: Image.network( child: Image.network(
model.pharmaciesList[index] model.pharmaciesList[index]
["ProjectImageURL"], ["ProjectImageURL"],
height: SizeConfig.imageSizeMultiplier * 15, height:
width: SizeConfig.imageSizeMultiplier * 15, SizeConfig.imageSizeMultiplier * 15,
width:
SizeConfig.imageSizeMultiplier * 15,
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
@ -162,38 +121,26 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
Expanded( Expanded(
flex: 4, flex: 4,
child: AppText( child: AppText(
Helpers.convertToTitleCase(
model.pharmaciesList[index] model.pharmaciesList[index]
["LocationDescription"], ["LocationDescription"] ??
''),
margin: 10, margin: 10,
fontHeight: 1.4,
color: AppGlobal.appTextColor,
textAlign: TextAlign.start,
fontWeight: FontWeight.w600,
letterSpacing: -0.33,
), ),
), ),
Expanded(
flex: 2, Column(
child: Wrap( crossAxisAlignment:
direction: Axis.horizontal, CrossAxisAlignment.start,
alignment: WrapAlignment.end, mainAxisAlignment: MainAxisAlignment.end,
crossAxisAlignment: WrapCrossAlignment.end, children: [
children: <Widget>[ InkWell(
Padding( onTap: () async {
padding: EdgeInsets.all(5),
child: InkWell(
child: Icon(
Icons.call,
color: Colors.red,
),
onTap: () => launch("tel://" +
model.pharmaciesList[index]
["PhoneNumber"]),
),
),
Padding(
padding: EdgeInsets.all(5),
child: InkWell(
child: Icon(
Icons.pin_drop,
color: Colors.red,
),
onTap: () {
MapsLauncher.launchCoordinates( MapsLauncher.launchCoordinates(
double.parse( double.parse(
model.pharmaciesList[index] model.pharmaciesList[index]
@ -204,19 +151,125 @@ class _PharmaciesListState extends State<PharmaciesListScreen> {
model.pharmaciesList[index] model.pharmaciesList[index]
["LocationDescription"]); ["LocationDescription"]);
}, },
child: Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius:
BorderRadius.circular(10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
Icons.pin_drop,
size: 15,
color: Colors.white,
), ),
SizedBox(
width: 2,
),
AppText(
"location",
fontSize: 8,
color: Colors.white,
), ),
], ],
), ),
padding: EdgeInsets.all(6),
),
),
SizedBox(
height: 10,
),
InkWell(
onTap: () {
launch("tel://" +
model.pharmaciesList[index]
["PhoneNumber"]);
},
child: Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius:
BorderRadius.circular(10),
),
// color:Colors.red[600],
child: Row(
children: [
Icon(
DoctorApp.call,
size: 12,
color: Colors.white,
),
SizedBox(
width: 2,
),
AppText(
"Call Now",
fontSize: 8,
color: Colors.white,
), ),
], ],
), ),
padding: EdgeInsets.all(6),
),
),
],
),
// Expanded(
// flex: 2,
// child: Wrap(
// direction: Axis.horizontal,
// alignment: WrapAlignment.end,
// crossAxisAlignment: WrapCrossAlignment.end,
// children: <Widget>[
// Padding(
// padding: EdgeInsets.all(5),
// child: InkWell(
// child: Icon(
// Icons.call,
// color: Colors.red,
// ),
// onTap: () => launch("tel://" +
// model.pharmaciesList[index]
// ["PhoneNumber"]),
// ),
// ),
// Padding(
// padding: EdgeInsets.all(5),
// child: InkWell(
// child: Icon(
// Icons.pin_drop,
// color: Colors.red,
// ),
// onTap: () {
// MapsLauncher.launchCoordinates(
// double.parse(
// model.pharmaciesList[index]
// ["Latitude"]),
// double.parse(
// model.pharmaciesList[index]
// ["Longitude"]),
// model.pharmaciesList[index]
// ["LocationDescription"]);
// },
// ),
// ),
// ],
// ),
// ),
],
),
); );
}), }),
) )
]), ]),
), ),
), ),
),
),
); );
} }

Loading…
Cancel
Save