Commit f304d419 by Mobile : Ball (Apprentice)

Merge branch 'develop' of https://gitlab.2fellows.com/art/feelver into develop

parents 1e0bb6fc 9e266a4a
......@@ -15,6 +15,7 @@ import 'package:feelverapp/ui/splashscreen/splash_screen_page.dart';
import 'package:flutter/material.dart';
import 'ui/edit_profile/edit_profile.dart';
import 'ui/shop/shop_main.dart';
void main() => runApp(MyApp());
......@@ -33,7 +34,8 @@ class MyApp extends StatelessWidget {
),
home: SplashScreenPage()
home: MainShop()
......
class BookingDetailModel {
class ProductModel {
bool status;
Results results;
BookingDetailModel({this.status, this.results});
ProductModel({this.status, this.results});
BookingDetailModel.fromJson(Map<String, dynamic> json) {
ProductModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
results =
json['results'] != null ? new Results.fromJson(json['results']) : null;
......@@ -21,6 +21,74 @@ class BookingDetailModel {
}
class Results {
int currentPage;
List<Data> data;
String firstPageUrl;
int from;
int lastPage;
String lastPageUrl;
String nextPageUrl;
String path;
int perPage;
Null prevPageUrl;
int to;
int total;
Results(
{this.currentPage,
this.data,
this.firstPageUrl,
this.from,
this.lastPage,
this.lastPageUrl,
this.nextPageUrl,
this.path,
this.perPage,
this.prevPageUrl,
this.to,
this.total});
Results.fromJson(Map<String, dynamic> json) {
currentPage = json['current_page'];
if (json['data'] != null) {
data = new List<Data>();
json['data'].forEach((v) {
data.add(new Data.fromJson(v));
});
}
firstPageUrl = json['first_page_url'];
from = json['from'];
lastPage = json['last_page'];
lastPageUrl = json['last_page_url'];
nextPageUrl = json['next_page_url'];
path = json['path'];
perPage = json['per_page'];
prevPageUrl = json['prev_page_url'];
to = json['to'];
total = json['total'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['current_page'] = this.currentPage;
if (this.data != null) {
data['data'] = this.data.map((v) => v.toJson()).toList();
}
data['first_page_url'] = this.firstPageUrl;
data['from'] = this.from;
data['last_page'] = this.lastPage;
data['last_page_url'] = this.lastPageUrl;
data['next_page_url'] = this.nextPageUrl;
data['path'] = this.path;
data['per_page'] = this.perPage;
data['prev_page_url'] = this.prevPageUrl;
data['to'] = this.to;
data['total'] = this.total;
return data;
}
}
class Data {
int id;
String urlCode;
String name;
......@@ -31,7 +99,7 @@ class Results {
String specialPrice;
String sku;
Null tax;
int quantity;
Null quantity;
Null weight;
String visibility;
Null newsFromDate;
......@@ -54,7 +122,7 @@ class Results {
String crossSellsStatus;
String allowGiftMessage;
String stockStatus;
int status;
String status;
int businessTypeId;
int businessCateId;
int businessServiceId;
......@@ -62,30 +130,14 @@ class Results {
int vendorId;
String allowRoute;
String type;
List<Null> promotions;
int star;
List<StoresByVendorId> storesByVendorId;
List<Null> images;
List<CategoryByProductId> categoryByProductId;
List<Null> ratings;
List<Null> comments;
List<Null> commentReview;
int storeProductId;
String typeRateService;
String priceRateService;
int productId;
int storeId;
String storeCode;
String storeName;
String location;
int storeStatus;
int vendorStatus;
String latitude;
String longitude;
Null popular;
List<Null> promotions;
List<Null> wishList;
List<Null> vendorRoute;
Results(
Data(
{this.id,
this.urlCode,
this.name,
......@@ -127,30 +179,14 @@ class Results {
this.vendorId,
this.allowRoute,
this.type,
this.promotions,
this.star,
this.storesByVendorId,
this.images,
this.categoryByProductId,
this.ratings,
this.comments,
this.commentReview,
this.storeProductId,
this.typeRateService,
this.priceRateService,
this.productId,
this.storeId,
this.storeCode,
this.storeName,
this.location,
this.storeStatus,
this.vendorStatus,
this.latitude,
this.longitude,
this.popular,
this.promotions,
this.wishList});
this.vendorRoute});
Results.fromJson(Map<String, dynamic> json) {
Data.fromJson(Map<String, dynamic> json) {
id = json['id'];
urlCode = json['url_code'];
name = json['name'];
......@@ -192,19 +228,13 @@ class Results {
vendorId = json['vendor_id'];
allowRoute = json['allow_route'];
type = json['type'];
star = json['star'];
if (json['stores_by_vendor_id'] != null) {
storesByVendorId = new List<StoresByVendorId>();
json['stores_by_vendor_id'].forEach((v) {
storesByVendorId.add(new StoresByVendorId.fromJson(v));
});
}
// if (json['images'] != null) {
// images = new List<Null>();
// json['images'].forEach((v) {
// images.add(new Null.fromJson(v));
// if (json['promotions'] != null) {
// promotions = new List<Null>();
// json['promotions'].forEach((v) {
// promotions.add(new Null.fromJson(v));
// });
// }
star = json['star'];
if (json['category_by_product_id'] != null) {
categoryByProductId = new List<CategoryByProductId>();
json['category_by_product_id'].forEach((v) {
......@@ -223,35 +253,10 @@ class Results {
// comments.add(new Null.fromJson(v));
// });
// }
// if (json['comment_review'] != null) {
// commentReview = new List<Null>();
// json['comment_review'].forEach((v) {
// commentReview.add(new Null.fromJson(v));
// });
// }
storeProductId = json['store_product_id'];
typeRateService = json['type_rate_service'];
priceRateService = json['price_rate_service'];
productId = json['product_id'];
storeId = json['store_id'];
storeCode = json['store_code'];
storeName = json['store_name'];
location = json['location'];
storeStatus = json['store_status'];
vendorStatus = json['vendor_status'];
latitude = json['latitude'];
longitude = json['longitude'];
popular = json['popular'];
// if (json['promotions'] != null) {
// promotions = new List<Null>();
// json['promotions'].forEach((v) {
// promotions.add(new Null.fromJson(v));
// });
// }
// if (json['wishList'] != null) {
// wishList = new List<Null>();
// json['wishList'].forEach((v) {
// wishList.add(new Null.fromJson(v));
// if (json['vendor_route'] != null) {
// vendorRoute = new List<Null>();
// json['vendor_route'].forEach((v) {
// vendorRoute.add(new Null.fromJson(v));
// });
// }
}
......@@ -299,295 +304,30 @@ class Results {
data['vendor_id'] = this.vendorId;
data['allow_route'] = this.allowRoute;
data['type'] = this.type;
// if (this.promotions != null) {
// data['promotions'] = this.promotions.map((v) => v.toJson()).toList();
// }
data['star'] = this.star;
if (this.storesByVendorId != null) {
data['stores_by_vendor_id'] =
this.storesByVendorId.map((v) => v.toJson()).toList();
if (this.categoryByProductId != null) {
data['category_by_product_id'] =
this.categoryByProductId.map((v) => v.toJson()).toList();
}
// if (this.images != null) {
// data['images'] = this.images.map((v) => v.toJson()).toList();
// }
// if (this.categoryByProductId != null) {
// data['category_by_product_id'] =
// this.categoryByProductId.map((v) => v.toJson()).toList();
// }
// if (this.ratings != null) {
// data['ratings'] = this.ratings.map((v) => v.toJson()).toList();
// }
// if (this.comments != null) {
// data['comments'] = this.comments.map((v) => v.toJson()).toList();
// }
// if (this.commentReview != null) {
// data['comment_review'] =
// this.commentReview.map((v) => v.toJson()).toList();
// if (this.vendorRoute != null) {
// data['vendor_route'] = this.vendorRoute.map((v) => v.toJson()).toList();
// }
data['store_product_id'] = this.storeProductId;
data['type_rate_service'] = this.typeRateService;
data['price_rate_service'] = this.priceRateService;
data['product_id'] = this.productId;
data['store_id'] = this.storeId;
data['store_code'] = this.storeCode;
data['store_name'] = this.storeName;
data['location'] = this.location;
data['store_status'] = this.storeStatus;
data['vendor_status'] = this.vendorStatus;
data['latitude'] = this.latitude;
data['longitude'] = this.longitude;
data['popular'] = this.popular;
// if (this.promotions != null) {
// data['promotions'] = this.promotions.map((v) => v.toJson()).toList();
// }
// if (this.wishList != null) {
// data['wishList'] = this.wishList.map((v) => v.toJson()).toList();
// }
return data;
}
}
class StoresByVendorId {
int id;
String storeCode;
String storeName;
String storeCover;
String displayCover;
String isActive;
int storeOrder;
int customerGroupId;
int vendorId;
Null createdAt;
String updatedAt;
String location;
String email;
String phone;
String mobile;
String address;
String city;
String country;
String zipCode;
String website;
String allowRoute;
String excerpt;
String detail;
String storeLogo;
String isFacilities;
String distanceWithLocation;
String star;
Ratings ratings;
StoresByVendorId(
{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.ratings});
StoresByVendorId.fromJson(Map<String, dynamic> json) {
id = json['id'];
storeCode = json['store_code'];
storeName = json['store_name'];
storeCover = json['store_cover'];
displayCover = json['display_cover'];
isActive = json['is_active'];
storeOrder = json['store_order'];
customerGroupId = json['customer_group_id'];
vendorId = json['vendor_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
location = json['location'];
email = json['email'];
phone = json['phone'];
mobile = json['mobile'];
address = json['address'];
city = json['city'];
country = json['country'];
zipCode = json['zip_code'];
website = json['website'];
allowRoute = json['allow_route'];
excerpt = json['excerpt'];
detail = json['detail'];
storeLogo = json['store_logo'];
isFacilities = json['is_facilities'];
distanceWithLocation = json['distance_with_location'];
star = json['star'];
ratings =
json['ratings'] != null ? new Ratings.fromJson(json['ratings']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['store_code'] = this.storeCode;
data['store_name'] = this.storeName;
data['store_cover'] = this.storeCover;
data['display_cover'] = this.displayCover;
data['is_active'] = this.isActive;
data['store_order'] = this.storeOrder;
data['customer_group_id'] = this.customerGroupId;
data['vendor_id'] = this.vendorId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['location'] = this.location;
data['email'] = this.email;
data['phone'] = this.phone;
data['mobile'] = this.mobile;
data['address'] = this.address;
data['city'] = this.city;
data['country'] = this.country;
data['zip_code'] = this.zipCode;
data['website'] = this.website;
data['allow_route'] = this.allowRoute;
data['excerpt'] = this.excerpt;
data['detail'] = this.detail;
data['store_logo'] = this.storeLogo;
data['is_facilities'] = this.isFacilities;
data['distance_with_location'] = this.distanceWithLocation;
data['star'] = this.star;
if (this.ratings != null) {
data['ratings'] = this.ratings.toJson();
}
return data;
}
}
class Ratings {
int id;
String title;
String rateType;
String rateCate;
String rateTb;
int rateRowId;
String isCustom;
Null customScore;
int rateRange;
int storeId;
int vendorId;
String createdAt;
String updatedAt;
List<RatingScore> ratingScore;
Ratings(
{this.id,
this.title,
this.rateType,
this.rateCate,
this.rateTb,
this.rateRowId,
this.isCustom,
this.customScore,
this.rateRange,
this.storeId,
this.vendorId,
this.createdAt,
this.updatedAt,
this.ratingScore});
Ratings.fromJson(Map<String, dynamic> json) {
id = json['id'];
title = json['title'];
rateType = json['rate_type'];
rateCate = json['rate_cate'];
rateTb = json['rate_tb'];
rateRowId = json['rate_row_id'];
isCustom = json['is_custom'];
customScore = json['custom_score'];
rateRange = json['rate_range'];
storeId = json['store_id'];
vendorId = json['vendor_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
if (json['rating_score'] != null) {
ratingScore = new List<RatingScore>();
json['rating_score'].forEach((v) {
ratingScore.add(new RatingScore.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['title'] = this.title;
data['rate_type'] = this.rateType;
data['rate_cate'] = this.rateCate;
data['rate_tb'] = this.rateTb;
data['rate_row_id'] = this.rateRowId;
data['is_custom'] = this.isCustom;
data['custom_score'] = this.customScore;
data['rate_range'] = this.rateRange;
data['store_id'] = this.storeId;
data['vendor_id'] = this.vendorId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
if (this.ratingScore != null) {
data['rating_score'] = this.ratingScore.map((v) => v.toJson()).toList();
}
return data;
}
}
class RatingScore {
int id;
int ratingId;
String ratingScore;
String createdAt;
String updatedAt;
int customerId;
RatingScore(
{this.id,
this.ratingId,
this.ratingScore,
this.createdAt,
this.updatedAt,
this.customerId});
RatingScore.fromJson(Map<String, dynamic> json) {
id = json['id'];
ratingId = json['rating_id'];
ratingScore = json['rating_score'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
customerId = json['customer_id'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['rating_id'] = this.ratingId;
data['rating_score'] = this.ratingScore;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['customer_id'] = this.customerId;
return data;
}
}
class CategoryByProductId {
int id;
Null parentId;
int parentId;
String name;
String code;
String displayName;
......
class AddfavModel {
String message;
AddfavModel({this.message});
AddfavModel.fromJson(Map<String, dynamic> json) {
message = json['message'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['message'] = this.message;
return data;
}
}
......@@ -5,6 +5,7 @@ import 'package:feelverapp/model/Login/login_model.dart';
import 'package:feelverapp/model/base/base.dart';
import 'package:feelverapp/model/editprofile/getprofilemodel.dart';
import 'package:feelverapp/model/favorite/addfav_model.dart';
import 'package:feelverapp/model/favorite/delete_favorite_Model.dart';
import 'package:feelverapp/model/favorite/favorite_Model.dart';
......@@ -23,6 +24,8 @@ import 'package:feelverapp/model/shoplistdetail/shoplistdetail_Model.dart';
import 'package:feelverapp/model/shopservice/shop_service_Model.dart';
import 'package:http/http.dart' as http;
import '../model/booking_detail/booking_detail_model.dart';
class Api<T> {
final String _baseApi = "https://backend-uat.feelver.com/api";
......@@ -35,6 +38,9 @@ class Api<T> {
static final String baseApi = "https://backend-uat.feelver.com/api";
<<<<<<< HEAD
static final String baseApiforimage = "https://backend.feelver.com/storage/";
=======
static final String baseApiforimage = "https://backend-uat.feelver.com/api/storage/";
......@@ -56,6 +62,7 @@ class Api<T> {
});
return result;
}
>>>>>>> baadf91b2b909230e56f29edefbed7cfd2f5e949
Future<Response<T>> deletefavorite(Object body) async {
......@@ -188,11 +195,35 @@ class Api<T> {
result = new Response<T>(_model, _fail);
});
return result;
// await _httpConnection(
// "${this._baseApi}product/getListsStoreFormat", this._headerApi, body)
}
Future<Response<T>> getProductDetail(Object body) async{
var _model;
var _fail;
var result;
print("this is body " + body.toString());
// (body as Map)['lang'] = allTranslations.currentLanguage;
await http.get(Uri.encodeFull("https://backend.feelver.com/api/portal/product/?id=5"), headers: this._headerApi ).then((response) {
print("ผลลัพ เท่ากับบบบ2 " + "${response.body}");
print("statusCode=${response.statusCode}");
if (response.statusCode == 200) {
print("INif");
_model = ProductModel.fromJson(json.decode(response.body));
} else {
_fail = FailModel.fromJson(json.decode(response.body));
}
print("return");
result = new Response<T>(_model, _fail);
});
return result;
}
Future<Response<T>> editProfile(Object body) async {
var _model;
var _fail;
......@@ -337,6 +368,28 @@ class Api<T> {
return result;
}
Future<Response<T>> addfav(Object body) async {
var _model;
var _fail;
var result;
await _httpConnection(
"${this._baseApi}/wish-list/add", this._headerApi, body)
.then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}");
if (response.statusCode == 200) {
_model = AddfavModel.fromJson(json.decode(response.body));
} else {
_fail = FailModel.fromJson(json.decode(response.body));
}
result = new Response<T>(_model, _fail);
});
return result;
}
///api environment
Future<http.Response> _httpConnection(
String url, Map<String, String> headers, Object body) async {
......
import 'package:feelverapp/ui/booking/booking_detail_presenter.dart';
import 'package:feelverapp/ui/booking/bookingform.dart';
import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:feelverapp/util/Util.dart';
import '../splashscreen/splash_screen_page.dart';
class BookingDetail extends StatefulWidget {
int getid;
BookingDetail(
{Key key,
this.getid})
: super(key: key);
@override
_BookingDetailState createState() => _BookingDetailState();
}
class _BookingDetailState extends State<BookingDetail> {
BookingDetailtPresenter presenter;
@override
void initState() {
super.initState();
// widget.getid = 55;
// print(widget.getid);
presenter = BookingDetailtPresenter(this);
setState(() {
presenter.getid = widget.getid;
});
presenter.getDetail();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
return ListView(padding: EdgeInsets.all(0), children: <Widget>[
_setupView(),
]);
return presenter.getmodel == null
? Container(
child: Center(
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(Colors.teal),
),
),
)
: Container(
child: ListView(
padding: EdgeInsets.all(0),
children: <Widget>[
_setupView(),
],
),
);
}
_setupView() {
......@@ -22,46 +67,84 @@ class _BookingDetailState extends State<BookingDetail> {
children: <Widget>[
Stack(
children: <Widget>[
Image.network(
'https://www.cancurreu.com/wp-content/uploads/can_curreu_hotel_ibiza_spa_tratamientos.jpg',
width: MediaQuery.of(context).size.width,
height: SizeConfig.getHeight(450),
fit: BoxFit.cover,
),
presenter.getmodel.results.data[0].cover == null
? Image.asset(
'assets/images/demo_img.png',
width: SizeConfig.getWidth(110),
height: SizeConfig.getHeight(150),
fit: BoxFit.fitWidth,
)
: Image.network(
presenter.getmodel.results.data[0].cover,
width: MediaQuery.of(context).size.width,
height: SizeConfig.getHeight(450),
fit: BoxFit.cover,
),
],
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
'4 ธ.ค. 2561 18:55 น.',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(3),
bottom: SizeConfig.getPadding(8)),
alignment: Alignment.topLeft,
child: Text(
'Thai Body',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(26),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
),
presenter.getmodel.results.data[0].duration == null
? Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
'',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
)
: Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
presenter.getmodel.results.data[0].duration,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
),
presenter.getmodel.results.data[0].name == null
? Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
'-',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
)
: Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(8),
bottom: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
presenter.getmodel.results.data[0].name,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(26),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
),
Row(
children: <Widget>[
SizedBox(
......@@ -144,25 +227,39 @@ class _BookingDetailState extends State<BookingDetail> {
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
),
),
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.only(
top: SizeConfig.getPadding(14),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24)),
child: Text(
'A four hand massage performed by two therapists in unison, this experience coordinates a blend of Thai, Swedish, Shiatsu and Reflexology techniques using deep rhythmic movement to leave you feeling completely renewed. Top Tip: This is Khun Taras (our Group Spa Director) favourite massage. She loves it because having the sensation of two therapists working on you means your mind cant concentrate on one area and it basically just gives up! This massage almost forces you to switch your mind off. Try it and see.',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(14),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
),
presenter.getmodel.results.data[0].detail == null
? Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
'',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
)
: Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
top: SizeConfig.getPadding(16)),
alignment: Alignment.topLeft,
child: Text(
Util.removeHTMLTag(
'${presenter.getmodel.results.data[0].detail}'),
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black54,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
),
Container(
alignment: Alignment.topLeft,
padding: EdgeInsets.only(
......@@ -284,7 +381,7 @@ class _BookingDetailState extends State<BookingDetail> {
height: SizeConfig.getHeight(45),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(24),
color:Color.fromRGBO(69, 85, 79, 1),
color: Color.fromRGBO(69, 85, 79, 1),
),
child: Container(
padding: EdgeInsets.only(top: SizeConfig.getPadding(6)),
......@@ -299,12 +396,8 @@ class _BookingDetailState extends State<BookingDetail> {
),
),
),
],
),
SizedBox(
height: SizeConfig.getHeight(30),
),
......
import 'package:feelverapp/model/nearme/nearme_list_model.dart';
import 'package:feelverapp/service/Loading.dart';
import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/home/home.dart';
import 'package:feelverapp/util/Accout_util.dart';
import 'package:flutter/material.dart';
import 'package:rflutter_alert/rflutter_alert.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:feelverapp/ui/booking/booking_detail.dart';
import '../../model/booking_detail/booking_detail_model.dart';
class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
final formkey = GlobalKey<FormState>();
Api _api;
String type = '3';
int getid;
ProductModel getmodel;
BookingDetailtPresenter(State<BookingDetail> state) : super(state);
getDetail() async {
print(getid);
_api = Api<ProductModel>();
var res = await _api.getProductDetail({getid});
if (res.fail == null) {
if (res.success.status) {
setState(
() {
print("AAAA :${res.success}");
getmodel = res.success;
// print(getmodel.results.data.length);
// print("getmodel" + getmodel[0].results.data[0].storeName);
},
);
}
} else {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: "ไม่พบข้อมูล",
content: Icon(
Icons.warning,
color: Colors.orange,
size: 80,
),
buttons: [
DialogButton(
color: Color.fromRGBO(106, 179, 170, 1),
onPressed: () => Navigator.pop(state.context),
child: Text(
"ลองอีกครั้ง",
style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
}
}
// getnearme() async {
// _api = Api<NearMeListModel>();
//
// var res = await _api.getNearList({});
// print("Hii" + getmodel[0].storeName);
// print("Hii2" + res.success);
//
// if (res.fail == null) {
// setState(() {
// NearMeListModel model = res.success;
//
//// getmodel = res.success
// }
// );
// } else {
// Alert(
// style: AlertStyle(
// animationType: AnimationType.fromTop,
// isCloseButton: false,
// ),
// context: state.context,
// title: "ไม่สามารถติดต่อ\nเซิร์ฟเวอร์ได้",
// content: Icon(
// Icons.warning,
// color: Colors.orange,
// size: 80,
// ),
// buttons: [
// DialogButton(
// color: Color.fromRGBO(106, 179, 170, 1),
// onPressed: () => Navigator.pop(state.context),
// child: Text(
// "ลองอีกครั้ง",
// style: TextStyle(color: Colors.white, fontSize: 20),
// ),
// )
// ]).show();
// }
// }
}
......@@ -8,15 +8,23 @@ import 'package:feelverapp/util/Util.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../splashscreen/splash_screen_page.dart';
import 'shop_list_detail.dart';
class ShopNearbyPlacesPage extends StatefulWidget {
@override
_ShopNearbyPlacesPageState createState() => _ShopNearbyPlacesPageState();
}
final List<String> detail = <String>['SPA Cenvaree @ centara Grand Centralworld', 'SPA Cenvaree @ centara Grand Centralworld', 'SPA Cenvaree @ centara Grand Centralworld'];
final List<String> detail = <String>[
'SPA Cenvaree @ centara Grand Centralworld',
'SPA Cenvaree @ centara Grand Centralworld',
'SPA Cenvaree @ centara Grand Centralworld'
];
final List<String> place = <String>['พญาไทย', 'บางเขน', 'เกษตร'];
class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerProviderStateMixin {
class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>
with TickerProviderStateMixin {
ShopNearByPlacePresenter presenter;
@override
......@@ -31,6 +39,7 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
SizeConfig(context);
......@@ -44,11 +53,10 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
Container(
// color: Colors.blue,
padding: EdgeInsets.only(
top: SizeConfig.getPadding(15),
bottom: SizeConfig.getPadding(10),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24)
),
top: SizeConfig.getPadding(15),
bottom: SizeConfig.getPadding(10),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24)),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
......@@ -105,7 +113,7 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
backgroundColor:Color.fromRGBO(69, 85, 79, 1),
backgroundColor: Color.fromRGBO(69, 85, 79, 1),
shape: StadiumBorder(
side: BorderSide(color: Colors.white),
),
......@@ -122,7 +130,7 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
backgroundColor:Color.fromRGBO(69, 85, 79, 1),
backgroundColor: Color.fromRGBO(69, 85, 79, 1),
shape: StadiumBorder(
side: BorderSide(color: Colors.white),
),
......@@ -164,7 +172,6 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
print("selected");
},
),
],
),
),
......@@ -179,42 +186,53 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
print(presenter.getmodel);
return presenter.getmodel == null
? Container(
child: Center(
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(Colors.teal),
)))
child: Center(
child: CircularProgressIndicator(
valueColor: new AlwaysStoppedAnimation<Color>(Colors.teal),
)))
: Container(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(80),
left: SizeConfig.getPadding(16),
right: SizeConfig.getPadding(16),
bottom: SizeConfig.getPadding(10),
),
child: ListView.builder(
itemCount: presenter.getmodel.results.data.length,
itemBuilder: (context, i) {
return _nearByItem(
presenter.getmodel.results.data[i].storeName,
presenter.getmodel.results.data[i].detail,
presenter.getmodel.results.data[i].storeLogo,
presenter.getmodel.results.data[i].address,
presenter.getmodel.results.data[i].location,
presenter.getmodel.results.data[i].updatedAt,
presenter.getmodel.results.data[i].distanceWithLocation
.toString());
}
),
);
padding: EdgeInsets.only(
top: SizeConfig.getPadding(80),
left: SizeConfig.getPadding(16),
right: SizeConfig.getPadding(16),
bottom: SizeConfig.getPadding(10),
),
child: ListView.builder(
itemCount: presenter.getmodel.results.data.length,
itemBuilder: (context, i) {
return _nearByItem(
presenter.getmodel.results.data[i].storeName,
presenter.getmodel.results.data[i].detail,
presenter.getmodel.results.data[i].storeLogo,
presenter.getmodel.results.data[i].address,
presenter.getmodel.results.data[i].location,
presenter.getmodel.results.data[i].updatedAt,
presenter.getmodel.results.data[i].distanceWithLocation
.toString());
}),
);
}
Widget _nearByItem(String title, String detail, String img, String address,
String latlng, String date_time, String distanceWithLocation) {
return Card(
return InkWell(
onTap: () {
setState(() {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => ShopListDetail(
// id: id,
),
),
);
});
},
child: Card(
margin: EdgeInsets.only(
right: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(0),
top: SizeConfig.getPadding(10),
top: SizeConfig.getPadding(50),
bottom: SizeConfig.getPadding(10)),
child: Container(
// color: Colors.red,
......@@ -231,13 +249,14 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
height: SizeConfig.getHeight(250),
child: presenter.getmodel == null
? Image.asset(
"assets/images/demo_img.png",
fit: BoxFit.cover,
)
"assets/images/demo_img.png",
fit: BoxFit.cover,
)
: Image.network(
Api.baseApiforimage + img,
fit: BoxFit.cover,
),),
Api.baseApiforimage + img,
fit: BoxFit.cover,
),
),
),
Expanded(
flex: 5,
......@@ -316,18 +335,14 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
SizedBox(
width: 5,
),
],
),
SizedBox(
height: 10,
),
SizedBox(
height: SizeConfig.getHeight(5),
),
],
),
),
......@@ -340,7 +355,7 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage>with TickerP
],
),
),
);
),
);
}
}
......@@ -2,7 +2,6 @@ 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';
import 'package:feelverapp/ui/review_shop/review_shop_page.dart';
import 'package:feelverapp/ui/shop/shoplistdetail_presenter.dart';
import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/cupertino.dart';
......@@ -25,6 +24,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
print(widget.id);
presenter = ShoplistdetailPresenter(this);
presenter.Detai(widget.id);
presenter.getid();
// List values = presenter.model.result[0].location.split(","); // split() will split from . and gives new List with separated elements.
//values.forEach(print);
......@@ -47,7 +47,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
),),
): _setupView(),
);
}
......@@ -95,10 +95,10 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
),
),
),
],
),
Container(
......@@ -109,10 +109,10 @@ class _ShopListDetailState extends State<ShopListDetail> {
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,),
......@@ -143,32 +143,23 @@ class _ShopListDetailState extends State<ShopListDetail> {
focusColor:Color(0xFFDD175F),
splashColor: Color(0xFFDD175F),
onTap: () {
print("add fav");
setState(() {
fav?fav=false:fav=true;
presenter.fav?presenter.fav=false:
presenter.Addfav(widget.id);
});
showDialog(
context: context,
builder: (context) {
Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop(true);
});
return AlertDialog(
content:ImageIcon(
AssetImage('assets/images/ic_fav_list.png'),
color:fav?Color(0xFFDD175F): Colors.grey,
size: SizeConfig.getFontSize(30),
) ,
title:Center(child: Text('บันทึกสำเร็จ')),
);
});
},
child:ImageIcon(
AssetImage('assets/images/ic_fav_list.png'),
color:fav?Color(0xFFDD175F): Colors.white,
color:presenter.fav?Color(0xFFDD175F): Colors.white,
size: SizeConfig.getFontSize(30),
),
),),
......@@ -210,7 +201,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
......@@ -258,7 +249,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
fontWeight: FontWeight.w500),
),
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(24),
......@@ -307,208 +298,206 @@ class _ShopListDetailState extends State<ShopListDetail> {
height: SizeConfig.getHeight(20),
),
_detail(),
_servicelist(),
_servicelist(),
],
),
);
}
_servicelist() {
return Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(15),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
),
alignment: Alignment.topLeft,
child: Text(
'บริการ',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
),
Container(
height: 600,
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
),
alignment: Alignment.topLeft,
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(
return Container(
presenter.model.result[0].storeProduct[i].product.name,
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),),
SizedBox(height: 30,),
Row(children: [
padding: EdgeInsets.only(left:10,right:10),
child:
Column(
children: <Widget>[
Icon(
Icons.timer,
color: Colors.pinkAccent,
size: 20,
),
Text(
" "+presenter.model.result[0].storeProduct[i].product.duration+" ชม.",
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
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,
),
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),
Container(
padding: EdgeInsets.only(
top: SizeConfig.getPadding(15),
left: SizeConfig.getPadding(24),
right: SizeConfig.getPadding(24),
bottom: SizeConfig.getPadding(5),
),
alignment: Alignment.topLeft,
child: Text(
'บริการ',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
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),
)
],)
Column(
children:
List.generate( presenter.model.result[0].openHour.length,(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.black87,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),),
SizedBox(height: 30,),
Row(children: [
)
Icon(
Icons.timer,
color: Colors.pinkAccent,
size: 20,
),
Text(
" "+presenter.model.result[0].storeProduct[i].product.duration+" ชม.",
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
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,
),
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),
),
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,
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: [
color: Color(0xff3694A3),
child:
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.shopping_cart,
color: Colors.white,
size: 25,
),
Icons.shopping_cart,
color: Colors.white,
size: 25,
),
new Text(' หยิบใส่รถเข็น',
style: new TextStyle(fontSize: 16.0, color: Colors.white)),
],),
style: new TextStyle(fontSize: 16.0, color: Colors.white)),
],),
onPressed: () {
print(" Go to cart");
},
onPressed: () {
print(" Go to cart");
},
),
),
),
),
SizedBox(height: 30,),
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,
)
SizedBox(height: 30,),
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,
)
],);
},
),
),
],);
},
),
),
Container(
padding: EdgeInsets.only(
left: SizeConfig.getPadding(20),
right: SizeConfig.getPadding(20),
top: SizeConfig.getPadding(40),
bottom: SizeConfig.getPadding(20),
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,
),
height: SizeConfig.getHeight(1),
width: MediaQuery.of(context).size.width - 40,
color: Colors.grey,
),
],
],
),
);
}
......@@ -534,7 +523,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
),
Container(
height: 200,
padding: EdgeInsets.only(
......@@ -547,7 +536,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
child:ListView.builder(
itemCount: presenter.model.result[0].openHour.length,
itemBuilder: (context, i) {
return
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,
......@@ -556,7 +545,7 @@ class _ShopListDetailState extends State<ShopListDetail> {
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
);
},
),
......@@ -601,13 +590,8 @@ class _ShopListDetailState extends State<ShopListDetail> {
),
Positioned(
right: SizeConfig.getPadding(15),
top: SizeConfig.getPadding(6),
child: FlatButton(
onPressed: (){Navigator.push(
context,
MaterialPageRoute(builder: (context) => ReviewShopPage()),
);},
child: Text(
top: SizeConfig.getPadding(20),
child: Text(
'ดูทั้งหมด',
textAlign: TextAlign.right,
style: TextStyle(
......@@ -616,7 +600,6 @@ class _ShopListDetailState extends State<ShopListDetail> {
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
),
),
Positioned(
......
......@@ -9,10 +9,14 @@ import 'package:flutter/material.dart';
import 'dart:math';
class MainShop extends StatefulWidget {
MainShop({Key key, this.title}) : super(key: key);
int getid;
MainShop({Key key, this.title,this.getid}) : super(key: key);
final String title;
@override
_MainShopState createState() => _MainShopState();
}
......@@ -172,7 +176,7 @@ class _MainShopState extends State<MainShop>
controller: _controller,
children: <Widget>[
Container(
child: BookingDetail(),
child: BookingDetail(getid: widget.getid,),
// child: getlist(),
//width: 20,
),
......
import 'package:feelverapp/ui/shop/shop_service_presenter.dart';
import 'package:feelverapp/util/SizeConfig.dart';
import 'package:feelverapp/util/rating_star.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../../service/api.dart';
import '../booking/booking_detail.dart';
import 'shop_main.dart';
class ShopServicePage extends StatefulWidget {
@override
......@@ -33,41 +36,60 @@ class _ShopServicePageState extends State<ShopServicePage>
Widget build(BuildContext context) {
SizeConfig(context);
return Container(
child: presenter.serviceModel == null
? Container()
: ListView.builder(
itemCount: presenter.serviceModel.data.length,
itemBuilder: (context, i) {
return myCard(
presenter.serviceModel.data[i].name,
presenter.serviceModel.data[i].cover,
presenter.serviceModel.data[i].price,
presenter.serviceModel.data[i].duration,
presenter.serviceModel.data[i].specialPrice == null ? "" : presenter.serviceModel.data[i].specialPrice,
);
})
);
child: presenter.serviceModel == null
? Container()
: ListView.builder(
itemCount: presenter.serviceModel.data.length,
itemBuilder: (context, i) {
return myCard(
presenter.serviceModel.data[i].name,
presenter.serviceModel.data[i].cover,
presenter.serviceModel.data[i].price,
presenter.serviceModel.data[i].duration,
presenter.serviceModel.data[i].id,
presenter.serviceModel.data[i].specialPrice == null
? ""
: presenter.serviceModel.data[i].specialPrice,
);
},
),
);
}
Widget myCard(String title, String image, String price, String time, String special_price) {
return Card(
margin: EdgeInsets.only(
right: SizeConfig.getPadding(16),
left: SizeConfig.getPadding(16),
top: SizeConfig.getPadding(10),
bottom: SizeConfig.getPadding(10)),
child: Container(
Widget myCard(String title, String image, String price, String time, int id,
String special_price) {
return InkWell(
onTap: () {
setState(
() {
Navigator.push(
context,
CupertinoPageRoute(
builder: (context) => MainShop(
getid: id,
),
),
);
},
);
},
child: Card(
margin: EdgeInsets.only(
right: SizeConfig.getPadding(16),
left: SizeConfig.getPadding(16),
top: SizeConfig.getPadding(10),
bottom: SizeConfig.getPadding(10)),
child: Container(
// color: Colors.red,
margin: EdgeInsets.only(right: 15, left: 15, bottom: 20, top: 20),
margin: EdgeInsets.only(right: 15, left: 15, bottom: 20, top: 20),
// color: Colors.blueGrey,
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
flex: 3,
child: Container(
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
flex: 3,
child: Container(
// color: Colors.blue,
height: SizeConfig.getHeight(250),
child: presenter.serviceModel == null
......@@ -76,154 +98,157 @@ class _ShopServicePageState extends State<ShopServicePage>
fit: BoxFit.cover,
)
: Image.network(
Api.baseApiforimage + image,
Api.baseApiforimage + image,
fit: BoxFit.cover,
),),
),
Expanded(
flex: 5,
child: Container(
margin: EdgeInsets.only(left: 15),
),
),
),
Expanded(
flex: 5,
child: Container(
margin: EdgeInsets.only(left: 15),
// color: Colors.yellow,
height: SizeConfig.getHeight(260),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
alignment: Alignment.topLeft,
height: SizeConfig.getHeight(260),
child: Column(
children: <Widget>[
Container(
padding: EdgeInsets.all(10),
alignment: Alignment.topLeft,
// color: Colors.red,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
SizedBox(
height: 5,
),
Text(
"SPA Cenvaree @ Centara Grand CentralWorld Bangkok",
style: TextStyle(
color: Color(0xff969696),
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
],
),
),
Container(
padding: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.topLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/pin_drop.png',
height: 20,
width: 20,
),
SizedBox(
width: 5,
),
Text(
"พญาไท กรุงเทพฯ",
style: TextStyle(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
title,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(13),
fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text",
),
),
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.access_time,
color: Color(0xffEEAFB7),
),
SizedBox(
width: 5,
),
Text(
time,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(13),
fontWeight: FontWeight.w500),
),
SizedBox(
height: 5,
),
Text(
"SPA Cenvaree @ Centara Grand CentralWorld Bangkok",
style: TextStyle(
color: Color(0xff969696),
fontSize: SizeConfig.getFontSize(11),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
],
),
),
Container(
padding: EdgeInsets.only(left: 10, right: 10),
alignment: Alignment.topLeft,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/images/pin_drop.png',
height: 20,
width: 20,
),
),
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
Text(
special_price,
style: TextStyle(
fontSize: SizeConfig.getFontSize(12),
decoration: TextDecoration.lineThrough,
SizedBox(
width: 5,
),
),
SizedBox(
width: 15,
),
Text(
"฿" + price,
style: TextStyle(
color: Colors.red,
fontSize: SizeConfig.getFontSize(18),
Text(
"พญาไท กรุงเทพฯ",
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(13),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
],
),
SizedBox(
height: SizeConfig.getHeight(5),
),
Container(
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
),
),
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Icon(
Icons.access_time,
color: Color(0xffEEAFB7),
),
SizedBox(
width: 5,
),
Text(
time,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(13),
fontFamily: "SF_Pro_Text",
),
),
],
),
SizedBox(
height: 10,
),
Row(
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
RatingStar(
isRating: true,
rate: rate1,
starSize: 20,
onChangeRate: (i) {
setState(() {
rate1 = i;
print(i);
});
},
Text(
special_price,
style: TextStyle(
fontSize: SizeConfig.getFontSize(12),
decoration: TextDecoration.lineThrough,
),
),
SizedBox(
width: 15,
),
Text(
"฿" + price,
style: TextStyle(
color: Colors.red,
fontSize: SizeConfig.getFontSize(18),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
],
),
),
],
SizedBox(
height: SizeConfig.getHeight(5),
),
Container(
child: Row(
crossAxisAlignment:
CrossAxisAlignment.start,
children: <Widget>[
RatingStar(
isRating: true,
rate: rate1,
starSize: 20,
onChangeRate: (i) {
setState(() {
rate1 = i;
print(i);
});
},
),
],
),
),
],
),
),
),
],
],
),
),
),
),
],
),
],
],
),
],
),
),
),
);
......
import 'package:feelverapp/model/favorite/addfav_model.dart';
import 'package:feelverapp/model/shoplistdetail/shoplistdetail_Model.dart';
import 'package:feelverapp/service/Loading.dart';
import 'package:feelverapp/service/api.dart';
import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/shop/shop_list_detail.dart';
import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:url_launcher/url_launcher.dart';
......@@ -11,7 +14,13 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
Api _api;
final formkey = GlobalKey<FormState>();
shoplistdetailModel model;
AddfavModel addmodel;
bool fav=false;
ShoplistdetailPresenter(State<ShopListDetail> state) : super(state);
String uid;
Detai(String id) async{
......@@ -33,6 +42,54 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail>{
print('res Fail');
}
}
getid() async {
SharedPreferences pref = await SharedPreferences.getInstance();
setState(() {
uid = pref.getString('Id');
});
return uid;
}
Addfav(String id) async{
LoadingView(state.context).show();
_api = Api<AddfavModel>();
var res = await _api.addfav({
"customer_id": uid,
"store_id":id,
"vendor_id":id,
"product_id":id,
});
LoadingView(state.context).hide();
if (res.fail == null) {
setState(() {
addmodel = res.success;
print("complete");
fav=true;
});
showDialog(
context: state.context,
builder: (context) {
Future.delayed(Duration(seconds: 1), () {
Navigator.of(context).pop(true);
});
return AlertDialog(
content:ImageIcon(
AssetImage('assets/images/ic_fav_list.png'),
color:fav?Color(0xFFDD175F): Colors.grey,
size: SizeConfig.getFontSize(30),
) ,
title:Center(child: Text('บันทึกสำเร็จ')),
);
});
} else {
print('res Fail');
}
}
gotoDirection(String lat,String lng){
print("debug");
......
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
archive:
dependency: transitive
description:
name: archive
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.0"
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.1"
version: "2.4.2"
boolean_selector:
dependency: transitive
description:
......@@ -43,34 +29,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.1"
charcode:
characters:
dependency: transitive
description:
name: charcode
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.3"
collection:
version: "1.0.0"
charcode:
dependency: transitive
description:
name: collection
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.12"
convert:
version: "1.1.3"
clock:
dependency: transitive
description:
name: convert
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
crypto:
version: "1.0.1"
collection:
dependency: transitive
description:
name: crypto
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.4"
version: "1.14.13"
csslib:
dependency: transitive
description:
......@@ -92,6 +78,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.8"
fake_async:
dependency: transitive
description:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
file:
dependency: transitive
description:
......@@ -156,13 +149,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
image_cropper:
dependency: "direct main"
description:
......@@ -211,7 +197,7 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.6"
version: "0.12.8"
meta:
dependency: transitive
description:
......@@ -225,7 +211,7 @@ packages:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.4"
version: "1.7.0"
path_provider_linux:
dependency: transitive
description:
......@@ -247,13 +233,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.0"
petitparser:
dependency: transitive
description:
name: petitparser
url: "https://pub.dartlang.org"
source: hosted
version: "2.4.0"
platform:
dependency: transitive
description:
......@@ -289,13 +268,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.4"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
rflutter_alert:
dependency: "direct main"
description:
......@@ -356,7 +328,7 @@ packages:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
version: "1.9.5"
stream_channel:
dependency: transitive
description:
......@@ -384,14 +356,14 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.15"
version: "0.2.17"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
version: "1.2.0"
url_launcher:
dependency: "direct main"
description:
......@@ -441,13 +413,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks:
dart: ">=2.6.0 <3.0.0"
dart: ">=2.9.0-14.0.dev <3.0.0"
flutter: ">=1.12.13+hotfix.5 <2.0.0"
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