new design pharmacy home

merge-requests/549/head
hussam al-habibeh 5 years ago
parent af0316367d
commit a5e7541394

@ -17,7 +17,6 @@ import 'package:rating_bar/rating_bar.dart';
import 'dart:math' as math; import 'dart:math' as math;
class ProductTileItem extends StatelessWidget { class ProductTileItem extends StatelessWidget {
final AppSharedPreferences sharedPref = AppSharedPreferences(); final AppSharedPreferences sharedPref = AppSharedPreferences();
final PharmacyProduct item; final PharmacyProduct item;
@ -46,13 +45,13 @@ class ProductTileItem extends StatelessWidget {
}); });
} }
if(items.length >= 15){ if (items.length >= 15) {
items.removeAt(0); items.removeAt(0);
// lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), ''); // lastVisited = lastVisited.replaceFirst(RegExp('$itemToRemove'), '');
} }
lastVisited = ""; lastVisited = "";
for(int i = items.length - 1; i >= 0; i--){ for (int i = items.length - 1; i >= 0; i--) {
if (lastVisited == "") { if (lastVisited == "") {
// it means there is no lastVisited yet // it means there is no lastVisited yet
lastVisited = "${items[i]}"; lastVisited = "${items[i]}";
@ -62,7 +61,6 @@ class ProductTileItem extends StatelessWidget {
} }
} }
if (!isIdExist) { if (!isIdExist) {
if (lastVisited == "") { if (lastVisited == "") {
// it means there is no lastVisited yet // it means there is no lastVisited yet
@ -84,9 +82,8 @@ class ProductTileItem extends StatelessWidget {
child: Container( child: Container(
margin: EdgeInsets.all(7), margin: EdgeInsets.all(7),
decoration: BoxDecoration( decoration: BoxDecoration(
border:Border.all(color: Colors.grey.shade300,width: 0.5), border: Border.all(color: Colors.grey.shade300, width: 0.5),
borderRadius: BorderRadius.circular(8) borderRadius: BorderRadius.circular(8)),
),
padding: EdgeInsets.symmetric(horizontal: 4), padding: EdgeInsets.symmetric(horizontal: 4),
width: MediaQuery.of(context).size.width / 2.8, width: MediaQuery.of(context).size.width / 2.8,
child: Column( child: Column(
@ -115,16 +112,18 @@ class ProductTileItem extends StatelessWidget {
Container( Container(
width: double.infinity, width: double.infinity,
height: MediaQuery.of(context).size.width * 0.3, height: MediaQuery.of(context).size.width * 0.3,
padding: EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14), padding:
EdgeInsets.only(left: 20, right: 20, top: 14, bottom: 14),
color: Colors.white, color: Colors.white,
child: InkWell( child: InkWell(
onTap: () { onTap: () {},
},
child: Container( child: Container(
width: double.infinity, width: double.infinity,
height: double.infinity, height: double.infinity,
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
decoration: containerRadiusWithGradientServices(33, lightColor: Colors.transparent, darkColor: Colors.transparent), decoration: containerRadiusWithGradientServices(33,
lightColor: Colors.transparent,
darkColor: Colors.transparent),
child: Stack( child: Stack(
children: [ children: [
Container( Container(
@ -139,95 +138,101 @@ class ProductTileItem extends StatelessWidget {
Container( Container(
margin: EdgeInsets.fromLTRB(0, 0, 0, 0), margin: EdgeInsets.fromLTRB(0, 0, 0, 0),
alignment: Alignment.center, alignment: Alignment.center,
child: (item.images != null && item.images.length > 0) child: (item.images != null &&
item.images.length > 0)
? Image.network( ? Image.network(
item.images[0].src, item.images[0].src,
fit: BoxFit.cover, fit: BoxFit.cover,
height: itemHeight / 2, height: itemHeight / 2,
) )
: Image.asset( : Image.asset(
"assets/images/no_image.png", "assets/images/no_image.png",
fit: BoxFit.cover, fit: BoxFit.cover,
height: itemHeight / 2, height: itemHeight / 2,
), ),
), ),
], ],
), ),
), ),
if (item.rxMessage != null)
projectProvider.isArabic projectProvider.isArabic
? Positioned( ? Positioned(
right: -16, right: -16,
top: 2, top: 2,
child: Transform.rotate( child: Transform.rotate(
angle: math.pi / 4, angle: math.pi / 4,
child: Container( child: Container(
padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), padding: EdgeInsets.only(
color: CustomColors.accentColor, left: 18, right: 18, top: 6, bottom: 3),
child: Text( color: CustomColors.accentColor,
"E-Prescription Is required", child: Padding(
style: TextStyle( padding: EdgeInsets.all(2.0),
color: Colors.white, child: Text(
fontSize: 9, "الوصفة\n مطلوبة",
height: 0.8, style: TextStyle(
letterSpacing: -0.27, color: Colors.white,
), fontSize: 7.5,
), height: 0.8,
), fontWeight: FontWeight.bold,
), letterSpacing: -0.27,
) ),
: Positioned( ),
left: -24, ),
top: 2, ),
child: Transform.rotate( ),
angle: -math.pi / 4, )
child: Container( : Positioned(
padding: EdgeInsets.only(left: 18, right: 18, top: 6, bottom: 3), left: -24,
color: CustomColors.accentColor, top: 2,
child: Text( child: Transform.rotate(
"\n E-Pr5escription \n Is required", angle: -math.pi / 4,
style: TextStyle( child: Container(
color: Colors.white, padding: EdgeInsets.only(
fontSize: 7, left: 18, right: 18, top: 6, bottom: 3),
//letterSpacing: -0.27, color: CustomColors.accentColor,
height: 1.2, child: Text(
"\n E-Prescription \n Is required",
style: TextStyle(
color: Colors.white,
fontSize: 7.5,
//letterSpacing: -0.27,
height: 1.2,
fontWeight: FontWeight.w600,
),
),
),
),
), ),
),
),
),
),
], ],
), ),
), ),
), ),
), ),
// Padding(
Padding( // padding: EdgeInsets.fromLTRB(1, 1, 1, 1),
padding: EdgeInsets.fromLTRB(1,1,1,1), // child: Container(
child: Container( // width: item.rxMessage != null
width: item.rxMessage != null // ? MediaQuery.of(context).size.width / 1.0
? MediaQuery.of(context).size.width / 1.0 // : 0,
: 0, // padding: EdgeInsets.fromLTRB(8, 2, 8, 2),
padding: EdgeInsets.fromLTRB(8,2,8,2), // decoration: BoxDecoration(
decoration: BoxDecoration( // color: Color(0xffb23838),
color: Color(0xffb23838), // ),
// child: item.rxMessage != null
), // ? Texts(
child: item.rxMessage != null // projectProvider.isArabic
? Texts( // ? item.rxMessagen
projectProvider.isArabic // : item.rxMessage,
? item.rxMessagen // color: Colors.white,
: item.rxMessage, // regular: true,
color: Colors.white, // fontSize: 10,
regular: true, // fontWeight: FontWeight.w400,
fontSize: 10, // )
fontWeight: FontWeight.w400, // : Texts(""),
) // ),
: Texts(""), // ),
), // SizedBox(height: 4,),
),
// SizedBox(height: 4,),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 4.0), padding: const EdgeInsets.symmetric(horizontal: 4.0),
child: Texts( child: Texts(
@ -257,17 +262,17 @@ class ProductTileItem extends StatelessWidget {
), ),
Row( Row(
children: [ children: [
// Expanded( // Expanded(
RatingBar.readOnly( RatingBar.readOnly(
initialRating: item.approvedRatingSum.toDouble(), initialRating: item.approvedRatingSum.toDouble(),
size: 15.0, size: 15.0,
filledColor: Colors.yellow[700], filledColor: Color(0xffD02127),
emptyColor: Colors.grey[500], emptyColor: Colors.grey[500],
isHalfAllowed: true, isHalfAllowed: true,
halfFilledIcon: Icons.star_half, halfFilledIcon: Icons.star_half,
filledIcon: Icons.star, filledIcon: Icons.star,
emptyIcon: Icons.star, emptyIcon: Icons.star,
), ),
Texts( Texts(
"(${item.approvedTotalReviews})", "(${item.approvedTotalReviews})",
regular: true, regular: true,
@ -281,14 +286,16 @@ class ProductTileItem extends StatelessWidget {
// .toDouble() // .toDouble()
// : 0, // : 0,
// forceStars: true), // forceStars: true),
// ), // ),
], ],
), ),
], ],
), ),
), ),
), ),
SizedBox(height: 5,), SizedBox(
height: 5,
),
], ],
), ),
), ),

