update shop detail

parent 04764f68
class shoplistdetailModel { class shoplistdetailModel
{
List<Result> result; List<Result> result;
shoplistdetailModel({this.result}); shoplistdetailModel({this.result});
...@@ -51,7 +53,7 @@ class Result { ...@@ -51,7 +53,7 @@ class Result {
List<Comment> comment; List<Comment> comment;
List<dynamic> commentReview; List<dynamic> commentReview;
List<OpenHour> openHour; List<OpenHour> openHour;
List<dynamic> image; List<Image2> image;
Ratings ratings; Ratings ratings;
Result({this.id, this.storeCode, this.storeName, this.storeCover, this.displayCover, this.isActive, this.storeOrder, this.customerGroupId, this.vendorId, this.createdAt, this.updatedAt, this.location, this.email, this.phone, this.mobile, this.address, this.city, this.country, this.zipCode, this.website, this.allowRoute, this.excerpt, this.detail, this.storeLogo, this.isFacilities, this.distanceWithLocation, this.star, this.storeProduct, this.comment, this.commentReview, this.openHour, this.image, this.ratings}); Result({this.id, this.storeCode, this.storeName, this.storeCover, this.displayCover, this.isActive, this.storeOrder, this.customerGroupId, this.vendorId, this.createdAt, this.updatedAt, this.location, this.email, this.phone, this.mobile, this.address, this.city, this.country, this.zipCode, this.website, this.allowRoute, this.excerpt, this.detail, this.storeLogo, this.isFacilities, this.distanceWithLocation, this.star, this.storeProduct, this.comment, this.commentReview, this.openHour, this.image, this.ratings});
...@@ -586,6 +588,37 @@ class InfoCustomer { ...@@ -586,6 +588,37 @@ class InfoCustomer {
return data; return data;
} }
} }
class Image {
int id;
String name;
String code;
String dayName;
String open;
String closed;
String image;
int vendorId;
int storeId;
dynamic createdAt;
dynamic updatedAt;
Image({this.id, this.name, this.code, this.dayName, this.open, this.closed, this.image, this.vendorId, this.storeId, this.createdAt, this.updatedAt});
Image.fromJson(Map<String, dynamic> json) {
image = json['image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['image'] = this.image;
return data;
}
}
class OpenHour { class OpenHour {
int id; int id;
...@@ -693,6 +726,62 @@ class Ratings { ...@@ -693,6 +726,62 @@ class Ratings {
} }
} }
class Image2 {
int id;
String image;
String title;
String altText;
String detail;
String status;
int vendorId;
Null createdAt;
Null updatedAt;
String imageTb;
int tbId;
Image2(
{this.id,
this.image,
this.title,
this.altText,
this.detail,
this.status,
this.vendorId,
this.createdAt,
this.updatedAt,
this.imageTb,
this.tbId});
Image2.fromJson(Map<String, dynamic> json) {
id = json['id'];
image = json['image'];
title = json['title'];
altText = json['alt_text'];
detail = json['detail'];
status = json['status'];
vendorId = json['vendor_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
imageTb = json['image_tb'];
tbId = json['tb_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['image'] = this.image;
data['title'] = this.title;
data['alt_text'] = this.altText;
data['detail'] = this.detail;
data['status'] = this.status;
data['vendor_id'] = this.vendorId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['image_tb'] = this.imageTb;
data['tb_id'] = this.tbId;
return data;
}
}
class RatingScore { class RatingScore {
int id; int id;
int ratingId; int ratingId;
...@@ -722,4 +811,6 @@ class RatingScore { ...@@ -722,4 +811,6 @@ class RatingScore {
data['customer_id'] = this.customerId; data['customer_id'] = this.customerId;
return data; return data;
} }
} }
import 'package:carousel_pro/carousel_pro.dart';
import 'package:feelverapp/service/api.dart'; import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/ui/home/home.dart'; import 'package:feelverapp/ui/home/home.dart';
import 'package:feelverapp/ui/menu/menu.dart'; import 'package:feelverapp/ui/menu/menu.dart';
...@@ -24,6 +25,8 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -24,6 +25,8 @@ class _ShopListDetailState extends State<ShopListDetail> {
presenter = ShoplistdetailPresenter(this); presenter = ShoplistdetailPresenter(this);
presenter.Detai(widget.id); presenter.Detai(widget.id);
// List values = presenter.model.result[0].location.split(","); // split() will split from . and gives new List with separated elements.
//values.forEach(print);
} }
...@@ -68,6 +71,12 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -68,6 +71,12 @@ class _ShopListDetailState extends State<ShopListDetail> {
'assets/images/feelver_banner.png', 'assets/images/feelver_banner.png',
width: MediaQuery.of(context).size.width / 2.5, width: MediaQuery.of(context).size.width / 2.5,
), ),
// Image.network(
// Api.baseApiforimage+ presenter.model.result[0].storeLogo,
// height: SizeConfig.getWidth(180),
// width: MediaQuery.of(context).size.width,
// fit: BoxFit.cover,
// ),
), ),
), ),
Positioned( Positioned(
...@@ -92,15 +101,38 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -92,15 +101,38 @@ class _ShopListDetailState extends State<ShopListDetail> {
], ],
), ),
Container( Container(
height: SizeConfig.getHeight(270), height: SizeConfig.getHeight(240),
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Image.network( Container(
presenter.model.result[0].storeCover, height: SizeConfig.getHeight(190),
height: SizeConfig.getWidth(190), width: SizeConfig.getHeight(350),
width: SizeConfig.getWidth(350), child: Carousel(
fit: BoxFit.cover,
), images: [
Image.network(presenter.model.result[0].storeCover,fit: BoxFit.cover,),
Image.network(presenter.model.result[0].storeCover,fit: BoxFit.cover,),
Image.network(presenter.model.result[0].storeCover,fit: BoxFit.cover,),
Image.network(presenter.model.result[0].storeCover,fit: BoxFit.cover,),
],
animationDuration: const Duration(milliseconds: 300),
dotSize: 8.0,
dotSpacing: 25.0,
dotIncreaseSize: 2.0,
dotColor: Colors.white,
dotBgColor: Colors.transparent,
// showIndicator: true,
indicatorBgPadding: 20.0,
boxFit: BoxFit.cover,
radius: Radius.circular(0.0),
overlayShadow: false,
// overlayShadowColors: Colors.transparent,
// overlayShadowSize: 0.5,
autoplay: true,
),
),
Positioned( Positioned(
right: SizeConfig.getPadding(16), right: SizeConfig.getPadding(16),
top: SizeConfig.getPadding(16), top: SizeConfig.getPadding(16),
...@@ -122,15 +154,26 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -122,15 +154,26 @@ class _ShopListDetailState extends State<ShopListDetail> {
Positioned( Positioned(
left: SizeConfig.getPadding(75), left: SizeConfig.getPadding(75),
top: SizeConfig.getPadding(190), top: SizeConfig.getPadding(190),
child: GestureDetector(
onTap: (){
print( presenter.model.result[0].location);
List values = presenter.model.result[0].location.split(","); // split() will split from . and gives new List with separated elements.
values.forEach(print);
print("lat ="+values[0]);
print("lng ="+values[1]);
presenter.gotoDirection(values[0], values[1]);
},
child: Text( child: Text(
presenter.model.result[0].storeName, "นำทาง",
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black, decoration: TextDecoration.underline,
fontSize: SizeConfig.getFontSize(16), color: Colors.grey,
fontSize: SizeConfig.getFontSize(13),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
), ),)
), ),
], ],
), ),
...@@ -144,7 +187,7 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -144,7 +187,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
), ),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'ข้อมูลติดต่อ', presenter.model.result[0].storeName,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
...@@ -234,12 +277,14 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -234,12 +277,14 @@ class _ShopListDetailState extends State<ShopListDetail> {
height: SizeConfig.getHeight(20), height: SizeConfig.getHeight(20),
), ),
_detail(), _detail(),
_servicelist(),
], ],
), ),
); );
} }
_dayOpen() {
_servicelist() {
return Column( return Column(
children: <Widget>[ children: <Widget>[
Container( Container(
...@@ -251,7 +296,7 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -251,7 +296,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
), ),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'วันเปิดปิดทำการ', 'บริการ',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
...@@ -260,7 +305,10 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -260,7 +305,10 @@ class _ShopListDetailState extends State<ShopListDetail> {
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
), ),
), ),
Container( Container(
height: 600,
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(0), top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24), left: SizeConfig.getPadding(24),
...@@ -268,124 +316,218 @@ class _ShopListDetailState extends State<ShopListDetail> { ...@@ -268,124 +316,218 @@ class _ShopListDetailState extends State<ShopListDetail> {
bottom: SizeConfig.getPadding(5), bottom: SizeConfig.getPadding(5),
), ),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child:ListView.builder(
'จันทร์ 10:00 AM - 10:00 PM', itemCount: presenter.model.result[0].openHour.length,
itemBuilder: (context, i) {
return Column(children: [
SizedBox(height: 30,),
Align(
alignment: Alignment.topLeft,
child:Text(
presenter.model.result[0].storeProduct[i].product.name,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black87,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w700),
), ),),
), SizedBox(height: 30,),
Container( Row(children: [
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24), Icon(
right: SizeConfig.getPadding(24), Icons.timer,
bottom: SizeConfig.getPadding(5), color: Colors.pinkAccent,
), size: 20,
alignment: Alignment.topLeft, ),
child: Text( Text(
'อังคาร 10:00 AM - 10:00 PM',
" "+presenter.model.result[0].storeProduct[i].product.duration+" ชม.",
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black87,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w200),
), ),Spacer(),
), presenter.model.result[0].storeProduct[i].product.specialPrice==null?
Container( Text(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0), "฿"+presenter.model.result[0].storeProduct[i].product.price,
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
),
alignment: Alignment.topLeft,
child: Text(
'พุธ 10:00 AM - 10:00 PM',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.red,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w700),
), ):
), Container(child:
Container(
padding: EdgeInsets.only( Row(children: [
top: SizeConfig.getPadding(0), Icon(
left: SizeConfig.getPadding(24), Icons.local_offer,
right: SizeConfig.getPadding(24), color: Colors.pinkAccent,
bottom: SizeConfig.getPadding(5), size: 20,
), ),
alignment: Alignment.topLeft, Text(
child: Text(
'พฤหัสบดี 10:00 AM - 10:00 PM', " ฿"+presenter.model.result[0].storeProduct[i].product.price,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black54, decoration: TextDecoration.lineThrough,
fontSize: SizeConfig.getFontSize(12), color: Colors.pinkAccent,
fontSize: SizeConfig.getFontSize(14),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w700),
), ),
Text(
" ฿"+presenter.model.result[0].storeProduct[i].product.specialPrice,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.red,
fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
)
],)
)
]),
SizedBox(height: 20,),
Padding(
padding: EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 0.0),
child: Material( //Wrap with Material
shape: RoundedRectangleBorder(borderRadius:BorderRadius.circular(30.0) ),
elevation: 0.0,
color: Color.fromRGBO(106, 179, 170, 1),
clipBehavior: Clip.antiAlias, // Add This
child: MaterialButton(
minWidth:MediaQuery.of(context).size.width - 50,
height: 55,
color: Color(0xff3694A3),
child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.shopping_cart,
color: Colors.white,
size: 25,
),
new Text(' หยิบใส่รถเข็น',
style: new TextStyle(fontSize: 16.0, color: Colors.white)),
],),
onPressed: () {
print(" Go to cart");
},
), ),
),
),
SizedBox(height: 30,),
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(0), left: SizeConfig.getPadding(20),
left: SizeConfig.getPadding(24), right: SizeConfig.getPadding(20),
right: SizeConfig.getPadding(24), top: SizeConfig.getPadding(40),
bottom: SizeConfig.getPadding(5), bottom: SizeConfig.getPadding(20),
), ),
alignment: Alignment.topLeft, height: SizeConfig.getHeight(1),
child: Text( width: MediaQuery.of(context).size.width - 40,
'ศุกร์ 10:00 AM - 10:00 PM', color: Colors.grey,
textAlign: TextAlign.left, )
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text", ],);
fontWeight: FontWeight.w500),
},
),
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(20),
right: SizeConfig.getPadding(20),
top: SizeConfig.getPadding(40),
bottom: SizeConfig.getPadding(20),
), ),
height: SizeConfig.getHeight(1),
width: MediaQuery.of(context).size.width - 40,
color: Colors.grey,
), ),
],
);
}
_dayOpen() {
return Column(
children: <Widget>[
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(0), top: SizeConfig.getPadding(15),
left: SizeConfig.getPadding(24), left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24), right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5), bottom: SizeConfig.getPadding(5),
), ),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'เสาร์ 10:00 AM - 10:00 PM', 'วันเปิดปิดทำการ',
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black87,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w700),
), ),
), ),
Container( Container(
height: 200,
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(0), top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24), left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24), right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(20), bottom: SizeConfig.getPadding(5),
), ),
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child:ListView.builder(
'อาทิตย์ 10:00 AM - 10:00 PM', itemCount: presenter.model.result[0].openHour.length,
itemBuilder: (context, i) {
return
Text(
"${presenter.model.result[0].openHour[i].name} ${presenter.model.result[0].openHour[i].open} - ${presenter.model.result[0].openHour[i].closed} ",
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
),
);
},
), ),
),
Container( Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: SizeConfig.getPadding(20), left: SizeConfig.getPadding(20),
......
...@@ -4,6 +4,7 @@ import 'package:feelverapp/service/api.dart'; ...@@ -4,6 +4,7 @@ import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/service/base_presenter.dart'; import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/shop/shop_list_detail.dart'; import 'package:feelverapp/ui/shop/shop_list_detail.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
...@@ -32,4 +33,13 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{ ...@@ -32,4 +33,13 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
print('res Fail'); print('res Fail');
} }
} }
gotoDirection(String lat,String lng){
print("debug");
print(lat);
print(lng);
launch('https://www.google.com/maps/dir/?api=1&destination=${lat},${lng}');
}
} }
\ No newline at end of file
...@@ -15,6 +15,20 @@ packages: ...@@ -15,6 +15,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
carousel_pro:
dependency: "direct main"
description:
name: carousel_pro
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
carousel_slider:
dependency: "direct main"
description:
name: carousel_slider
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
characters: characters:
dependency: transitive dependency: transitive
description: description:
......
...@@ -19,12 +19,13 @@ environment: ...@@ -19,12 +19,13 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2 cupertino_icons: ^0.1.2
flutter_screenutil: ^1.0.2 flutter_screenutil: ^1.0.2
http: ^0.12.0+4 http: ^0.12.0+4
carousel_pro: ^1.0.0
image_cropper: ^1.2.3 image_cropper: ^1.2.3
image_picker: ^0.6.7+4 image_picker: ^0.6.7+4
json_annotation: ^3.0.1 json_annotation: ^3.0.1
...@@ -35,6 +36,8 @@ dependencies: ...@@ -35,6 +36,8 @@ dependencies:
url_launcher: ^5.4.2 url_launcher: ^5.4.2
date_format: ^1.0.8 date_format: ^1.0.8
flutter_datetime_picker: ^1.4.0 flutter_datetime_picker: ^1.4.0
carousel_slider: ^2.2.1
dev_dependencies: dev_dependencies:
......
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