Commit 58e1b4f9 authored by pasindu-nawodya's avatar pasindu-nawodya

Added product details page

parent 467d2426
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../constants.dart'; import '../constants/constants.dart';
import '../size_config.dart'; import '../size_config.dart';
class DefaultButton extends StatelessWidget { class DefaultButton extends StatelessWidget {
......
import 'package:flutter/material.dart';
extension OnPressed on Widget {
Widget ripple(Function onPressed,
{BorderRadiusGeometry borderRadius =
const BorderRadius.all(Radius.circular(5))}) =>
Stack(
children: <Widget>[
this,
Positioned(
left: 0,
right: 0,
top: 0,
bottom: 0,
child: TextButton(
style: ButtonStyle(
shape: MaterialStateProperty.all(
RoundedRectangleBorder(borderRadius: borderRadius),
)),
onPressed: () {
if (onPressed != null) {
onPressed();
}
},
child: Container()),
)
],
);
}
\ No newline at end of file
import 'package:fitton/model/Product.dart';
import 'package:fitton/screens/productPage/productPage.dart';
import 'package:flutter/material.dart';
class ProductPage extends StatefulWidget {
final Product pdetails;
const ProductPage(this.pdetails);
@override
_ProductPageState createState() => _ProductPageState();
}
class _ProductPageState extends State<ProductPage> {
@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
InkWell(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => (ItemDesc(widget.pdetails,true))),
);
},
child: Container(
height: 150,
width: 160,
decoration: BoxDecoration(
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.grey[400],
blurRadius: 15.0, // soften the shadow
spreadRadius: 0.0, //extend the shadow
offset: Offset(
1.0,
1.0,
),
)
],
borderRadius: BorderRadius.circular(16),
),
child: Image.asset(widget.pdetails.images[0]),
),
),
Padding(
padding: const EdgeInsets.only(top: 5.0),
child: Text(
widget.pdetails.title,
style: TextStyle(
color: Colors.black54,
fontSize: 19,
fontWeight: FontWeight.bold
),
),
),
Text(
"\$"+widget.pdetails.price.toString(),
style: TextStyle(
color: Colors.black,
fontSize: 20,
fontWeight: FontWeight.bold
),
)
],
);
}
}
\ No newline at end of file
import 'package:flutter/material.dart';
class Product {
final int id;
final String title, description;
final List<String> images;
final List<Color> colors;
final double rating, price;
final bool isFavourite, isPopular;
Product({
@required this.id,
@required this.images,
@required this.colors,
this.rating = 0.0,
this.isFavourite = false,
this.isPopular = false,
@required this.title,
@required this.price,
@required this.description,
});
}
List<Product> demoProducts = [
Product(
id: 1,
images: [
"assets/images/short.png",
],
colors: [
Color(0xFFF6625E),
],
title: "Gym Short™",
price: 64.99,
description: description,
rating: 4.8,
isFavourite: true,
isPopular: true,
),
Product(
id: 2,
images: [
"assets/images/tshirt.png",
],
colors: [
Colors.white,
],
title: "Nike Shirt",
price: 50.5,
description: description,
rating: 4.1,
isPopular: true,
),
Product(
id: 3,
images: [
"assets/images/tshirt.png",
],
colors: [
Colors.white,
],
title: "DDaxx Shirt",
price: 36.55,
description: description,
rating: 4.1,
isFavourite: true,
isPopular: true,
),
Product(
id: 4,
images: [
"assets/images/short.png",
],
colors: [
//Color(0xFFF6625E),
Colors.white,
],
title: "Logitech Short",
price: 20.20,
description: description,
rating: 4.1,
isFavourite: true,
),
];
const String description =
"Wireless Controller for PS4™ gives you what you want in your gaming from over precision control your games to sharing Wireless Controller for PS4™ gives you what you want in your gaming from over precision control your games to sharing";
...@@ -3,6 +3,7 @@ import 'dart:ffi'; ...@@ -3,6 +3,7 @@ import 'dart:ffi';
import 'package:fitton/component/clipper.dart'; import 'package:fitton/component/clipper.dart';
import 'package:fitton/component/default_button.dart'; import 'package:fitton/component/default_button.dart';
import 'package:fitton/screens/suggestColor/suggestColor.dart'; import 'package:fitton/screens/suggestColor/suggestColor.dart';
import 'package:fitton/screens/suggestItemPage/suggestItemPage.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
...@@ -17,7 +18,6 @@ class BodyMeasurementForm extends StatefulWidget { ...@@ -17,7 +18,6 @@ class BodyMeasurementForm extends StatefulWidget {
class _BodyMeasurementFormState extends State<BodyMeasurementForm> { class _BodyMeasurementFormState extends State<BodyMeasurementForm> {
double height,bGirth,uBGirth,wGirth,hGirth,insideLLength,armLength,neckBLength = 0.0; double height,bGirth,uBGirth,wGirth,hGirth,insideLLength,armLength,neckBLength = 0.0;
List<double> mList;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -229,7 +229,18 @@ class _BodyMeasurementFormState extends State<BodyMeasurementForm> { ...@@ -229,7 +229,18 @@ class _BodyMeasurementFormState extends State<BodyMeasurementForm> {
press: () { press: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => (BodyMeasurementForm(widget.skinTone))), MaterialPageRoute(builder: (context) => (
SuggestItemPage(
widget.skinTone,
height != null ? height : 0.0,
bGirth != null ? bGirth : 0.0,
uBGirth != null ? uBGirth : 0.0,
wGirth != null ? wGirth : 0.0,
hGirth != null ? hGirth : 0.0,
insideLLength != null ? insideLLength : 0.0,
armLength != null ? armLength : 0.0,
neckBLength != null ? neckBLength : 0.0
))),
); );
}, },
), ),
......
import 'package:fitton/component/clipper.dart'; import 'package:fitton/component/clipper.dart';
import 'package:fitton/component/product_card.dart';
import 'package:fitton/screens/skinColourDetection/imagepicker.dart'; import 'package:fitton/screens/skinColourDetection/imagepicker.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -36,7 +37,7 @@ class _HomeApp extends State<Home> { ...@@ -36,7 +37,7 @@ class _HomeApp extends State<Home> {
}, },
label: const Text('Chat Bot'), label: const Text('Chat Bot'),
backgroundColor: Colors.deepPurpleAccent, backgroundColor: Colors.deepPurpleAccent,
) ),
], ],
), ),
), ),
...@@ -61,7 +62,7 @@ class _HomeApp extends State<Home> { ...@@ -61,7 +62,7 @@ class _HomeApp extends State<Home> {
void chatBotModalBox(context){ void chatBotModalBox(context){
showModalBottomSheet(context: context, builder: (BuildContext bc){ showModalBottomSheet(context: context, builder: (BuildContext bc){
return Container( return Container(
height: MediaQuery.of(context).size.height *.8, height: MediaQuery.of(context).size.height * 0.9,
child: Padding( child: Padding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: SingleChildScrollView( child: SingleChildScrollView(
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:fitton/constants.dart'; import 'package:fitton/constants/constants.dart';
import 'package:fitton/screens/login/login.dart'; import 'package:fitton/screens/login/login.dart';
import 'package:fitton/size_config.dart'; import 'package:fitton/size_config.dart';
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import '../../../constants.dart'; import '../../../constants/constants.dart';
import '../../../size_config.dart'; import '../../../size_config.dart';
class SplashContent extends StatelessWidget { class SplashContent extends StatelessWidget {
......
This diff is collapsed.
import 'package:fitton/model/Product.dart';
import 'package:fitton/screens/productPage/body.dart';
import 'package:fitton/screens/suggestItemPage/suggestItemPage.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ItemDesc extends StatefulWidget {
final Product itemDetails;
final bool isSmartApproach;
const ItemDesc(this.itemDetails, this.isSmartApproach);
@override
_ItemDescState createState() => _ItemDescState();
}
class _ItemDescState extends State<ItemDesc> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.deepPurpleAccent,
appBar: AppBar(
backgroundColor: Colors.deepPurpleAccent,
elevation: 0,
leading: InkWell(
child: Icon(Icons.arrow_back_ios),
onTap: (){
Navigator.push(
context,
MaterialPageRoute(builder: (context) => (
SuggestItemPage(
Colors.white,0,0,0,0,0,0,0,0 ))),
);
},
),
title: Text("Description", style: TextStyle(fontWeight: FontWeight.bold),),
centerTitle: true,
actions: [
InkWell(
child: Padding(
padding: EdgeInsets.only(right: 20,left: 20),
child: Icon(Icons.shopping_cart),
),
onTap: (){
print("cart");
},
),
],
),
body: ProductPageBody(widget.itemDetails)
);
}
}
import 'package:fitton/component/clipper.dart';
import 'package:fitton/model/Product.dart';
import 'package:fitton/component/product_card.dart';
import 'package:flutter/material.dart';
class SuggestItemPage extends StatefulWidget {
final Color skinTone;
final double heightM,bGirthM,uBGirthM,wGirthM,hGirthM,insideLLengthM,armLengthM,neckBLengthM;
SuggestItemPage(this.skinTone,this.heightM,this.bGirthM,this.uBGirthM,this.wGirthM,this.hGirthM,this.insideLLengthM,this.armLengthM,this.neckBLengthM);
@override
_SuggestItemPageState createState() => _SuggestItemPageState();
}
class _SuggestItemPageState extends State<SuggestItemPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.deepPurpleAccent,
elevation: 0,
leading: InkWell(
child: Icon(Icons.arrow_back_ios),
onTap: (){},
),
centerTitle: true,
actions: [
InkWell(
child: Padding(
padding: EdgeInsets.only(right: 20,left: 20),
child: Icon(Icons.camera_alt_sharp),
),
onTap: (){
print("cart");
},
),
],
),
body: Stack(
children: [
ClipPath(
clipper: MyClipper(),
child: Container(
color: Colors.deepPurpleAccent,
)
),
SingleChildScrollView(
child: Padding(
padding: EdgeInsets.only(left: 20.0, right: 20.0),
child: Column(
children: <Widget>[
Center(
child: Text("Select Your Choice", style: TextStyle(color: Colors.white, fontSize: 30, fontWeight: FontWeight.bold),),
),
SizedBox(
height: 20.0,
),
Center(
child: Text("Those are the results that we suggest for you. Now You can continue with your choice.", textAlign: TextAlign.center,style: TextStyle(color: Colors.white, fontSize: 20),),
),
SizedBox(
height: 60.0,
),
SizedBox(
height: MediaQuery.of(context).size.height*0.7,
child: GridView.builder(
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 200,
childAspectRatio: 3 / 2,
mainAxisExtent: 250,
crossAxisSpacing: 20,
mainAxisSpacing: 0),
itemCount: demoProducts.length*2,
itemBuilder: (BuildContext ctx, index) {
return ProductPage(demoProducts[index > 3 ? 0 : index]);
}),
)
],
),
),
),
],
),
);
}
}
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