@ -28,15 +28,17 @@ class BestSellerWidget extends StatelessWidget {
productType: 20, productType: 20,
)), )),
if (model.state != ViewState.BusyLocal) if (model.state != ViewState.BusyLocal)
Container( Container(
height: MediaQuery.of(context).size.height / 3 + 20, height: MediaQuery.of(context).size.height / 3 + 20,
child: ListView.builder( child: ListView.builder(
itemBuilder: (ctx, i) => itemBuilder: (ctx, i) => ProductTileItem(
ProductTileItem(model.bestSellerProduct[i], MediaQuery.of(context).size.height / 4 + 20), model.bestSellerProduct[i],
scrollDirection: Axis.horizontal, MediaQuery.of(context).size.height / 4 + 20),
itemCount: model.bestSellerProduct.length, scrollDirection: Axis.horizontal,
), itemCount: model.bestSellerProduct.length,
) else ),
)
else
Container( Container(
height: 80, height: 80,
child: Center( child: Center(

@ -5,6 +5,7 @@ import 'package:diplomaticquarterapp/pages/final_products_page.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/ProductTileItem.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/widgets/home/ViewAllHomeWidget.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart'; import 'package:diplomaticquarterapp/widgets/others/network_base_view.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';

@ -18,42 +18,46 @@ class RecentlyViewedWidget extends StatelessWidget {
builder: (_, model, wi) => NetworkBaseView( builder: (_, model, wi) => NetworkBaseView(
isLocalLoader: true, isLocalLoader: true,
baseViewModel: model, baseViewModel: model,
child: model.lastVisitedProducts.isNotEmpty ? Container( child: model.lastVisitedProducts.isNotEmpty
child: Column( ? Container(
children: [ child: Column(
ViewAllHomeWidget( children: [
TranslationBase.of(context).recentlyViewed, ViewAllHomeWidget(
FinalProductsPage( TranslationBase.of(context).recentlyViewed,
id: "", FinalProductsPage(
productType: 3, id: "",
)), productType: 3,
if (model.state != ViewState.BusyLocal) )),
Container( if (model.state != ViewState.BusyLocal)
height: model.lastVisitedProducts.length > 0 Container(
? MediaQuery.of(context).size.height / 3 + 20 height: model.lastVisitedProducts.length > 0
: 0, ? MediaQuery.of(context).size.height / 3 + 20
child: ListView.builder( : 0,
itemBuilder: (ctx, i) => child: ListView.builder(
ProductTileItem(model.lastVisitedProducts[i], MediaQuery.of(context).size.height / 4 + 20), itemBuilder: (ctx, i) => ProductTileItem(
scrollDirection: Axis.horizontal, model.lastVisitedProducts[i],
itemCount: model.lastVisitedProducts.length, MediaQuery.of(context).size.height / 4 +
), 20),
) scrollDirection: Axis.horizontal,
else itemCount: model.lastVisitedProducts.length,
Container( ),
height: 80, )
child: Center( else
child:CircularProgressIndicator( Container(
backgroundColor: Colors.white, height: 80,
valueColor: AlwaysStoppedAnimation<Color>( child: Center(
Colors.grey[500], child: CircularProgressIndicator(
backgroundColor: Colors.white,
valueColor: AlwaysStoppedAnimation<Color>(
Colors.grey[500],
),
),
),
), ),
), ],
),
), ),
], )
), : Container(),
) : Container(),
)); ));
} }
} }

