Merge branch 'IT18001808' into 'master'

Added Favourit icon dunction

See merge request !17
parents 3c0474ad c336fd41
import 'package:fitton/model/Product.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:fluttertoast/fluttertoast.dart';
class ProductPageBody extends StatefulWidget {
final Product itemDetails;
......@@ -12,6 +13,7 @@ class ProductPageBody extends StatefulWidget {
class _ProductPageBodyState extends State<ProductPageBody> {
int nuOfItem = 1;
bool isFavourite = false;
@override
Widget build(BuildContext context) {
......@@ -90,10 +92,24 @@ class _ProductPageBodyState extends State<ProductPageBody> {
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(top: 10),
child: Icon(Icons.favorite,size: 30.0,color: Colors.red,),
)
child: InkWell(
onTap: (){
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(isFavourite ? "Removed From Favourite List" : "Added to the Favourite List"),
));
setState(() {
isFavourite = !isFavourite;
});
},
child: Padding(
padding: EdgeInsets.only(top: 10),
child: Icon(
isFavourite ? Icons.favorite : Icons.favorite_outline,
size: 30.0,
color: Colors.red,
),
)
),
)
],
),
......@@ -213,6 +229,9 @@ class _ProductPageBodyState extends State<ProductPageBody> {
icon: Icon(Icons.add_shopping_cart, color: Colors.deepPurpleAccent,),
onPressed: (){
print("Added to cart");
Scaffold.of(context).showSnackBar(SnackBar(
content: Text("Added to the Cart"),
));
},
),
),
......@@ -249,7 +268,7 @@ class _ProductPageBodyState extends State<ProductPageBody> {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 00),
padding: EdgeInsets.only(top: 20),
child: Text(
"Clothes for Men",
style: TextStyle(color: Colors.white, fontSize: 17.0),
......@@ -284,7 +303,7 @@ class _ProductPageBodyState extends State<ProductPageBody> {
]
),
),
SizedBox(width: 50.0,),
SizedBox(width: size.height * 0.08,),
Expanded(
child: Image.asset(widget.itemDetails.images[0],),
)
......
......@@ -149,6 +149,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fluttertoast:
dependency: "direct main"
description:
name: fluttertoast
url: "https://pub.dartlang.org"
source: hosted
version: "8.0.8"
http:
dependency: transitive
description:
......
......@@ -38,6 +38,7 @@ dependencies:
flutter_svg: ^0.17.4
provider: ^4.3.1
simple_animations: ^1.3.3
fluttertoast: ^8.0.8
flutter_icons:
android: true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment