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

Added product details page

parent 467d2426
import 'package:flutter/material.dart';
import '../constants.dart';
import '../constants/constants.dart';
import '../size_config.dart';
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';
import 'package:fitton/component/clipper.dart';
import 'package:fitton/component/default_button.dart';
import 'package:fitton/screens/suggestColor/suggestColor.dart';
import 'package:fitton/screens/suggestItemPage/suggestItemPage.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
......@@ -17,7 +18,6 @@ class BodyMeasurementForm extends StatefulWidget {
class _BodyMeasurementFormState extends State<BodyMeasurementForm> {
double height,bGirth,uBGirth,wGirth,hGirth,insideLLength,armLength,neckBLength = 0.0;
List<double> mList;
@override
Widget build(BuildContext context) {
......@@ -229,7 +229,18 @@ class _BodyMeasurementFormState extends State<BodyMeasurementForm> {
press: () {
Navigator.push(
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/product_card.dart';
import 'package:fitton/screens/skinColourDetection/imagepicker.dart';
import 'package:flutter/material.dart';
......@@ -36,7 +37,7 @@ class _HomeApp extends State<Home> {
},
label: const Text('Chat Bot'),
backgroundColor: Colors.deepPurpleAccent,
)
),
],
),
),
......@@ -61,7 +62,7 @@ class _HomeApp extends State<Home> {
void chatBotModalBox(context){
showModalBottomSheet(context: context, builder: (BuildContext bc){
return Container(
height: MediaQuery.of(context).size.height *.8,
height: MediaQuery.of(context).size.height * 0.9,
child: Padding(
padding: const EdgeInsets.all(15.0),
child: SingleChildScrollView(
......
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/size_config.dart';
......
import 'package:flutter/material.dart';
import '../../../constants.dart';
import '../../../constants/constants.dart';
import '../../../size_config.dart';
class SplashContent extends StatelessWidget {
......
import 'package:fitton/model/Product.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class ProductPageBody extends StatefulWidget {
final Product itemDetails;
const ProductPageBody(this.itemDetails);
@override
_ProductPageBodyState createState() => _ProductPageBodyState();
}
class _ProductPageBodyState extends State<ProductPageBody> {
int nuOfItem = 1;
@override
Widget build(BuildContext context) {
//get size
Size size = MediaQuery.of(context).size;
return SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(
height: size.height,
child: Stack(
children: <Widget>[
Container(
//height: 500,
margin: EdgeInsets.only(top: size.height * 0.3),
padding: EdgeInsets.only(top: size.height * 0.12, left: 20, right: 20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
)
),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text("Colour",style: TextStyle(color: Colors.black45, fontSize: 20.0, fontWeight: FontWeight.bold),),
Container(
margin: EdgeInsets.only(top: 5),
padding: EdgeInsets.all(2.5),
height: 40,
width: 60,
decoration: BoxDecoration(
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(50),
border: Border.all(
color: Colors.black,
)
),
child: DecoratedBox(
decoration: BoxDecoration(
color: Colors.white38,
shape: BoxShape.rectangle,
borderRadius: BorderRadius.circular(50),
),
),
),
],
),
),
Expanded(
child:
RichText(
textAlign: TextAlign.center,
text: TextSpan(
style: TextStyle(color: Colors.black45),
children: [
TextSpan(
text: "Size\n",
style: TextStyle(color: Colors.black45, fontSize: 20.0, fontWeight: FontWeight.bold),
),
TextSpan(
text: "Medium",
style: Theme.of(context).textTheme.headline5.copyWith(
color: Colors.black,
fontWeight: FontWeight.bold,
),
)
]
),
),
),
Expanded(
child: Padding(
padding: EdgeInsets.only(top: 10),
child: Icon(Icons.favorite,size: 30.0,color: Colors.red,),
)
)
],
),
SizedBox(
height: 30,
),
Text(
widget.itemDetails.description,
style: TextStyle(
color: Colors.black, fontSize: 18.0,
),
),
Row(
children: <Widget>[
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 30,
),
Row(
children: <Widget>[
SizedBox(
width: 40,
height: 40,
child: OutlineButton(
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(13)
),
onPressed: (){
setState(() {
if(nuOfItem!=1){
nuOfItem = nuOfItem-1;
}
});
},
child: Icon(Icons.remove),
),
),
SizedBox(
width: 15,
),
Text(
nuOfItem.toString(),
style: TextStyle(color: Colors.black45, fontWeight: FontWeight.bold, fontSize: 25.0),
),
SizedBox(
width: 15,
),
SizedBox(
width: 40,
height: 40,
child: OutlineButton(
padding: EdgeInsets.zero,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(13)
),
onPressed: (){
setState(() {
nuOfItem = nuOfItem+1;
});
},
child: Icon(Icons.add),
),
),
],
)
],
),
),
Expanded(
child: Row(
children: <Widget>[
InkWell(
onTap: (){
//implement chat bot here
print("chat Bot Function");
},
child: Padding(
padding: EdgeInsets.only(top: 20, left: 60),
child: Icon(Icons.chat_outlined, color: Colors.deepPurpleAccent,size: 30,),
),
),
InkWell(
onTap: (){
//implement Model here
print("Model");
},
child: Padding(
padding: EdgeInsets.only(top: 20,left: 40),
child: Icon(Icons.accessibility, color: Colors.deepPurpleAccent, size: 30,),
),
)
],
)
),
],
),
SizedBox(
height: 50,
),
Row(
children: [
Container(
height: 50,
width: 70,
margin: EdgeInsets.only(right: 20),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(18),
border: Border.all(
color: Colors.deepPurpleAccent
)
),
child: IconButton(
icon: Icon(Icons.add_shopping_cart, color: Colors.deepPurpleAccent,),
onPressed: (){
print("Added to cart");
},
),
),
Expanded(
child: SizedBox(
height: 50,
child: FlatButton(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18)
),
onPressed: (){
print("Buy Now");
},
color: Colors.deepPurpleAccent,
child: Text(
"Buy Now".toUpperCase(),
style: TextStyle(
fontSize: 17,
color: Colors.white,
fontWeight: FontWeight.bold
),
),
),
),
)
],
)
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 20),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: EdgeInsets.only(top: 00),
child: Text(
"Clothes for Men",
style: TextStyle(color: Colors.white, fontSize: 17.0),
),
),
Padding(
padding: EdgeInsets.only(top: 1),
child: Text(
widget.itemDetails.title,
style: Theme.of(context).textTheme.headline4.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
),
Row(
children: <Widget>[
RichText(
text: TextSpan(
children: [
TextSpan(
text: "Price\n",
style: TextStyle(color: Colors.white, fontSize: 17.0),
),
TextSpan(
text: "\$${widget.itemDetails.price}",
style: Theme.of(context).textTheme.headline4.copyWith(
color: Colors.white,
fontWeight: FontWeight.bold,
),
)
]
),
),
SizedBox(width: 50.0,),
Expanded(
child: Image.asset(widget.itemDetails.images[0],),
)
],
)
],
),
)
],
),
)
],
),
);
}
}
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