@ -4,11 +4,9 @@ import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ViewAllHomeWidget extends StatelessWidget { class ViewAllHomeWidget extends StatelessWidget {
final String title; final String title;
final Widget navigationWidget; final Widget navigationWidget;
ViewAllHomeWidget(this.title, this.navigationWidget); ViewAllHomeWidget(this.title, this.navigationWidget);
@override @override
@ -23,22 +21,32 @@ class ViewAllHomeWidget extends StatelessWidget {
bold: true, bold: true,
fontSize: 16, fontSize: 16,
), ),
BorderedButton( InkWell(
TranslationBase.of(context).viewAll, onTap: () {
hasBorder: true, Navigator.push(context,
borderColor: Colors.green, MaterialPageRoute(builder: (context) => navigationWidget));
textColor: Colors.green,
fontWeight: FontWeight.bold,
vPadding: 6,
hPadding: 14,
handler: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) =>
navigationWidget));
}, },
child: Texts(
TranslationBase.of(context).viewAll,
color: Color(0xffD02127),
decoration: TextDecoration.underline,
fontWeight: FontWeight.w600,
fontSize: 12.0,
),
), ),
// BorderedButton(
// TranslationBase.of(context).viewAll,
// hasBorder: true,
// borderColor: Colors.green,
// textColor: Colors.green,
// fontWeight: FontWeight.bold,
// vPadding: 6,
// hPadding: 14,
// handler: () {
// Navigator.push(context,
// MaterialPageRoute(builder: (context) => navigationWidget));
// },
// ),
], ],
), ),
); );

Loading…
Cancel
Save