update shop detail

parent 04764f68
class shoplistdetailModel {
class shoplistdetailModel
{
List<Result> result;
shoplistdetailModel({this.result});
......@@ -51,7 +53,7 @@ class Result {
List<Comment> comment;
List<dynamic> commentReview;
List<OpenHour> openHour;
List<dynamic> image;
List<Image2> image;
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});
......@@ -586,6 +588,37 @@ class InfoCustomer {
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 {
int id;
......@@ -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 {
int id;
int ratingId;
......@@ -722,4 +811,6 @@ class RatingScore {
data['customer_id'] = this.customerId;
return data;
}
}
import 'package:carousel_pro/carousel_pro.dart';
import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/ui/home/home.dart';
import 'package:feelverapp/ui/menu/menu.dart';
......@@ -24,6 +25,8 @@ class _ShopListDetailState extends State<ShopListDetail> {
presenter = ShoplistdetailPresenter(this);
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> {
'assets/images/feelver_banner.png',
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(
......@@ -92,14 +101,37 @@ class _ShopListDetailState extends State<ShopListDetail> {
],
),
Container(
height: SizeConfig.getHeight(270),
height: SizeConfig.getHeight(240),
child: Stack(
children: <Widget>[
Image.network(
presenter.model.result[0].storeCover,
height: SizeConfig.getWidth(190),
width: SizeConfig.getWidth(350),
fit: BoxFit.cover,
Container(
height: SizeConfig.getHeight(190),
width: SizeConfig.getHeight(350),
child: Carousel(
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(
right: SizeConfig.getPadding(16),
......@@ -122,15 +154,26 @@ class _ShopListDetailState extends State<ShopListDetail> {
Positioned(
left: SizeConfig.getPadding(75),
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(
presenter.model.result[0].storeName,
"นำทาง",
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(16),
decoration: TextDecoration.underline,
color: Colors.grey,
fontSize: SizeConfig.getFontSize(13),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
),)
),
],
),
......@@ -144,7 +187,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
alignment: Alignment.topLeft,
child: Text(
'ข้อมูลติดต่อ',
presenter.model.result[0].storeName,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
......@@ -234,12 +277,14 @@ class _ShopListDetailState extends State<ShopListDetail> {
height: SizeConfig.getHeight(20),
),
_detail(),
_servicelist(),
],
),
);
}
_dayOpen() {
_servicelist() {
return Column(
children: <Widget>[
Container(
......@@ -251,7 +296,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
alignment: Alignment.topLeft,
child: Text(
'วันเปิดปิดทำการ',
'บริการ',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
......@@ -260,7 +305,10 @@ class _ShopListDetailState extends State<ShopListDetail> {
fontWeight: FontWeight.w700),
),
),
Container(
height: 600,
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24),
......@@ -268,124 +316,218 @@ class _ShopListDetailState extends State<ShopListDetail> {
bottom: SizeConfig.getPadding(5),
),
alignment: Alignment.topLeft,
child: Text(
'จันทร์ 10:00 AM - 10:00 PM',
child:ListView.builder(
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,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
color: Colors.black87,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
),
Container(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
fontWeight: FontWeight.w700),
),),
SizedBox(height: 30,),
Row(children: [
Icon(
Icons.timer,
color: Colors.pinkAccent,
size: 20,
),
alignment: Alignment.topLeft,
child: Text(
'อังคาร 10:00 AM - 10:00 PM',
Text(
" "+presenter.model.result[0].storeProduct[i].product.duration+" ชม.",
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
color: Colors.black87,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
fontWeight: FontWeight.w200),
),Spacer(),
presenter.model.result[0].storeProduct[i].product.specialPrice==null?
Text(
"฿"+presenter.model.result[0].storeProduct[i].product.price,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.red,
fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
):
Container(child:
Row(children: [
Icon(
Icons.local_offer,
color: Colors.pinkAccent,
size: 20,
),
Container(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
Text(
" ฿"+presenter.model.result[0].storeProduct[i].product.price,
textAlign: TextAlign.left,
style: TextStyle(
decoration: TextDecoration.lineThrough,
color: Colors.pinkAccent,
fontSize: SizeConfig.getFontSize(14),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
alignment: Alignment.topLeft,
child: Text(
'พุธ 10:00 AM - 10:00 PM',
Text(
" ฿"+presenter.model.result[0].storeProduct[i].product.specialPrice,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
color: Colors.red,
fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
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(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
left: SizeConfig.getPadding(20),
right: SizeConfig.getPadding(20),
top: SizeConfig.getPadding(40),
bottom: SizeConfig.getPadding(20),
),
alignment: Alignment.topLeft,
child: Text(
'พฤหัสบดี 10:00 AM - 10:00 PM',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
height: SizeConfig.getHeight(1),
width: MediaQuery.of(context).size.width - 40,
color: Colors.grey,
)
],);
},
),
),
Container(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
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,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
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(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
top: SizeConfig.getPadding(15),
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,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
color: Colors.black87,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
fontWeight: FontWeight.w700),
),
),
Container(
height: 200,
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(20),
bottom: SizeConfig.getPadding(5),
),
alignment: Alignment.topLeft,
child: Text(
'อาทิตย์ 10:00 AM - 10:00 PM',
child:ListView.builder(
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,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
);
},
),
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(20),
......
......@@ -4,6 +4,7 @@ import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/shop/shop_list_detail.dart';
import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
......@@ -32,4 +33,13 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
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:
url: "https://pub.dartlang.org"
source: hosted
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:
dependency: transitive
description:
......
......@@ -25,6 +25,7 @@ dependencies:
cupertino_icons: ^0.1.2
flutter_screenutil: ^1.0.2
http: ^0.12.0+4
carousel_pro: ^1.0.0
image_cropper: ^1.2.3
image_picker: ^0.6.7+4
json_annotation: ^3.0.1
......@@ -35,6 +36,8 @@ dependencies:
url_launcher: ^5.4.2
date_format: ^1.0.8
flutter_datetime_picker: ^1.4.0
carousel_slider: ^2.2.1
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