Compare duplication fixed

merge-update-with-lab-changes
haroon amjad 4 years ago
parent 8c3b443f79
commit 28107f9a48

@ -1,18 +1,17 @@
import 'package:diplomaticquarterapp/config/shared_pref_kay.dart'; import 'package:diplomaticquarterapp/config/shared_pref_kay.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart';
import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart';
import 'package:flutter/material.dart'; import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart'; import 'package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart';
import 'package:carousel_slider/carousel_slider.dart'; import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:diplomaticquarterapp/pages/pharmacies/compare-list.dart';
import 'package:diplomaticquarterapp/core/model/pharmacies/PharmacyProduct.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart';
int counter = 0; int counter = 0;
dynamic languageID; dynamic languageID;
class ComparePage extends StatefulWidget { class ComparePage extends StatefulWidget {
@override @override
_ComparePageState createState() => _ComparePageState(); _ComparePageState createState() => _ComparePageState();
@ -23,6 +22,7 @@ class _ComparePageState extends State<ComparePage> {
getLanguageID() async { getLanguageID() async {
languageID = await sharedPref.getString(APP_LANGUAGE); languageID = await sharedPref.getString(APP_LANGUAGE);
} }
void initState() { void initState() {
getLanguageID(); getLanguageID();
super.initState(); super.initState();
@ -68,8 +68,8 @@ class compareList extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(TranslationBase.of(context).noData, child: Text(
// 'There is no data', TranslationBase.of(context).noData,
style: TextStyle(fontSize: 30), style: TextStyle(fontSize: 30),
), ),
) )
@ -77,27 +77,11 @@ class compareList extends StatelessWidget {
), ),
), ),
) )
: CarouselSlider( : Container(
options: CarouselOptions( margin: EdgeInsets.only(top: 12.0),
height: 800.0, width: double.infinity,
viewportFraction: 0.87, height: MediaQuery.of(context).size.height,
enableInfiniteScroll: false), child: slideDetail(productItem),
items: productItem.map((i) {
return Builder(
builder: (BuildContext context) {
return Padding(
padding: const EdgeInsets.only(top: 8),
child: Container(
width: MediaQuery.of(context).size.width,
margin: EdgeInsets.symmetric(horizontal: 10.0),
child: productItem.length != 0
? slideDetail(productItem)
: Container(),
),
);
},
);
}).toList(),
); );
} }
} }
@ -147,8 +131,7 @@ class _slideDetailState extends State<slideDetail> {
icon: Icon(FontAwesomeIcons.trashAlt, size: 15), icon: Icon(FontAwesomeIcons.trashAlt, size: 15),
onPressed: () { onPressed: () {
setState(() { setState(() {
Provider.of<CompareList>(context, listen: false) Provider.of<CompareList>(context, listen: false).deleteItem(widget.data[index].id);
.deleteItem(widget.data[index].id);
}); });
}, },
), ),
@ -173,53 +156,42 @@ class _slideDetailState extends State<slideDetail> {
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child:Align( child: Align(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: RichText( child: RichText(
text: projectViewModel.isArabic ? TextSpan( text: projectViewModel.isArabic
text: widget.data[index].namen, ? TextSpan(
style: TextStyle( text: widget.data[index].namen,
fontWeight: FontWeight.bold, style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
color: Colors.black, )
fontSize: 13), : TextSpan(
) text: widget.data[index].name,
: TextSpan( style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
text: widget.data[index].name, ),
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
),
), ),
), ),
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: "SAR ${widget.data[index].price.toString()}", text: "SAR ${widget.data[index].price.toString()}",
style: TextStyle( style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
color: Colors.black54, ),
fontSize: 15, ),
fontWeight: FontWeight.bold), )
), : Align(
), alignment: Alignment.topLeft,
): child: RichText(
Align( text: TextSpan(
alignment: Alignment.topLeft, text: "SAR ${widget.data[index].price.toString()}",
child: RichText( style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
text: TextSpan( ),
text: "SAR ${widget.data[index].price.toString()}", ),
style: TextStyle( ),
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
),
),
),
), ),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.only(top: 8.0),
@ -230,63 +202,43 @@ class _slideDetailState extends State<slideDetail> {
), ),
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[0].nameN : "",
widget.data[index].specifications[0].nameN :"", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
style: TextStyle( )),
fontWeight: FontWeight.bold, )
color: Colors.black, : Align(
fontSize: 13), alignment: Alignment.topLeft,
) child: RichText(
), text: TextSpan(
): Align( text: widget.data[index].specifications != null ? widget.data[index].specifications[0].name : "",
alignment: Alignment.topLeft, style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
child: RichText( )),
text: TextSpan( )),
text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].name :"",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
),
)
),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text:TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[0].defaultValuen : "",
widget.data[index].specifications[0].defaultValuen:"", style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle( )),
color: Colors.black54, )
fontSize: 15, : Align(
fontWeight: FontWeight.bold), alignment: Alignment.topLeft,
) child: RichText(
), text: TextSpan(
):Align( text: widget.data[index].specifications != null ? widget.data[index].specifications[0].defaultValue : "",
alignment: Alignment.topLeft, style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
child: RichText( )),
text:TextSpan( )),
text: widget.data[index].specifications != null ?
widget.data[index].specifications[0].defaultValue:"",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
)
),
)
),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.only(top: 8.0),
child: Container( child: Container(
@ -297,62 +249,42 @@ class _slideDetailState extends State<slideDetail> {
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[1].nameN : "",
widget.data[index].specifications[1].nameN :"", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
style: TextStyle( )),
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
),
): Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].name :"",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[1].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text:TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[1].defaultValuen : "",
widget.data[index].specifications[1].defaultValuen:"", style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle( )),
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
)
),
):Align(
alignment: Alignment.topLeft,
child: RichText(
text:TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[1].defaultValue:"",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[1].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.only(top: 8.0),
child: Container( child: Container(
@ -363,62 +295,42 @@ class _slideDetailState extends State<slideDetail> {
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[2].nameN : "",
widget.data[index].specifications[2].nameN :"", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
style: TextStyle( )),
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
),
): Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[2].name :"",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[2].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text:TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[2].defaultValuen : "",
widget.data[index].specifications[2].defaultValuen:"", style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle( )),
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
)
),
):Align(
alignment: Alignment.topLeft,
child: RichText(
text:TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[2].defaultValue:"",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[2].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.only(top: 8.0),
child: Container( child: Container(
@ -429,62 +341,42 @@ class _slideDetailState extends State<slideDetail> {
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[3].nameN : "",
widget.data[index].specifications[3].nameN :"", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
style: TextStyle( )),
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
),
): Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].name :"",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[3].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text:TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[3].defaultValuen : "",
widget.data[index].specifications[3].defaultValuen:"", style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle( )),
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
)
),
):Align(
alignment: Alignment.topLeft,
child: RichText(
text:TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[3].defaultValue:"",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[3].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.only(top: 8.0),
child: Container( child: Container(
@ -495,62 +387,42 @@ class _slideDetailState extends State<slideDetail> {
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[4].nameN : "",
widget.data[index].specifications[4].nameN :"", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
style: TextStyle( )),
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
),
): Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[4].name :"",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[4].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text:TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[4].defaultValuen : "",
widget.data[index].specifications[4].defaultValuen:"", style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle( )),
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
)
),
):Align(
alignment: Alignment.topLeft,
child: RichText(
text:TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[4].defaultValue:"",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[4].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
Padding( Padding(
padding: EdgeInsets.only(top: 8.0), padding: EdgeInsets.only(top: 8.0),
child: Container( child: Container(
@ -561,63 +433,42 @@ class _slideDetailState extends State<slideDetail> {
), ),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text: TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[5].nameN : "",
widget.data[index].specifications[5].nameN :"", style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
style: TextStyle( )),
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
)
),
): Align(
alignment: Alignment.topLeft,
child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[5].name :"",
style: TextStyle(
fontWeight: FontWeight.bold,
color: Colors.black,
fontSize: 13),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[5].name : "",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
)),
)),
Container( Container(
margin: EdgeInsets.all(5), margin: EdgeInsets.all(5),
child: projectViewModel.isArabic ? child: projectViewModel.isArabic
Align( ? Align(
alignment: Alignment.topRight, alignment: Alignment.topRight,
child: RichText( child: RichText(
text:TextSpan( text: TextSpan(
text: widget.data[index].specifications != null ? text: widget.data[index].specifications != null ? widget.data[index].specifications[5].defaultValuen : "",
widget.data[index].specifications[5].defaultValuen:"", style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
style: TextStyle( )),
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
)
),
):Align(
alignment: Alignment.topLeft,
child: RichText(
text:TextSpan(
text: widget.data[index].specifications != null ?
widget.data[index].specifications[5].defaultValue:"",
style: TextStyle(
color: Colors.black54,
fontSize: 15,
fontWeight: FontWeight.bold),
) )
), : Align(
) alignment: Alignment.topLeft,
), child: RichText(
text: TextSpan(
text: widget.data[index].specifications != null ? widget.data[index].specifications[5].defaultValue : "",
style: TextStyle(color: Colors.black54, fontSize: 15, fontWeight: FontWeight.bold),
)),
)),
], ],
), ),
), ),
@ -628,15 +479,3 @@ class _slideDetailState extends State<slideDetail> {
); );
} }
} }
String returnString(data) {
for (int i = 0; i < data.length; i++) {
print(data[i]);
// if(data[i] == null){
// if(counter == i){
//
// }
// }
}
return "ENAD HILAL";
}

Loading…
Cancel
Save