diff --git a/.vscode/settings.json b/.vscode/settings.json index 1133129..5aa2b65 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -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": [] } \ No newline at end of file diff --git a/lib/api/layout/pharmacy_view_model.dart b/lib/api/layout/pharmacy_view_model.dart index 6c3a345..01e0d4f 100644 --- a/lib/api/layout/pharmacy_view_model.dart +++ b/lib/api/layout/pharmacy_view_model.dart @@ -1,5 +1,4 @@ import 'package:flutter/foundation.dart'; -import 'package:flutter/material.dart'; import 'package:gohealth/api/models/pharmacy_model.dart'; import 'package:gohealth/api/repositories/pharmacy_repository.dart'; diff --git a/lib/src/app/home/maps/maps_page.dart b/lib/src/app/home/maps/maps_page.dart index d3470ec..ee572ce 100644 --- a/lib/src/app/home/maps/maps_page.dart +++ b/lib/src/app/home/maps/maps_page.dart @@ -1,6 +1,5 @@ import 'dart:async'; -import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_map/flutter_map.dart'; import 'package:geolocator/geolocator.dart'; @@ -266,7 +265,8 @@ class _MapsPageState extends State { mapController: _mapController, children: [ TileLayer( - urlTemplate: 'http://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga', + urlTemplate: + 'http://mt0.google.com/vt/lyrs=m&hl=en&x={x}&y={y}&z={z}&s=Ga', userAgentPackageName: 'com.example.gohealth', ), RichAttributionWidget( @@ -285,7 +285,7 @@ class _MapsPageState extends State { if (_mylocation != null) MarkerLayer(markers: [ Marker( - point: _mylocation!, + point: _mylocation!, width: 40, height: 40, child: Container( @@ -303,11 +303,10 @@ class _MapsPageState extends State { ), child: Icon( Icons.location_searching_rounded, - color: Colors.green, + color: Colors.green, size: 25, ), - ) - ) + )) ]), ], ), diff --git a/lib/src/app/sessions/products/description_section.dart b/lib/src/app/sessions/products/description_section.dart new file mode 100644 index 0000000..fcd57d7 --- /dev/null +++ b/lib/src/app/sessions/products/description_section.dart @@ -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 createState() => DescriptionSectionState(); + + final ProductModels productModels; +} + +class DescriptionSectionState extends State { + @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), + ), + ], + ), + ); + } +} diff --git a/lib/src/app/sessions/products/image_carousel.dart b/lib/src/app/sessions/products/image_carousel.dart new file mode 100644 index 0000000..2bd461b --- /dev/null +++ b/lib/src/app/sessions/products/image_carousel.dart @@ -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 createState() => ImageCarouselState(); + + final ProductModels productModels; +} + +class ImageCarouselState extends State { + @override + Widget build(BuildContext context) { + return Container( + height: 200, + child: Column( + children: [ + Expanded( + child: Image.network(widget.productModels.image ?? + 'https://via.placeholder.com/150')), + ], + )); + } +} diff --git a/lib/src/app/sessions/products/product_details.dart b/lib/src/app/sessions/products/product_details.dart new file mode 100644 index 0000000..fbe58c6 --- /dev/null +++ b/lib/src/app/sessions/products/product_details.dart @@ -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 createState() => ProductDetails(); + + final ProductModels productModels; +} + + +class ProductDetails extends State { + @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), + ], + ), + ); + } +} diff --git a/lib/src/app/sessions/products/product_page.dart b/lib/src/app/sessions/products/product_page.dart new file mode 100644 index 0000000..d393b1d --- /dev/null +++ b/lib/src/app/sessions/products/product_page.dart @@ -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 createState() => ProductState(); + + final ProductModels productModels; +} + +class ProductState extends State { + @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), + ), + ), + ), + ); + } +} diff --git a/lib/src/components/banner.dart b/lib/src/components/banner.dart index 107e42a..3e9aa9a 100644 --- a/lib/src/components/banner.dart +++ b/lib/src/components/banner.dart @@ -5,6 +5,8 @@ import 'package:gohealth/api/layout/product_view_model.dart'; import 'package:gohealth/api/models/product_models.dart'; import 'package:gohealth/api/repositories/product_repository.dart'; +import 'package:gohealth/src/app/sessions/products/product_page.dart'; + class BannerComponent extends StatefulWidget { const BannerComponent({super.key}); @@ -47,30 +49,41 @@ class _BannerComponentState extends State { itemBuilder: (context, index) { return Padding( padding: const EdgeInsets.symmetric(horizontal: 8.0), - child: Column( - children: [ - CircleAvatar( - backgroundColor: Colors.primaries[ - Random().nextInt(Colors.primaries.length)], - radius: 50, - child: Text( - snapshot.data![index].name!, - style: const TextStyle( - color: Colors.white, - fontSize: 10, + child: GestureDetector( + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + // ! builder: (context) => ProductPage(productId: snapshot.data![index].id), + builder: (context) => ProductPage( + productModels: snapshot.data![index])), + ); + }, + child: Column( + children: [ + CircleAvatar( + backgroundColor: Colors.primaries[ + Random().nextInt(Colors.primaries.length)], + radius: 50, + child: Text( + snapshot.data![index].name!, + style: const TextStyle( + color: Colors.white, + fontSize: 10, + ), ), ), - ), - const SizedBox(height: 5), - Text( - snapshot.data![index].price!.toString(), - style: const TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, + const SizedBox(height: 5), + Text( + snapshot.data![index].price!.toString(), + style: const TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + ), ), - ), - const SizedBox(height: 5), - ], + const SizedBox(height: 5), + ], + ), ), ); }, diff --git a/pubspec.lock b/pubspec.lock index 207e711..0b2a137 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -609,10 +609,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" + sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc url: "https://pub.dev" source: hosted - version: "14.2.5" + version: "14.2.4" web: dependency: transitive description: