Merge branch 'IT18001808' into 'master'

Added Favourit icon dunction

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