You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
165 lines
8.2 KiB
Dart
165 lines
8.2 KiB
Dart
|
|
|
|
import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart';
|
|
import 'package:diplomaticquarterapp/pages/base/base_view.dart';
|
|
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
|
|
import 'package:diplomaticquarterapp/widgets/data_display/text.dart';
|
|
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:rating_bar/rating_bar.dart';
|
|
|
|
class RecommendedProductPage extends StatefulWidget {
|
|
@override
|
|
_RecommendedProductPageState createState() => _RecommendedProductPageState();
|
|
}
|
|
|
|
class _RecommendedProductPageState extends State<RecommendedProductPage>
|
|
with SingleTickerProviderStateMixin{
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BaseView<PharmacyModuleViewModel>(
|
|
onModelReady: (model) => model.getRecommendedProducts(4561),
|
|
builder: (_,model, wi )=> AppScaffold(
|
|
appBarTitle:TranslationBase.of(context).recommended,
|
|
baseViewModel: model,
|
|
isShowAppBar: true,
|
|
isPharmacy:true ,
|
|
body: Column(
|
|
children: <Widget>[
|
|
// Text(
|
|
// "4455" + "Result",
|
|
// style: TextStyle(
|
|
// color: Colors.black,
|
|
// fontSize: 13.0,
|
|
// ),
|
|
// ),
|
|
// SizedBox(
|
|
// height: 10,
|
|
// ),
|
|
// Divider(
|
|
// color: Colors.grey[350],
|
|
// height: 10,
|
|
// thickness: 6,
|
|
// indent: 0,
|
|
// endIndent: 0,
|
|
// ),
|
|
GridView.count(
|
|
crossAxisCount: 2 ,
|
|
children: List.generate(30,(index){
|
|
return Container(
|
|
child: Card(
|
|
color: Colors.blue,
|
|
child: Container(
|
|
height: model.recommendedProduct.length > 0
|
|
? MediaQuery.of(context).size.height * 0.28
|
|
: 0,
|
|
padding: EdgeInsets.symmetric(horizontal: 16.0, vertical: 18.0),
|
|
// margin: EdgeInsets.only(left: 10),
|
|
child:BaseView<PharmacyModuleViewModel>(
|
|
onModelReady: (model) => model.getRecommendedProducts(4561 ),
|
|
builder: (_, model, wi) => model.recommendedProduct[0].products.length > 0
|
|
? ListView.builder(
|
|
// itemBuilder: (ctx, i) =>
|
|
// ProductTileItem(model.recommendedProduct[i]),
|
|
// scrollDirection: Axis.horizontal,
|
|
// itemCount: model.recommendedProduct.length,
|
|
scrollDirection: Axis.vertical,
|
|
shrinkWrap: true,
|
|
physics: ScrollPhysics(),
|
|
// physics: NeverScrollableScrollPhysics(),
|
|
itemCount: model.recommendedProduct[0].products.length,
|
|
itemBuilder: (context, index) {
|
|
return Container(
|
|
height: MediaQuery.of(context).size.height * 0.6,
|
|
padding: EdgeInsets.only(bottom: 5.0, left: 5.0, right: 8.0),
|
|
margin: EdgeInsets.only(right: 10.0),
|
|
decoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: Colors.grey,
|
|
style: BorderStyle.solid,
|
|
width: 1.0,),
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10.0)),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
margin: EdgeInsets.fromLTRB(0, 16, 0, 0),
|
|
alignment: Alignment.center,
|
|
child: (model.recommendedProduct[0].products[index].images != null &&
|
|
model.recommendedProduct[0].products[index].images.length > 0)
|
|
? Image.network(
|
|
model.recommendedProduct[0].products[index].images[0].src.toString(),
|
|
// item.images[0].src,
|
|
fit: BoxFit.cover,
|
|
height: 80,
|
|
)
|
|
: Image.asset(
|
|
"assets/images/no_image.png",
|
|
fit: BoxFit.cover,
|
|
height: 80,
|
|
),
|
|
),
|
|
Text(
|
|
model.recommendedProduct[0].products[index].shortDescription
|
|
.toString(),
|
|
style: TextStyle(
|
|
color: Colors.green,
|
|
fontSize: 15.0,
|
|
// fontWeight: FontWeight.bold,
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.only(top: 4, bottom: 4),
|
|
child: Texts(
|
|
"SAR ${model.recommendedProduct[0].products[index].price}",
|
|
bold: true,
|
|
fontSize: 14,
|
|
),
|
|
),
|
|
Row(
|
|
crossAxisAlignment:
|
|
CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
// Container(
|
|
// margin: EdgeInsets.only(left: 5),
|
|
// child: Align(
|
|
// alignment: Alignment.topLeft,
|
|
// child: RatingBar.readOnly(
|
|
// initialRating:
|
|
// model.recommendedProduct[0].products[index].reviews.toDouble(),
|
|
//// initialRating: productRate,
|
|
// size: 15.0,
|
|
// filledColor: Colors.yellow[700],
|
|
// emptyColor: Colors.grey[500],
|
|
// isHalfAllowed: true,
|
|
// halfFilledIcon: Icons.star_half,
|
|
// filledIcon: Icons.star,
|
|
// emptyIcon: Icons.star,
|
|
// ),
|
|
// ),
|
|
// ),
|
|
]),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
): Container(
|
|
// child: Text("NO DATA"),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}),
|
|
),
|
|
] ),
|
|
),
|
|
);
|
|
}} |