-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from gohealthnow/19-tela-de-produto
Tela de produto
- Loading branch information
Showing
9 changed files
with
212 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
{ | ||
"java.configuration.updateBuildConfiguration": "automatic" | ||
"java.configuration.updateBuildConfiguration": "automatic", | ||
"files.exclude": { | ||
"**/.git": true, | ||
"**/.svn": true, | ||
"**/.hg": true, | ||
"**/CVS": true, | ||
"**/.DS_Store": true, | ||
"**/Thumbs.db": true, | ||
"node_modules": true | ||
}, | ||
"hide-files.files": [] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gohealth/api/models/product_models.dart'; | ||
|
||
class DescriptionWidget extends StatefulWidget { | ||
const DescriptionWidget({Key? key, required this.productModels}) | ||
: super(key: key); | ||
|
||
@override | ||
State<DescriptionWidget> createState() => DescriptionSectionState(); | ||
|
||
final ProductModels productModels; | ||
} | ||
|
||
class DescriptionSectionState extends State<DescriptionWidget> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
'Descrição', | ||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.bold), | ||
), | ||
SizedBox(height: 8), | ||
Text( | ||
widget.productModels.description.toString(), | ||
style: TextStyle(fontSize: 16), | ||
), | ||
SizedBox(height: 8), | ||
Text( | ||
'Peso: ${widget.productModels.weight.toString()}g', | ||
style: TextStyle(fontSize: 16), | ||
), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gohealth/api/models/product_models.dart'; | ||
|
||
class ImageCarousel extends StatefulWidget { | ||
const ImageCarousel({Key? key, required this.productModels}) | ||
: super(key: key); | ||
|
||
@override | ||
State<ImageCarousel> createState() => ImageCarouselState(); | ||
|
||
final ProductModels productModels; | ||
} | ||
|
||
class ImageCarouselState extends State<ImageCarousel> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Container( | ||
height: 200, | ||
child: Column( | ||
children: [ | ||
Expanded( | ||
child: Image.network(widget.productModels.image ?? | ||
'https://via.placeholder.com/150')), | ||
], | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gohealth/api/models/product_models.dart'; | ||
|
||
class ProductDetailsPage extends StatefulWidget { | ||
const ProductDetailsPage({Key? key, required this.productModels}) | ||
: super(key: key); | ||
|
||
@override | ||
State<ProductDetailsPage> createState() => ProductDetails(); | ||
|
||
final ProductModels productModels; | ||
} | ||
|
||
|
||
class ProductDetails extends State<ProductDetailsPage> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Text( | ||
widget.productModels.name ?? 'Nome não disponível', | ||
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), | ||
), | ||
SizedBox(height: 8), | ||
Text( | ||
"R\$${widget.productModels.price.toString()}", | ||
style: TextStyle(fontSize: 20, color: Colors.grey), | ||
), | ||
SizedBox(height: 16), | ||
], | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:gohealth/api/models/product_models.dart'; | ||
import 'image_carousel.dart'; | ||
import 'product_details.dart'; | ||
import 'description_section.dart'; | ||
|
||
class ProductPage extends StatefulWidget { | ||
const ProductPage({Key? key, required this.productModels}) : super(key: key); | ||
|
||
@override | ||
State<ProductPage> createState() => ProductState(); | ||
|
||
final ProductModels productModels; | ||
} | ||
|
||
class ProductState extends State<ProductPage> { | ||
@override | ||
void initState() { | ||
super.initState(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text('Produto'), | ||
actions: [ | ||
IconButton( | ||
icon: Icon(Icons.more_vert), | ||
onPressed: () {}, | ||
), | ||
], | ||
), | ||
body: SingleChildScrollView( | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
ImageCarousel(productModels: widget.productModels), | ||
ProductDetailsPage(productModels: widget.productModels), | ||
DescriptionWidget(productModels: widget.productModels), | ||
], | ||
), | ||
), | ||
bottomNavigationBar: Padding( | ||
padding: const EdgeInsets.all(16.0), | ||
child: ElevatedButton( | ||
onPressed: () {}, | ||
child: Text('Adicionar ao carrinho'), | ||
style: ElevatedButton.styleFrom( | ||
padding: EdgeInsets.symmetric(vertical: 16), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters