Commit 456dbfdd by Mobile : Art

update

parent 4dcf44e2
...@@ -29,7 +29,7 @@ class MyApp extends StatelessWidget { ...@@ -29,7 +29,7 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue, primarySwatch: Colors.blue,
), ),
home: AccountSettingPage() home: HomePage()
//home: EditProfile(), //home: EditProfile(),
......
...@@ -5,7 +5,7 @@ class categoryModel { ...@@ -5,7 +5,7 @@ class categoryModel {
categoryModel({this.dATA}); categoryModel({this.dATA});
categoryModel.fromJson(Map<String, dynamic> json) { categoryModel.fromJson(Map<String, dynamic> json) {
if (json['DATA'] != null) { if (json['data'] != null) {
dATA = new List<DATA>(); dATA = new List<DATA>();
json['DATA'].forEach((v) { json['DATA'].forEach((v) {
dATA.add(new DATA.fromJson(v)); dATA.add(new DATA.fromJson(v));
...@@ -16,7 +16,7 @@ class categoryModel { ...@@ -16,7 +16,7 @@ class categoryModel {
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>(); final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.dATA != null) { if (this.dATA != null) {
data['DATA'] = this.dATA.map((v) => v.toJson()).toList(); data['data'] = this.dATA.map((v) => v.toJson()).toList();
} }
return data; return data;
} }
......
class NearMeListModel { class NearMeListModel {
bool status;
Results results;
NearMeListModel({this.status, this.results});
NearMeListModel.fromJson(Map<String, dynamic> json) {
status = json['status'];
results =
json['results'] != null ? new Results.fromJson(json['results']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['status'] = this.status;
if (this.results != null) {
data['results'] = this.results.toJson();
}
return data;
}
}
class Results {
int currentPage;
List<Data> data;
Results({this.currentPage, this.data});
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));
});
}
}
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();
}
return data;
}
}
class Data {
int id; int id;
String storeCode; String storeCode;
String storeName; String storeName;
...@@ -8,7 +56,6 @@ class NearMeListModel { ...@@ -8,7 +56,6 @@ class NearMeListModel {
int storeOrder; int storeOrder;
int customerGroupId; int customerGroupId;
int vendorId; int vendorId;
Null createdAt;
String updatedAt; String updatedAt;
String location; String location;
String email; String email;
...@@ -24,13 +71,9 @@ class NearMeListModel { ...@@ -24,13 +71,9 @@ class NearMeListModel {
String detail; String detail;
String storeLogo; String storeLogo;
String isFacilities; String isFacilities;
String distanceWithLocation; dynamic distanceWithLocation;
int star;
List<StoreProduct> storeProduct;
List<Null> comment;
Null ratings;
NearMeListModel( Data(
{this.id, {this.id,
this.storeCode, this.storeCode,
this.storeName, this.storeName,
...@@ -40,7 +83,6 @@ class NearMeListModel { ...@@ -40,7 +83,6 @@ class NearMeListModel {
this.storeOrder, this.storeOrder,
this.customerGroupId, this.customerGroupId,
this.vendorId, this.vendorId,
this.createdAt,
this.updatedAt, this.updatedAt,
this.location, this.location,
this.email, this.email,
...@@ -56,13 +98,10 @@ class NearMeListModel { ...@@ -56,13 +98,10 @@ class NearMeListModel {
this.detail, this.detail,
this.storeLogo, this.storeLogo,
this.isFacilities, this.isFacilities,
this.distanceWithLocation, this.distanceWithLocation
this.star, });
this.storeProduct,
this.comment,
this.ratings});
NearMeListModel.fromJson(Map<String, dynamic> json) { Data.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
storeCode = json['store_code']; storeCode = json['store_code'];
storeName = json['store_name']; storeName = json['store_name'];
...@@ -72,7 +111,6 @@ class NearMeListModel { ...@@ -72,7 +111,6 @@ class NearMeListModel {
storeOrder = json['store_order']; storeOrder = json['store_order'];
customerGroupId = json['customer_group_id']; customerGroupId = json['customer_group_id'];
vendorId = json['vendor_id']; vendorId = json['vendor_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at']; updatedAt = json['updated_at'];
location = json['location']; location = json['location'];
email = json['email']; email = json['email'];
...@@ -89,20 +127,6 @@ class NearMeListModel { ...@@ -89,20 +127,6 @@ class NearMeListModel {
storeLogo = json['store_logo']; storeLogo = json['store_logo'];
isFacilities = json['is_facilities']; isFacilities = json['is_facilities'];
distanceWithLocation = json['distance_with_location']; distanceWithLocation = json['distance_with_location'];
star = json['star'];
if (json['store_product'] != null) {
storeProduct = new List<StoreProduct>();
json['store_product'].forEach((v) {
storeProduct.add(new StoreProduct.fromJson(v));
});
}
if (json['comment'] != null) {
comment = new List<Null>();
json['comment'].forEach((v) {
comment.add(new Null.fromJson(v));
});
}
ratings = json['ratings'];
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
...@@ -116,7 +140,6 @@ class NearMeListModel { ...@@ -116,7 +140,6 @@ class NearMeListModel {
data['store_order'] = this.storeOrder; data['store_order'] = this.storeOrder;
data['customer_group_id'] = this.customerGroupId; data['customer_group_id'] = this.customerGroupId;
data['vendor_id'] = this.vendorId; data['vendor_id'] = this.vendorId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt; data['updated_at'] = this.updatedAt;
data['location'] = this.location; data['location'] = this.location;
data['email'] = this.email; data['email'] = this.email;
...@@ -133,434 +156,6 @@ class NearMeListModel { ...@@ -133,434 +156,6 @@ class NearMeListModel {
data['store_logo'] = this.storeLogo; data['store_logo'] = this.storeLogo;
data['is_facilities'] = this.isFacilities; data['is_facilities'] = this.isFacilities;
data['distance_with_location'] = this.distanceWithLocation; data['distance_with_location'] = this.distanceWithLocation;
data['star'] = this.star;
if (this.storeProduct != null) {
data['store_product'] = this.storeProduct.map((v) => v.toJson()).toList();
}
if (this.comment != null) {
data['comment'] = this.comment.map((v) => v.toJson()).toList();
}
data['ratings'] = this.ratings;
return data; return data;
} }
} }
class StoreProduct {
int id;
int productId;
int storeId;
int vendorId;
String status;
int sortOrders;
Null createdAt;
Null updatedAt;
Null typeRateService;
Null priceRateService;
Product product;
StoreProduct(
{this.id,
this.productId,
this.storeId,
this.vendorId,
this.status,
this.sortOrders,
this.createdAt,
this.updatedAt,
this.typeRateService,
this.priceRateService,
this.product});
StoreProduct.fromJson(Map<String, dynamic> json) {
id = json['id'];
productId = json['product_id'];
storeId = json['store_id'];
vendorId = json['vendor_id'];
status = json['status'];
sortOrders = json['sort_orders'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
typeRateService = json['type_rate_service'];
priceRateService = json['price_rate_service'];
product =
json['product'] != null ? new Product.fromJson(json['product']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['product_id'] = this.productId;
data['store_id'] = this.storeId;
data['vendor_id'] = this.vendorId;
data['status'] = this.status;
data['sort_orders'] = this.sortOrders;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['type_rate_service'] = this.typeRateService;
data['price_rate_service'] = this.priceRateService;
if (this.product != null) {
data['product'] = this.product.toJson();
}
return data;
}
}
class Product {
int id;
String urlCode;
String name;
String cover;
String excerpt;
String detail;
String price;
String specialPrice;
String sku;
Null tax;
int quantity;
Null weight;
String visibility;
Null newsFromDate;
Null newsToDate;
Null layout;
Null theme;
String duration;
Null sellingStartTime;
Null sellingEndTime;
Null redemptionStartTime;
Null redemptionEndTime;
Null availibility;
String isFeatured;
String isDeal;
String hasTeam;
String offpeak;
String reviewStatus;
String relatedStatus;
String upSellsStatus;
String crossSellsStatus;
String allowGiftMessage;
String stockStatus;
int status;
int businessTypeId;
int businessCateId;
Null businessServiceId;
int attributeSetId;
int vendorId;
String allowRoute;
Null type;
int star;
List<CategoryByProductId> categoryByProductId;
List<Null> ratings;
int storeProductId;
Null typeRateService;
Null priceRateService;
int productId;
int storeId;
String storeCode;
String storeName;
String location;
int storeStatus;
int vendorStatus;
String latitude;
String longitude;
Null popular;
Product(
{this.id,
this.urlCode,
this.name,
this.cover,
this.excerpt,
this.detail,
this.price,
this.specialPrice,
this.sku,
this.tax,
this.quantity,
this.weight,
this.visibility,
this.newsFromDate,
this.newsToDate,
this.layout,
this.theme,
this.duration,
this.sellingStartTime,
this.sellingEndTime,
this.redemptionStartTime,
this.redemptionEndTime,
this.availibility,
this.isFeatured,
this.isDeal,
this.hasTeam,
this.offpeak,
this.reviewStatus,
this.relatedStatus,
this.upSellsStatus,
this.crossSellsStatus,
this.allowGiftMessage,
this.stockStatus,
this.status,
this.businessTypeId,
this.businessCateId,
this.businessServiceId,
this.attributeSetId,
this.vendorId,
this.allowRoute,
this.type,
this.star,
this.categoryByProductId,
this.ratings,
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});
Product.fromJson(Map<String, dynamic> json) {
id = json['id'];
urlCode = json['url_code'];
name = json['name'];
cover = json['cover'];
excerpt = json['excerpt'];
detail = json['detail'];
price = json['price'];
specialPrice = json['special_price'];
sku = json['sku'];
tax = json['tax'];
quantity = json['quantity'];
weight = json['weight'];
visibility = json['visibility'];
newsFromDate = json['news_from_date'];
newsToDate = json['news_to_date'];
layout = json['layout'];
theme = json['theme'];
duration = json['duration'];
sellingStartTime = json['selling_start_time'];
sellingEndTime = json['selling_end_time'];
redemptionStartTime = json['redemption_start_time'];
redemptionEndTime = json['redemption_end_time'];
availibility = json['availibility'];
isFeatured = json['is_featured'];
isDeal = json['is_deal'];
hasTeam = json['has_team'];
offpeak = json['offpeak'];
reviewStatus = json['review_status'];
relatedStatus = json['related_status'];
upSellsStatus = json['up_sells_status'];
crossSellsStatus = json['cross_sells_status'];
allowGiftMessage = json['allow_gift_message'];
stockStatus = json['stock_status'];
status = json['status'];
businessTypeId = json['business_type_id'];
businessCateId = json['business_cate_id'];
businessServiceId = json['business_service_id'];
attributeSetId = json['attribute_set_id'];
vendorId = json['vendor_id'];
allowRoute = json['allow_route'];
type = json['type'];
star = json['star'];
if (json['category_by_product_id'] != null) {
categoryByProductId = new List<CategoryByProductId>();
json['category_by_product_id'].forEach((v) {
categoryByProductId.add(new CategoryByProductId.fromJson(v));
});
}
if (json['ratings'] != null) {
ratings = new List<Null>();
json['ratings'].forEach((v) {
ratings.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'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['url_code'] = this.urlCode;
data['name'] = this.name;
data['cover'] = this.cover;
data['excerpt'] = this.excerpt;
data['detail'] = this.detail;
data['price'] = this.price;
data['special_price'] = this.specialPrice;
data['sku'] = this.sku;
data['tax'] = this.tax;
data['quantity'] = this.quantity;
data['weight'] = this.weight;
data['visibility'] = this.visibility;
data['news_from_date'] = this.newsFromDate;
data['news_to_date'] = this.newsToDate;
data['layout'] = this.layout;
data['theme'] = this.theme;
data['duration'] = this.duration;
data['selling_start_time'] = this.sellingStartTime;
data['selling_end_time'] = this.sellingEndTime;
data['redemption_start_time'] = this.redemptionStartTime;
data['redemption_end_time'] = this.redemptionEndTime;
data['availibility'] = this.availibility;
data['is_featured'] = this.isFeatured;
data['is_deal'] = this.isDeal;
data['has_team'] = this.hasTeam;
data['offpeak'] = this.offpeak;
data['review_status'] = this.reviewStatus;
data['related_status'] = this.relatedStatus;
data['up_sells_status'] = this.upSellsStatus;
data['cross_sells_status'] = this.crossSellsStatus;
data['allow_gift_message'] = this.allowGiftMessage;
data['stock_status'] = this.stockStatus;
data['status'] = this.status;
data['business_type_id'] = this.businessTypeId;
data['business_cate_id'] = this.businessCateId;
data['business_service_id'] = this.businessServiceId;
data['attribute_set_id'] = this.attributeSetId;
data['vendor_id'] = this.vendorId;
data['allow_route'] = this.allowRoute;
data['type'] = this.type;
data['star'] = this.star;
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();
}
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;
return data;
}
}
class CategoryByProductId {
int id;
Null parentId;
String name;
String code;
String displayName;
String cover;
String detail;
Null type;
String status;
int sortOrder;
Null storeId;
Null vendorId;
Null createdAt;
String updatedAt;
String visibility;
Pivot pivot;
CategoryByProductId(
{this.id,
this.parentId,
this.name,
this.code,
this.displayName,
this.cover,
this.detail,
this.type,
this.status,
this.sortOrder,
this.storeId,
this.vendorId,
this.createdAt,
this.updatedAt,
this.visibility,
this.pivot});
CategoryByProductId.fromJson(Map<String, dynamic> json) {
id = json['id'];
parentId = json['parent_id'];
name = json['name'];
code = json['code'];
displayName = json['display_name'];
cover = json['cover'];
detail = json['detail'];
type = json['type'];
status = json['status'];
sortOrder = json['sort_order'];
storeId = json['store_id'];
vendorId = json['vendor_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
visibility = json['visibility'];
pivot = json['pivot'] != null ? new Pivot.fromJson(json['pivot']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['parent_id'] = this.parentId;
data['name'] = this.name;
data['code'] = this.code;
data['display_name'] = this.displayName;
data['cover'] = this.cover;
data['detail'] = this.detail;
data['type'] = this.type;
data['status'] = this.status;
data['sort_order'] = this.sortOrder;
data['store_id'] = this.storeId;
data['vendor_id'] = this.vendorId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['visibility'] = this.visibility;
if (this.pivot != null) {
data['pivot'] = this.pivot.toJson();
}
return data;
}
}
class Pivot {
int productId;
int categoryId;
String createdAt;
String updatedAt;
Pivot({this.productId, this.categoryId, this.createdAt, this.updatedAt});
Pivot.fromJson(Map<String, dynamic> json) {
productId = json['product_id'];
categoryId = json['category_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['product_id'] = this.productId;
data['category_id'] = this.categoryId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
return data;
}
}
\ No newline at end of file
import 'dart:convert'; import 'dart:convert';
import 'package:feelverapp/home_search/searchhomepage_model.dart'; import 'package:feelverapp/home_search/searchhomepage_model.dart';
import 'package:feelverapp/model/Login/login_model.dart'; import 'package:feelverapp/model/Login/login_model.dart';
import 'package:feelverapp/model/base/base.dart'; import 'package:feelverapp/model/base/base.dart';
...@@ -10,6 +9,7 @@ import 'package:feelverapp/model/editprofile/getprofilemodel.dart'; ...@@ -10,6 +9,7 @@ import 'package:feelverapp/model/editprofile/getprofilemodel.dart';
import 'package:feelverapp/model/forgetpassword/forgetpassModel.dart'; import 'package:feelverapp/model/forgetpassword/forgetpassModel.dart';
import 'package:feelverapp/model/home/home_model.dart'; import 'package:feelverapp/model/home/home_model.dart';
import 'package:feelverapp/model/nearme/nearme_list_model.dart';
import 'package:feelverapp/model/register/register_model.dart'; import 'package:feelverapp/model/register/register_model.dart';
import 'package:feelverapp/model/category/category_model.dart'; import 'package:feelverapp/model/category/category_model.dart';
...@@ -31,26 +31,25 @@ class Api<T> { ...@@ -31,26 +31,25 @@ class Api<T> {
var result; var result;
// (body as Map)['lang'] = allTranslations.currentLanguage; // (body as Map)['lang'] = allTranslations.currentLanguage;
await _httpConnection("${this._baseApi}/store/shop-list", this._headerApi, body) await _httpConnection(
.then((response){ "${this._baseApi}/store/shop-list", this._headerApi, body)
print("ผลลัพ เท่ากับบบบ " + "${response.body}"); .then((response) {
if (response.statusCode == 200){ print("ผลลัพ เท่ากับบบบ " + "${response.body}");
_model = SearchhomeModel.fromJson(json.decode(response.body)); if (response.statusCode == 200) {
} else { _model = SearchhomeModel.fromJson(json.decode(response.body));
_fail = FailModel.fromJson(json.decode(response.body)); } else {
} _fail = FailModel.fromJson(json.decode(response.body));
result = new Response<T>(_model, _fail); }
result = new Response<T>(_model, _fail);
}); });
return result; return result;
} }
Future<Response<T>> getprofile(Object body) async { Future<Response<T>> getprofile(Object body) async {
var _model; var _model;
var _fail; var _fail;
var result; var result;
print("this is body "+body.toString()); print("this is body " + body.toString());
// (body as Map)['lang'] = allTranslations.currentLanguage; // (body as Map)['lang'] = allTranslations.currentLanguage;
await _httpConnection( await _httpConnection(
"${this._baseApi}/customer/info", this._headerApi, body) "${this._baseApi}/customer/info", this._headerApi, body)
...@@ -66,12 +65,43 @@ print("this is body "+body.toString()); ...@@ -66,12 +65,43 @@ print("this is body "+body.toString());
return result; return result;
} }
Future<Response<T>> editProfile(Object body) async { Future<Response<T>> getNearList(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-uat.feelver.com/api/product/getListsStoreFormat?near_location=13.7913772,100.5408628&page=1&is_paginate=1"), headers: this._headerApi ).then((response) {
print("ผลลัพ เท่ากับบบบ2 " + "${response.body}");
print("statusCode=${response.statusCode}");
if (response.statusCode == 200) {
print("INif");
print(json.decode(response.body));
_model = NearMeListModel.fromJson(json.decode(response.body));
} else {
_fail = FailModel.fromJson(json.decode(response.body));
}
print("return");
result = new Response<T>(_model, _fail);
});
return result;
// await _httpConnection(
// "${this._baseApi}product/getListsStoreFormat", this._headerApi, body)
}
Future<Response<T>> editProfile(Object body) async {
var _model; var _model;
var _fail; var _fail;
var result; var result;
print("This is body "+body.toString()); print("This is body " + body.toString());
await _httpConnection( await _httpConnection(
"${this._baseApi}/customer/edit", this._headerApi, body) "${this._baseApi}/customer/edit", this._headerApi, body)
.then((response) { .then((response) {
...@@ -85,6 +115,7 @@ print("this is body "+body.toString()); ...@@ -85,6 +115,7 @@ print("this is body "+body.toString());
}); });
return result; return result;
} }
Future<Response<T>> forgetPassword(Object body) async { Future<Response<T>> forgetPassword(Object body) async {
var _model; var _model;
var _fail; var _fail;
...@@ -150,7 +181,7 @@ print("this is body "+body.toString()); ...@@ -150,7 +181,7 @@ print("this is body "+body.toString());
await _httpConnection("${this._baseApi}/category", this._headerApi, body) await _httpConnection("${this._baseApi}/category", this._headerApi, body)
.then((response) { .then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}"); print("ผลลัพท์ เท่ากับ55555 " "${response.body}");
if (response.statusCode == 200) { if (response.statusCode == 200) {
// Array to Map Json // Array to Map Json
Map<String, dynamic> myData = arrayToJson(response.body); Map<String, dynamic> myData = arrayToJson(response.body);
...@@ -158,6 +189,9 @@ print("this is body "+body.toString()); ...@@ -158,6 +189,9 @@ print("this is body "+body.toString());
print(myData); print(myData);
_model = categoryModel.fromJson(myData); _model = categoryModel.fromJson(myData);
print('myModel ' + _model);
} else { } else {
_fail = FailModel.fromJson(json.decode(response.body)); _fail = FailModel.fromJson(json.decode(response.body));
} }
...@@ -166,22 +200,22 @@ print("this is body "+body.toString()); ...@@ -166,22 +200,22 @@ print("this is body "+body.toString());
return result; return result;
} }
Future<Response<T>> shoplist(Object body) async {
Future<Response<T>> shoplist(Object body) async{
var _model; var _model;
var _fail; var _fail;
var result; var result;
await _httpConnection("${this._baseApi}/store", this._headerApi, body).then((response){ await _httpConnection("${this._baseApi}/store", this._headerApi, body)
.then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}"); print("ผลลัพท์ เท่ากับ " "${response.body}");
if(response.statusCode == 200){ if (response.statusCode == 200) {
// Array to Map Json // Array to Map Json
Map<String, dynamic> myData = arrayToJson(response.body); Map<String, dynamic> myData = arrayToJson(response.body);
// print(myData); // print(myData);
_model = shoplistModel.fromJson(myData); _model = shoplistModel.fromJson(myData);
}else{ } else {
_fail = FailModel.fromJson(json.decode(response.body)); _fail = FailModel.fromJson(json.decode(response.body));
} }
result = new Response<T>(_model, _fail); result = new Response<T>(_model, _fail);
...@@ -189,23 +223,25 @@ print("this is body "+body.toString()); ...@@ -189,23 +223,25 @@ print("this is body "+body.toString());
return result; return result;
} }
Future<Response<T>> shoplistDetail(Object body) async{ Future<Response<T>> shoplistDetail(Object body) async {
var _model; var _model;
var _fail; var _fail;
var result; var result;
await _httpConnection("${this._baseApi}/store/detail", this._headerApi, body).then((response){ await _httpConnection(
"${this._baseApi}/store/detail", this._headerApi, body)
.then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}"); print("ผลลัพท์ เท่ากับ " "${response.body}");
if(response.statusCode == 200){ if (response.statusCode == 200) {
_model = shoplistdetailModel.fromJson(json.decode(response.body)); _model = shoplistdetailModel.fromJson(json.decode(response.body));
}else{ } else {
_fail = FailModel.fromJson(json.decode(response.body)); _fail = FailModel.fromJson(json.decode(response.body));
} }
result = new Response<T>(_model, _fail); result = new Response<T>(_model, _fail);
}); });
return result; return result;
} }
///api environment ///api environment
Future<http.Response> _httpConnection( Future<http.Response> _httpConnection(
String url, Map<String, String> headers, Object body) async { String url, Map<String, String> headers, Object body) async {
......
...@@ -4,7 +4,6 @@ import 'dart:developer'; ...@@ -4,7 +4,6 @@ import 'dart:developer';
import 'package:feelverapp/model/Login/login_model.dart'; import 'package:feelverapp/model/Login/login_model.dart';
import 'package:feelverapp/model/forgetpassword/forgetpassModel.dart'; import 'package:feelverapp/model/forgetpassword/forgetpassModel.dart';
import 'package:feelverapp/service/Loading.dart'; import 'package:feelverapp/service/Loading.dart';
import 'package:feelverapp/service/api.dart'; import 'package:feelverapp/service/api.dart';
...@@ -17,144 +16,110 @@ import 'package:flutter/cupertino.dart'; ...@@ -17,144 +16,110 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rflutter_alert/rflutter_alert.dart'; import 'package:rflutter_alert/rflutter_alert.dart';
class ForgetPasswordPresenter extends BasePresenter<ForgetPassword> { class ForgetPasswordPresenter extends BasePresenter<ForgetPassword> {
Api _api; Api _api;
Timer _timer; Timer _timer;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
TextEditingController emailCtrl = TextEditingController(); TextEditingController emailCtrl = TextEditingController();
ForgetPasswordPresenter(State<ForgetPassword> state) : super(state); ForgetPasswordPresenter(State<ForgetPassword> state) : super(state);
letCheckData() async {
try {
if (emailCtrl.text.isEmpty) throw ('กรุณากรอก\nอีเมล์');
Pattern pattern =
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+";
RegExp regex = new RegExp(pattern);
letCheckData() async { if (!regex.hasMatch(emailCtrl.text))
throw ('รูปแบบอีเมล์\nไม่ถูกต้อง');
else {
try { await forgetpassrequest();
if (emailCtrl.text.isEmpty ) throw ('กรุณากรอก\nอีเมล์');
Pattern pattern =
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+";
RegExp regex = new RegExp(pattern);
if (!regex.hasMatch(emailCtrl.text))
throw ('รูปแบบอีเมล์\nไม่ถูกต้อง');
else {
await forgetpassrequest();
}
} catch (e) {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
} }
} catch (e) {
} Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
}
}
forgetpassrequest() async { forgetpassrequest() async {
LoadingView(state.context).show(); LoadingView(state.context).show();
_api = Api<FogetPasswordModel>(); _api = Api<FogetPasswordModel>();
var res = await _api.forgetPassword({ var res = await _api.forgetPassword({
"access_type":"mobile", "access_type": "mobile",
"email": emailCtrl.text, "email": emailCtrl.text,
}); });
LoadingView(state.context).hide(); LoadingView(state.context).hide();
if (res.fail == null) { if (res.fail == null) {
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "สำเร็จ\nกรุณาตรวจสอบอีเมล์ของท่าน",
title: "สำเร็จ\nกรุณาตรวจสอบอีเมล์ของท่าน", content: Icon(
content: Icon(Icons.check_circle,color: Color.fromRGBO(106, 179, 170, 1),size: 80,), Icons.check_circle,
buttons: [ color: Color.fromRGBO(106, 179, 170, 1),
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () => buttons: [
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => LoginPage())), DialogButton(
child: Text( color: Color.fromRGBO(106, 179, 170, 1),
"ตกลง", onPressed: () => Navigator.pushReplacement(state.context,
style: TextStyle(color: Colors.white, fontSize: 20), CupertinoPageRoute(builder: (_) => LoginPage())),
), child: Text(
) "ตกลง",
]).show(); style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
FogetPasswordModel model = res.success; FogetPasswordModel model = res.success;
} else {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
} else { isCloseButton: false,
Alert( ),
style: AlertStyle( context: state.context,
animationType: AnimationType.fromTop, title: "อีเมล์\nไม่ถูกต้อง",
isCloseButton: false, content: Icon(
Icons.warning,
), color: Colors.orange,
context: state.context, size: 80,
title: "อีเมล์\nไม่ถูกต้อง", ),
content: Icon(Icons.warning,color: Colors.orange,size: 80,), buttons: [
buttons: [ DialogButton(
DialogButton( color: Color.fromRGBO(106, 179, 170, 1),
color: Color.fromRGBO(106, 179, 170, 1), onPressed: () => Navigator.pop(state.context),
onPressed: () => Navigator.pop(state.context), child: Text(
child: Text( "ลองอีกครั้ง",
"ลองอีกครั้ง", style: TextStyle(color: Colors.white, fontSize: 20),
style: TextStyle(color: Colors.white, fontSize: 20), ),
), )
) ]).show();
]).show();
} }
} }
} }
...@@ -424,7 +424,7 @@ class _BookingDetailState extends State<BookingDetail> { ...@@ -424,7 +424,7 @@ class _BookingDetailState extends State<BookingDetail> {
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
fontSize: SizeConfig.getFontSize(14), fontSize: SizeConfig.getFontSize(20),
fontFamily: "SF_Pro_Text", fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500), fontWeight: FontWeight.w500),
), ),
......
...@@ -457,28 +457,35 @@ class _BookingFlowState extends State<BookingFlow> { ...@@ -457,28 +457,35 @@ class _BookingFlowState extends State<BookingFlow> {
SizedBox(width: SizeConfig.getWidth(16),), SizedBox(width: SizeConfig.getWidth(16),),
Container( GestureDetector(onTap: (){
alignment: Alignment.topLeft, setState(() {
width: MediaQuery.of(context).size.width / 4, print('object');
height: SizeConfig.getHeight(50),
decoration: BoxDecoration(border: Border.all( });
color: Colors.grey, },
width: 1,
),
borderRadius: BorderRadius.circular(24),
color: Colors.transparent,
),
child: Container( child: Container(
alignment: Alignment.topCenter, alignment: Alignment.topLeft,
padding: EdgeInsets.only(top: SizeConfig.getPadding(10)), width: MediaQuery.of(context).size.width / 4,
child: Text( height: SizeConfig.getHeight(50),
'90 นาที', decoration: BoxDecoration(border: Border.all(
textAlign: TextAlign.center, color: Colors.grey,
style: TextStyle( width: 1,
color: Colors.grey, ),
fontSize: SizeConfig.getFontSize(14), borderRadius: BorderRadius.circular(24),
fontFamily: "SF_Pro_Text", color: Colors.transparent,
fontWeight: FontWeight.w500), ),
child: Container(
alignment: Alignment.topCenter,
padding: EdgeInsets.only(top: SizeConfig.getPadding(10)),
child: Text(
'90 นาที',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey,
fontSize: SizeConfig.getFontSize(14),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
), ),
), ),
), ),
......
import 'package:feelverapp/ui/booking/booking_detail.dart';
import 'package:feelverapp/ui/booking/bookingflow.dart';
import 'package:feelverapp/util/SizeConfig.dart'; import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -51,12 +53,12 @@ class _BookingFormState extends State<BookingForm> { ...@@ -51,12 +53,12 @@ class _BookingFormState extends State<BookingForm> {
right: SizeConfig.getPadding(20), right: SizeConfig.getPadding(20),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
// Navigator.push( Navigator.push(
// context, context,
// MaterialPageRoute( MaterialPageRoute(
// builder: (context) => BookingFlow(), builder: (context) => BookingDetail(),
// ), ),
// ); );
}, },
child: Container( child: Container(
// color: Colors.red, // color: Colors.red,
......
...@@ -10,42 +10,36 @@ import 'package:flutter/cupertino.dart'; ...@@ -10,42 +10,36 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class HomePage extends StatefulWidget { class HomePage extends StatefulWidget {
String id; String id;
String image; String image;
HomePage({Key key, this.id,this.image}) : super(key: key);
HomePage({Key key, this.id, this.image}) : super(key: key);
@override @override
_HomePageState createState() => _HomePageState(); _HomePageState createState() => _HomePageState();
} }
class _HomePageState extends State<HomePage> with TickerProviderStateMixin { class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
HomePresenter presenter; HomePresenter presenter;
@override
void initState() {
super.initState();
presenter = HomePresenter(this);
presenter.Listitem();
// presenter.getid(); @override
presenter.getprofile (); void initState() {
super.initState();
presenter.Search();
presenter = HomePresenter(this);
presenter.Listitem();
// presenter.getid();
presenter.getprofile();
// presenter.Search();
} }
@override @override
void dispose() { void dispose() {
super.dispose(); super.dispose();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
SizeConfig(context); SizeConfig(context);
...@@ -158,10 +152,10 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -158,10 +152,10 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
height: SizeConfig.getWidth(24), height: SizeConfig.getWidth(24),
), ),
onPressed: () { onPressed: () {
// Navigator.push( Navigator.push(
// context, context,
// MaterialPageRoute(builder: (context) => LoginPage()), MaterialPageRoute(builder: (context) => NearmeList()),
// ); );
}, },
), ),
Text( Text(
...@@ -203,8 +197,14 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -203,8 +197,14 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
showDialog( showDialog(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return presenter.getmodel == null
return presenter.getmodel==null?Container():NavDrawer(name: presenter.getmodel.result[0].user.name,id:presenter.getmodel.result[0].id.toString(),image:presenter.getmodel.result[0].image ,); ? Container()
: NavDrawer(
name: presenter.getmodel.result[0].user.name,
id: presenter.getmodel.result[0].id
.toString(),
image: presenter.getmodel.result[0].image,
);
}); });
}, },
child: Image.asset( child: Image.asset(
...@@ -233,24 +233,25 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -233,24 +233,25 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
right: SizeConfig.getPadding(20), right: SizeConfig.getPadding(20),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LoginPage()), MaterialPageRoute(builder: (context) => LoginPage()),
); );
}, },
child: presenter.getmodel == null
child: presenter.getmodel==null?Container():Container( ? Container()
child: ClipRRect( : Container(
borderRadius: BorderRadius.all( child: ClipRRect(
Radius.circular(SizeConfig.getWidth(56))), borderRadius: BorderRadius.all(
child: Image.network( Radius.circular(SizeConfig.getWidth(56))),
presenter.getmodel.result[0].image , child: Image.network(
fit: BoxFit.contain, presenter.getmodel.result[0].image,
width: SizeConfig.getWidth(30), fit: BoxFit.contain,
height: SizeConfig.getWidth(30), width: SizeConfig.getWidth(30),
), height: SizeConfig.getWidth(30),
), ),
), ),
),
), ),
), ),
_searchField(), _searchField(),
...@@ -276,7 +277,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -276,7 +277,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'SPA', 'SPA',
'99 View',ShopList()), '99 View',
ShopList()),
_listItem( _listItem(
Image.asset( Image.asset(
'assets/images/banner_massage.png', 'assets/images/banner_massage.png',
...@@ -285,7 +287,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -285,7 +287,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'Massage', 'Massage',
'99 View',NearmeList()), '99 View',
ShopList()),
_listItem( _listItem(
Image.asset( Image.asset(
'assets/images/banner_beauty.png', 'assets/images/banner_beauty.png',
...@@ -294,7 +297,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -294,7 +297,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'BEAUTY', 'BEAUTY',
'99 View',NearmeList()), '99 View',
ShopList()),
_listItem( _listItem(
Image.asset( Image.asset(
'assets/images/banner_nearme.png', 'assets/images/banner_nearme.png',
...@@ -303,7 +307,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -303,7 +307,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'NEAR ME', 'NEAR ME',
'99 View',NearmeList()), '99 View',
ShopList()),
_listItem( _listItem(
Image.asset( Image.asset(
'assets/images/banner_promotion.png', 'assets/images/banner_promotion.png',
...@@ -312,7 +317,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -312,7 +317,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'PROMOTION', 'PROMOTION',
'99 View',NearmeList()), '99 View',
ShopList()),
_listItem( _listItem(
Image.asset( Image.asset(
'assets/images/banner_mostpopular.png', 'assets/images/banner_mostpopular.png',
...@@ -321,7 +327,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -321,7 +327,8 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'MOST POPULAR', 'MOST POPULAR',
'99 Vidw',NearmeList()), '99 Vidw',
ShopList()),
_listItem( _listItem(
Image.asset( Image.asset(
'assets/images/banner_recommended.png', 'assets/images/banner_recommended.png',
...@@ -329,8 +336,9 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -329,8 +336,9 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
'RECOMMEND', 'presenter.homemodel.name[0].toString()',
'99 View',NearmeList()), '99 View',
ShopList()),
SizedBox( SizedBox(
height: 30, height: 30,
), ),
...@@ -409,7 +417,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin { ...@@ -409,7 +417,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
), ),
), ),
prefixIcon: IconButton( prefixIcon: IconButton(
onPressed: () { onPressed: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => ShopList()), MaterialPageRoute(builder: (context) => ShopList()),
......
...@@ -19,7 +19,9 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -19,7 +19,9 @@ class HomePresenter extends BasePresenter<HomePage> {
final formkey = GlobalKey<FormState>(); final formkey = GlobalKey<FormState>();
GetprofileModel getmodel; GetprofileModel getmodel;
LoginModel logmodel; LoginModel logmodel;
HomePresenter(State<HomePage> state) : super(state); HomePresenter(State<HomePage> state) : super(state);
categoryModel catmodel;
Listitem() async { Listitem() async {
_api = Api<categoryModel>(); _api = Api<categoryModel>();
...@@ -27,21 +29,25 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -27,21 +29,25 @@ class HomePresenter extends BasePresenter<HomePage> {
"access_type": "portal", "access_type": "portal",
}); });
if (res.fail == null) { if (res.fail == null) {
print('res Success'); setState(
() {
catmodel == res.success;
print('res Success' + catmodel.dATA[0].displayName);
},
);
} else { } else {
print('res Fail'); print('res Fail');
} }
} }
Search() async{ Search() async {
_api = Api<SearchhomeModel>(); _api = Api<SearchhomeModel>();
var res = await _api.homesearch({ var res = await _api.homesearch({
"keyword_shop" : "spa", "keyword_shop": "spa",
"lang" : "all", "lang": "all",
"access" : "portal", "access": "portal",
}); });
if (res.fail == null) { if (res.fail == null) {
print('res Success'); print('res Success');
} else { } else {
...@@ -70,29 +76,25 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -70,29 +76,25 @@ class HomePresenter extends BasePresenter<HomePage> {
} }
} }
getid() async {
getid() async {
SharedPreferences pref = await SharedPreferences.getInstance(); SharedPreferences pref = await SharedPreferences.getInstance();
setState(() {uid =pref.getString('Id');}); setState(() {
uid = pref.getString('Id');
});
return uid; return uid;
} }
getprofile() async {
_api = Api<GetprofileModel>();
var res = await _api.getprofile({ getprofile() async {
"id":await AccountUtil.getID() _api = Api<GetprofileModel>();
});
var res = await _api.getprofile({"id": await AccountUtil.getID()});
if (res.fail == null) { if (res.fail == null) {
setState(() { setState(() {
getmodel = res.success;}); getmodel = res.success;
print("Hii"+getmodel.result[0].name); });
} else { print("Hii" + getmodel.result[0].name);
} else {
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
...@@ -117,6 +119,4 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -117,6 +119,4 @@ class HomePresenter extends BasePresenter<HomePage> {
]).show(); ]).show();
} }
} }
} }
...@@ -3,7 +3,6 @@ import 'dart:developer'; ...@@ -3,7 +3,6 @@ import 'dart:developer';
import 'package:feelverapp/model/Login/login_model.dart'; import 'package:feelverapp/model/Login/login_model.dart';
import 'package:feelverapp/service/Loading.dart'; import 'package:feelverapp/service/Loading.dart';
import 'package:feelverapp/service/api.dart'; import 'package:feelverapp/service/api.dart';
...@@ -16,312 +15,296 @@ import 'package:flutter/material.dart'; ...@@ -16,312 +15,296 @@ import 'package:flutter/material.dart';
import 'package:rflutter_alert/rflutter_alert.dart'; import 'package:rflutter_alert/rflutter_alert.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
class LoginPresenter extends BasePresenter<LoginPage> { class LoginPresenter extends BasePresenter<LoginPage> {
Api _api; Api _api;
Timer _timer; Timer _timer;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
TextEditingController emailCtrl = TextEditingController(); TextEditingController emailCtrl = TextEditingController();
TextEditingController passCtrl = TextEditingController(); TextEditingController passCtrl = TextEditingController();
TextEditingController phonenumberCtrl = TextEditingController(); TextEditingController phonenumberCtrl = TextEditingController();
LoginPresenter(State<LoginPage> state) : super(state); LoginPresenter(State<LoginPage> state) : super(state);
/////email Login///////// /////email Login/////////
letCheckData() async { letCheckData() async {
// if(!verifyPhoneState){ // if(!verifyPhoneState){
// throw(allTranslations.text(key: 'please_verify_phone')); // throw(allTranslations.text(key: 'please_verify_phone'));
// } // }
try { try {
if (emailCtrl.text.isEmpty ) throw ('กรุณากรอก\nอีเมล์'); if (emailCtrl.text.isEmpty)
else if (passCtrl.text.isEmpty ) throw('กรุณากรอก\nรหัสผ่าน'); throw ('กรุณากรอก\nอีเมล์');
else if (passCtrl.text.isEmpty) throw ('กรุณากรอก\nรหัสผ่าน');
Pattern pattern =
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+"; Pattern pattern =
RegExp regex = new RegExp(pattern); r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+";
if (!regex.hasMatch(emailCtrl.text)) RegExp regex = new RegExp(pattern);
throw ('รูปแบบอีเมล์\nไม่ถูกต้อง'); if (!regex.hasMatch(emailCtrl.text))
throw ('รูปแบบอีเมล์\nไม่ถูกต้อง');
else { else {
await letSignIn(); await letSignIn();
}
} catch (e) {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
} }
} catch (e) {
} Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
}
}
static saveID(String id) async { static saveID(String id) async {
SharedPreferences pref = await SharedPreferences.getInstance(); SharedPreferences pref = await SharedPreferences.getInstance();
pref.setString('Id', id); pref.setString('Id', id);
} }
letSignIn() async { letSignIn() async {
LoadingView(state.context).show(); LoadingView(state.context).show();
_api = Api<LoginModel>(); _api = Api<LoginModel>();
var res = await _api.login({ var res = await _api.login({
"access_type":"mobile", "access_type": "mobile",
"access_status":"customer", "access_status": "customer",
"email": emailCtrl.text, "email": emailCtrl.text,
'password':passCtrl.text 'password': passCtrl.text
}); });
LoadingView(state.context).hide(); LoadingView(state.context).hide();
if (res.fail == null) { if (res.fail == null) {
LoginModel model = res.success; LoginModel model = res.success;
saveID(model.user.customerInfo.id.toString()); saveID(model.user.customerInfo.id.toString());
print( await AccountUtil.getToken()); print(await AccountUtil.getToken());
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "เข้าสู่ระบบสำเร็จ",
title: "เข้าสู่ระบบสำเร็จ", content: Icon(
content: Icon(Icons.check_circle,color: Color.fromRGBO(106, 179, 170, 1),size: 80,), Icons.check_circle,
buttons: [ color: Color.fromRGBO(106, 179, 170, 1),
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () { Navigator.pop(state.context); buttons: [
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => HomePage(id:model.user.customerInfo.id.toString())));} , DialogButton(
child: Text( color: Color.fromRGBO(106, 179, 170, 1),
"ตกลง", onPressed: () {
style: TextStyle(color: Colors.white, fontSize: 20), Navigator.pop(state.context);
), Navigator.pushReplacement(
) state.context,
]).show(); CupertinoPageRoute(
builder: (_) => HomePage(
await AccountUtil.saveToken(model.token); id: model.user.customerInfo.id.toString())));
print( await AccountUtil.getToken()); },
// print(AccountUtil.getToken().toString()); child: Text(
// print("Username ="+"${model.user}"); "ตกลง",
style: TextStyle(color: Colors.white, fontSize: 20),
),
} else { )
Alert( ]).show();
style: AlertStyle(
animationType: AnimationType.fromTop, await AccountUtil.saveToken(model.token);
isCloseButton: false, print(await AccountUtil.getToken());
// print(AccountUtil.getToken().toString());
), // print("Username ="+"${model.user}");
context: state.context,
title: "อีเมล์หรือรหัสผ่าน\nไม่ถูกต้อง", } else {
content: Icon(Icons.warning,color: Colors.orange,size: 80,), Alert(
buttons: [ style: AlertStyle(
DialogButton( animationType: AnimationType.fromTop,
color: Color.fromRGBO(106, 179, 170, 1), isCloseButton: false,
onPressed: () => Navigator.pop(state.context), ),
child: Text( context: state.context,
"ลองอีกครั้ง", title: "อีเมล์หรือรหัสผ่าน\nไม่ถูกต้อง",
style: TextStyle(color: Colors.white, fontSize: 20), content: Icon(
), Icons.warning,
) color: Colors.orange,
]).show(); 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();
} }
} }
///////phone log in//////////////// ///////phone log in////////////////
letSignIn_phone() async { letSignIn_phone() async {
LoadingView(state.context).show(); LoadingView(state.context).show();
_api = Api<LoginModel>(); _api = Api<LoginModel>();
var res = await _api.login({ var res = await _api.login({
"access_type":"mobile", "access_type": "mobile",
"access_status":"customer", "access_status": "customer",
"email": phonenumberCtrl.text, "email": phonenumberCtrl.text,
'password':passCtrl.text 'password': passCtrl.text
}); });
LoadingView(state.context).hide(); LoadingView(state.context).hide();
if (res.fail == null) { if (res.fail == null) {
LoginModel model = res.success; LoginModel model = res.success;
saveID(model.user.customerInfo.id.toString()); saveID(model.user.customerInfo.id.toString());
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "เข้าสู่ระบบสำเร็จ",
title: "เข้าสู่ระบบสำเร็จ", content: Icon(
content: Icon(Icons.check_circle,color: Color.fromRGBO(106, 179, 170, 1),size: 80,), Icons.check_circle,
buttons: [ color: Color.fromRGBO(106, 179, 170, 1),
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () { Navigator.pop(state.context); buttons: [
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => HomePage()));} , DialogButton(
color: Color.fromRGBO(106, 179, 170, 1),
child: Text( onPressed: () {
"ตกลง", Navigator.pop(state.context);
style: TextStyle(color: Colors.white, fontSize: 20), Navigator.pushReplacement(state.context,
), CupertinoPageRoute(builder: (_) => HomePage()));
) },
]).show(); child: Text(
"ตกลง",
// print("Username ="+"${model.user}"); style: TextStyle(color: Colors.white, fontSize: 20),
),
print("Token ="+"${model.token}"); )
} else { ]).show();
Alert(
style: AlertStyle( // print("Username ="+"${model.user}");
animationType: AnimationType.fromTop,
isCloseButton: false, print("Token =" + "${model.token}");
} else {
), Alert(
context: state.context, style: AlertStyle(
title: "เบอร์โทรศัพท์หรือรหัสผ่าน\nไม่ถูกต้อง", animationType: AnimationType.fromTop,
content: Icon(Icons.warning,color: Colors.orange,size: 80,), isCloseButton: false,
buttons: [ ),
DialogButton( context: state.context,
color: Color.fromRGBO(106, 179, 170, 1), title: "เบอร์โทรศัพท์หรือรหัสผ่าน\nไม่ถูกต้อง",
onPressed: () => Navigator.pop(state.context), content: Icon(
child: Text( Icons.warning,
"ลองอีกครั้ง", color: Colors.orange,
style: TextStyle(color: Colors.white, fontSize: 20), size: 80,
), ),
) buttons: [
]).show(); DialogButton(
color: Color.fromRGBO(106, 179, 170, 1),
onPressed: () => Navigator.pop(state.context),
child: Text(
"ลองอีกครั้ง",
style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
} }
} }
letCheckData_phone() async {
// if(!verifyPhoneState){
// throw(allTranslations.text(key: 'please_verify_phone'));
// }
try {
if (phonenumberCtrl.text.isEmpty ) throw ('กรุณากรอก\nเบอร์โทรศัพท์มือถือ');
else if (passCtrl.text.isEmpty ) throw('กรุณากรอก\nรหัสผ่าน');
Pattern pattern = letCheckData_phone() async {
r'(^(?:[+0]9)?[0-9]{10,12}$)'; // if(!verifyPhoneState){
RegExp regex = new RegExp(pattern); // throw(allTranslations.text(key: 'please_verify_phone'));
if (!regex.hasMatch(phonenumberCtrl.text)) // }
throw ('รูปแบบเบอร์โทรศัพท์\nไม่ถูกต้อง');
else { try {
await letSignIn_phone(); if (phonenumberCtrl.text.isEmpty)
} throw ('กรุณากรอก\nเบอร์โทรศัพท์มือถือ');
} catch (e) { else if (passCtrl.text.isEmpty) throw ('กรุณากรอก\nรหัสผ่าน');
Alert(
style: AlertStyle( Pattern pattern = r'(^(?:[+0]9)?[0-9]{10,12}$)';
animationType: AnimationType.fromTop, RegExp regex = new RegExp(pattern);
isCloseButton: false, if (!regex.hasMatch(phonenumberCtrl.text))
throw ('รูปแบบเบอร์โทรศัพท์\nไม่ถูกต้อง');
), else {
context: state.context, await letSignIn_phone();
title: '$e',
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();
} }
} catch (e) {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
}
}
} // facebookLogin() async {
// try {
// await _facebookLogin.logIn(['email']).then((result) async {
// var fbData = await Api().getFacebookInfo(result.accessToken.token);
// print(fbData);
// await _letSocialSignIn(result.accessToken.userId, 'facebook')
// facebookLogin() async { // .then((value) {
// try { // if (value) {
// await _facebookLogin.logIn(['email']).then((result) async { // Navigator.popUntil(state.context, (route) => route.isFirst);
// var fbData = await Api().getFacebookInfo(result.accessToken.token); // Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) =>
// print(fbData);
// NavigatorPage(),
// await _letSocialSignIn(result.accessToken.userId, 'facebook') // ));
// .then((value) { // } else {
// if (value) { // Navigator.push(
// Navigator.popUntil(state.context, (route) => route.isFirst); // state.context,
// Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => // CupertinoPageRoute(
// builder: (_) => SignUpEmail(
// NavigatorPage(), // socialType: SocialType.facebook,
// )); // socialData: new RegisterSocialDataModel(
// } else { // socialId: result.accessToken.userId,
// Navigator.push( // token: result.accessToken.token,
// state.context, // email: fbData['email'],
// CupertinoPageRoute( // firstName: fbData['first_name'],
// builder: (_) => SignUpEmail( // lastName: fbData['last_name'],
// socialType: SocialType.facebook, // ),
// socialData: new RegisterSocialDataModel( // )));
// socialId: result.accessToken.userId, // }
// token: result.accessToken.token, // });
// email: fbData['email'], // });
// firstName: fbData['first_name'], // } catch (e) {
// lastName: fbData['last_name'], // print(e);
// ), // }
// ))); // }
// }
// });
// });
// } catch (e) {
// print(e);
// }
// }
} }
import 'package:feelverapp/util/SizeConfig.dart'; import 'package:feelverapp/util/SizeConfig.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:date_format/date_format.dart';
class NearmeDetail extends StatefulWidget { class NearmeDetail extends StatefulWidget {
String store_name;
String img_url;
String detail;
String date_time;
String address;
String latlng;
String month;
String distanceWithLocation;
NearmeDetail(
{Key key,
this.store_name,
this.img_url,
this.detail,
this.date_time,
this.address,
this.latlng,this.distanceWithLocation})
: super(key: key);
@override @override
_NearmeDetailState createState() => _NearmeDetailState(); _NearmeDetailState createState() => _NearmeDetailState();
} }
void convertDateFromString(String strDate) {
DateTime todayDate = DateTime.parse(strDate);
print(todayDate);
print(formatDate(todayDate,
[yyyy, ' ', mm, ' ', dd, ' ', hh, ' เวลา: ', nn, ':', ss, ' ', am]));
}
class _NearmeDetailState extends State<NearmeDetail> { class _NearmeDetailState extends State<NearmeDetail> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -24,11 +52,50 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -24,11 +52,50 @@ class _NearmeDetailState extends State<NearmeDetail> {
// fontWeight: FontWeight.w500), // fontWeight: FontWeight.w500),
// ), // ),
// ), // ),
body: _setupView(), body: _setupView(context),
); );
} }
_setupView() { void getMM(String mm, String dd, String yy) {
print('object' + mm);
if (mm == '01') {
mm = 'มกราคม';
}else if (mm == '02') {
mm = 'กุมภาพันธ์';
}else if (mm == '03') {
mm = 'มีนาคม';
}else if (mm == '04') {
mm = 'เมษายน';
}else if (mm == '05') {
mm = 'พฤษภาคม';
}else if (mm == '06') {
mm = 'มิถุนายน';
}else if (mm == '07') {
mm = 'กรกฎาคม';
}else if (mm == '08') {
mm = 'สิงหาคม';
}else if (mm == '09') {
mm = 'กันยายน';
}else if (mm == '10') {
mm = 'ตุลาคม';
}else if (mm == '11') {
mm = 'พฤศจิกายน';
}else if (mm == '12') {
mm = 'ธันวาคม';
}
widget.month = dd + ' '+ mm + ' ' + yy;
print(widget.date_time.toString());
}
_setupView(BuildContext context) {
var mydate = widget.date_time.toString().split(' ');
var mm = mydate[0].toString().split('-');
getMM( mm[1].toString(), mm[2].toString(), mm[0].toString());
var arr = widget.latlng.toString().split(',');
print(arr[0]);
print(arr[1]);
return SingleChildScrollView( return SingleChildScrollView(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
...@@ -37,9 +104,9 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -37,9 +104,9 @@ class _NearmeDetailState extends State<NearmeDetail> {
Container( Container(
height: SizeConfig.getWidth(460), height: SizeConfig.getWidth(460),
child: Image.network( child: Image.network(
'https://res.klook.com/image/upload/fl_lossy.progressive,q_65,f_auto/c_fill,w_1160,h_652/v1522127734/activities/e8mqwlctlagkmzjr4ba1.webp', widget.img_url.toString(),
width: double.maxFinite, width: double.maxFinite,
fit: BoxFit.cover, fit: BoxFit.fitHeight,
), ),
), ),
Positioned( Positioned(
...@@ -62,28 +129,34 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -62,28 +129,34 @@ class _NearmeDetailState extends State<NearmeDetail> {
left: SizeConfig.getPadding( left: SizeConfig.getPadding(
MediaQuery.of(context).size.width / 1.6), MediaQuery.of(context).size.width / 1.6),
), ),
child: Stack( child: GestureDetector(
children: <Widget>[ onTap: () {
Image.asset( launch(
'assets/images/btn_nav.png', 'https://www.google.com/maps/dir/?api=1&destination=${arr[0]},${arr[1]}');
width: SizeConfig.getWidth(120), },
), child: Stack(
Container( children: <Widget>[
child: Text( Image.asset(
'นำทาง', 'assets/images/btn_nav.png',
textAlign: TextAlign.left, width: SizeConfig.getWidth(120),
style: TextStyle(
color: Colors.white,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
), ),
padding: EdgeInsets.only( Container(
top: SizeConfig.getPadding(7), child: Text(
left: SizeConfig.getPadding(26), 'นำทาง',
bottom: SizeConfig.getPadding(4)), textAlign: TextAlign.left,
), style: TextStyle(
], color: Colors.white,
fontSize: SizeConfig.getFontSize(16),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
padding: EdgeInsets.only(
top: SizeConfig.getPadding(7),
left: SizeConfig.getPadding(26),
bottom: SizeConfig.getPadding(4)),
),
],
),
), ),
), ),
], ],
...@@ -93,7 +166,7 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -93,7 +166,7 @@ class _NearmeDetailState extends State<NearmeDetail> {
Container( Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'4 ธ.ค. 2561 18:55 น.', widget.month.toString(),
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.grey, color: Colors.grey,
...@@ -109,7 +182,7 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -109,7 +182,7 @@ class _NearmeDetailState extends State<NearmeDetail> {
Container( Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'Sea Life Bangkok Ocean World', widget.store_name.toString(),
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
fontSize: SizeConfig.getFontSize(40), fontSize: SizeConfig.getFontSize(40),
...@@ -165,7 +238,8 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -165,7 +238,8 @@ class _NearmeDetailState extends State<NearmeDetail> {
size: SizeConfig.getFontSize(16), size: SizeConfig.getFontSize(16),
), ),
SizedBox( SizedBox(
width: SizeConfig.getWidth(40),height: SizeConfig.getWidth(30), width: SizeConfig.getWidth(40),
height: SizeConfig.getWidth(30),
), ),
ImageIcon( ImageIcon(
AssetImage('assets/images/ic_fav_active.png'), AssetImage('assets/images/ic_fav_active.png'),
...@@ -175,7 +249,8 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -175,7 +249,8 @@ class _NearmeDetailState extends State<NearmeDetail> {
SizedBox( SizedBox(
width: SizeConfig.getWidth(8), width: SizeConfig.getWidth(8),
), ),
Container(alignment: Alignment.topLeft, Container(
alignment: Alignment.topLeft,
child: Text( child: Text(
'70', '70',
textAlign: TextAlign.left, textAlign: TextAlign.left,
...@@ -189,9 +264,11 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -189,9 +264,11 @@ class _NearmeDetailState extends State<NearmeDetail> {
top: SizeConfig.getPadding(5), top: SizeConfig.getPadding(5),
left: SizeConfig.getPadding(0), left: SizeConfig.getPadding(0),
bottom: SizeConfig.getPadding(4)), bottom: SizeConfig.getPadding(4)),
),SizedBox( ),
SizedBox(
width: SizeConfig.getWidth(20), width: SizeConfig.getWidth(20),
),ImageIcon( ),
ImageIcon(
AssetImage('assets/images/ic_comment.png'), AssetImage('assets/images/ic_comment.png'),
color: Colors.grey, color: Colors.grey,
size: SizeConfig.getFontSize(16), size: SizeConfig.getFontSize(16),
...@@ -199,7 +276,8 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -199,7 +276,8 @@ class _NearmeDetailState extends State<NearmeDetail> {
SizedBox( SizedBox(
width: SizeConfig.getWidth(8), width: SizeConfig.getWidth(8),
), ),
Container(alignment: Alignment.topLeft, Container(
alignment: Alignment.topLeft,
child: Text( child: Text(
'70', '70',
textAlign: TextAlign.left, textAlign: TextAlign.left,
...@@ -213,45 +291,51 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -213,45 +291,51 @@ class _NearmeDetailState extends State<NearmeDetail> {
top: SizeConfig.getPadding(5), top: SizeConfig.getPadding(5),
left: SizeConfig.getPadding(0), left: SizeConfig.getPadding(0),
bottom: SizeConfig.getPadding(4)), bottom: SizeConfig.getPadding(4)),
),SizedBox( ),
SizedBox(
width: SizeConfig.getWidth(20), width: SizeConfig.getWidth(20),
),ImageIcon( ),
ImageIcon(
AssetImage('assets/images/facebook-icon.png'), AssetImage('assets/images/facebook-icon.png'),
color: Colors.grey, color: Colors.grey,
size: SizeConfig.getFontSize(16), size: SizeConfig.getFontSize(16),
), ),
SizedBox( SizedBox(
width: SizeConfig.getWidth(20), width: SizeConfig.getWidth(20),
),ImageIcon( ),
ImageIcon(
AssetImage('assets/images/ic_twitter.png'), AssetImage('assets/images/ic_twitter.png'),
color: Colors.grey, color: Colors.grey,
size: SizeConfig.getFontSize(16), size: SizeConfig.getFontSize(16),
), ),
], ],
), ),
// SizedBox(
// height: SizeConfig.getWidth(8),
// ),
// Container(
// alignment: Alignment.topLeft,
// child: Text(
// 'พิพิธภัณฑ์สัตว์น้ำ',
// textAlign: TextAlign.left,
// style: TextStyle(
// color: Colors.grey,
// fontSize: SizeConfig.getFontSize(14),
// fontFamily: "SF_Pro_Text",
// fontWeight: FontWeight.w500),
// ),
// padding: EdgeInsets.only(
// top: SizeConfig.getPadding(0),
// left: SizeConfig.getPadding(16),
// bottom: SizeConfig.getPadding(10)),
// ),
SizedBox( SizedBox(
height: SizeConfig.getWidth(8), height: SizeConfig.getHeight(10),
),
Container(
alignment: Alignment.topLeft,
child: Text(
'พิพิธภัณฑ์สัตว์น้ำ',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.grey,
fontSize: SizeConfig.getFontSize(14),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
padding: EdgeInsets.only(
top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(16),
bottom: SizeConfig.getPadding(10)),
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
SizedBox( SizedBox(
width: SizeConfig.getWidth(14), width: SizeConfig.getWidth(16),
), ),
ImageIcon( ImageIcon(
AssetImage('assets/images/pin_drop.png'), AssetImage('assets/images/pin_drop.png'),
...@@ -262,7 +346,7 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -262,7 +346,7 @@ class _NearmeDetailState extends State<NearmeDetail> {
width: SizeConfig.getWidth(4), width: SizeConfig.getWidth(4),
), ),
Text( Text(
'54 km', widget.distanceWithLocation.toString(),
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: SizeConfig.getFontSize(14), fontSize: SizeConfig.getFontSize(14),
...@@ -274,7 +358,7 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -274,7 +358,7 @@ class _NearmeDetailState extends State<NearmeDetail> {
Container( Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'ที่อยู่: 991 ถนน พระรามที่ ๑ แขวง ปทุมวัน เขต ปทุมวัน กรุงเทพมหานคร 10330', widget.address.toString(),
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.grey, color: Colors.grey,
...@@ -284,14 +368,15 @@ class _NearmeDetailState extends State<NearmeDetail> { ...@@ -284,14 +368,15 @@ class _NearmeDetailState extends State<NearmeDetail> {
), ),
// alignment: Alignment.topLeft, // alignment: Alignment.topLeft,
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(8), top: SizeConfig.getPadding(10),
left: SizeConfig.getPadding(16), left: SizeConfig.getPadding(16),
right: SizeConfig.getPadding(16),
bottom: SizeConfig.getPadding(10)), bottom: SizeConfig.getPadding(10)),
), ),
Container( Container(
alignment: Alignment.topLeft, alignment: Alignment.topLeft,
child: Text( child: Text(
'พิพิธภัณฑ์สัตว์น้ำ ซี ไลฟ์ โอเชียน เวิลด์ กรุงเทพ หรือ บางกอก ซี ไลฟ์ โอเชียนเวิลด์ (อังกฤษ: Sea Life Bangkok Ocean World; ชื่อเดิม: สยามโอเชียนเวิลด์) เป็นพิพิธภัณฑ์สัตว์น้ำใต้ดิน พื้นที่รวม 10,000 ตาราง เมตร ตั้งอยู่ที่ชั้น B1 และ B2 ศูนย์การค้าสยามพารากอน บริหารงานโดย เมอร์ลิน เอ็นเตอร์เทนเมนท์ กรุ๊ป เปิดให้เข้าชมครั้งแรกเมื่อวันที่ 9 ธันวาคม พ.ศ. 2548 พิพิธภัณฑ์สัตว์น้ำ ซี ไลฟ์ โอเชียน เวิลด์ กรุงเทพ หรือ บางกอก ซี ไลฟ์ โอเชียนเวิลด์ (อังกฤษ: Sea Life Bangkok Ocean World; ชื่อเดิม: สยามโอเชียนเวิลด์) เป็นพิพิธภัณฑ์สัตว์น้ำใต้ดิน พื้นที่รวม 10,000 ตารางเมตร ตั้งอยู่ที่ชั้น B1 และ B2 ศูนย์การค้าสยามพารากอน บริหารงานโดย เมอร์ลิน เอ็นเตอร์เทนเมนท์ กรุ๊ป เปิดให้เข้าชมครั้งแรกเมื่อวันที่ 9 ธันวาคม พ.ศ. 2548', widget.detail.toString(),
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
......
import 'package:feelverapp/ui/nearme/near_me_detail.dart'; import 'package:feelverapp/ui/nearme/near_me_detail.dart';
import 'package:feelverapp/ui/nearme/near_me_list_presenter.dart';
import 'package:feelverapp/util/SizeConfig.dart'; import 'package:feelverapp/util/SizeConfig.dart';
import 'package:feelverapp/util/Util.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -8,7 +10,22 @@ class NearmeList extends StatefulWidget { ...@@ -8,7 +10,22 @@ class NearmeList extends StatefulWidget {
_NearmeListState createState() => _NearmeListState(); _NearmeListState createState() => _NearmeListState();
} }
class _NearmeListState extends State<NearmeList> { class _NearmeListState extends State<NearmeList> with TickerProviderStateMixin {
NearmeListPresenter presenter;
@override
void initState() {
super.initState();
presenter = NearmeListPresenter(this);
presenter.getnearme();
}
@override
void dispose() {
super.dispose();
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -45,7 +62,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -45,7 +62,7 @@ class _NearmeListState extends State<NearmeList> {
children: <Widget>[ children: <Widget>[
FilterChip( FilterChip(
label: Text( label: Text(
"ทั้งหมด (10)", "ทั้งหมด",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: SizeConfig.getFontSize(15), fontSize: SizeConfig.getFontSize(15),
...@@ -58,12 +75,14 @@ class _NearmeListState extends State<NearmeList> { ...@@ -58,12 +75,14 @@ class _NearmeListState extends State<NearmeList> {
), ),
onSelected: (bool value) { onSelected: (bool value) {
print("selected"); print("selected");
setState(() {}); setState(() {
presenter.type = "";
});
}, },
), ),
FilterChip( FilterChip(
label: Text( label: Text(
"ที่เที่ยว (5)", "ที่เที่ยว",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: SizeConfig.getFontSize(15), fontSize: SizeConfig.getFontSize(15),
...@@ -80,7 +99,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -80,7 +99,7 @@ class _NearmeListState extends State<NearmeList> {
), ),
FilterChip( FilterChip(
label: Text( label: Text(
"ที่กิน (3)", "ที่กิน",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: SizeConfig.getFontSize(15), fontSize: SizeConfig.getFontSize(15),
...@@ -97,7 +116,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -97,7 +116,7 @@ class _NearmeListState extends State<NearmeList> {
), ),
FilterChip( FilterChip(
label: Text( label: Text(
"ที่พัก (1)", "ที่พัก",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: SizeConfig.getFontSize(15), fontSize: SizeConfig.getFontSize(15),
...@@ -114,7 +133,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -114,7 +133,7 @@ class _NearmeListState extends State<NearmeList> {
), ),
FilterChip( FilterChip(
label: Text( label: Text(
"กิจกรรม (1)", "กิจกรรม",
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: SizeConfig.getFontSize(15), fontSize: SizeConfig.getFontSize(15),
...@@ -139,41 +158,70 @@ class _NearmeListState extends State<NearmeList> { ...@@ -139,41 +158,70 @@ class _NearmeListState extends State<NearmeList> {
} }
_getlist() { _getlist() {
final List<String> entries = <String>['A', 'B', 'C']; print(presenter.getmodel);
return Container( return presenter.getmodel == null
padding: EdgeInsets.only( ? Container(
top: SizeConfig.getPadding(140), child: Center(
left: SizeConfig.getPadding(16), child: CircularProgressIndicator(
right: SizeConfig.getPadding(16), valueColor: new AlwaysStoppedAnimation<Color>(Colors.teal),
bottom: SizeConfig.getPadding(10), )))
), : Container(
child: ListView.builder( padding: EdgeInsets.only(
itemCount: entries.length, top: SizeConfig.getPadding(140),
itemBuilder: (context, i) { left: SizeConfig.getPadding(16),
return _nearByItem(entries[i]); 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) { Widget _nearByItem(String title, String detail, String img, String address,
String latlng, String date_time, String distanceWithLocation) {
return InkWell( return InkWell(
onTap: () { onTap: () {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( CupertinoPageRoute(
builder: (context) => NearmeDetail(), builder: (context) => NearmeDetail(
store_name: title,
img_url: 'https://backend.feelver.com/storage/' + img,
detail: Util.removeHTMLTag('${detail}'),
address: address,
latlng: latlng,
date_time: date_time,
distanceWithLocation: distanceWithLocation + ' Km. ',
),
), ),
); );
}, child: Card( },
child: Card(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Image.network( SizedBox(
'https://scontent.fbkk2-8.fna.fbcdn.net/v/t1.0-9/66224920_2384272051596091_1094623379467534336_n.jpg?_nc_cat=102&_nc_sid=85a577&_nc_eui2=AeElfU4QES6XQW0XzlV5G9zQ-F-e_QdADw_4X579B0APD-UJsAV-PuXX-iMA6hWVLgUUmCNm5HTgTMw_q4YARQm8&_nc_ohc=do7yQl7hf74AX8-8Yk-&_nc_ht=scontent.fbkk2-8.fna&oh=140482c64ecf1893bf59498dfff5f592&oe=5EFAC9CF', width: SizeConfig.getWidth(16),
width: SizeConfig.getWidth(110), ),
height: SizeConfig.getHeight(150), Expanded(
fit: BoxFit.fitWidth, child: Image.network(
'https://backend.feelver.com/storage/' + img,
// width: SizeConfig.getWidth(50),
height: SizeConfig.getHeight(160),
fit: BoxFit.fitHeight,
),
), ),
Expanded( Expanded(
child: Column( child: Column(
...@@ -181,7 +229,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -181,7 +229,7 @@ class _NearmeListState extends State<NearmeList> {
children: <Widget>[ children: <Widget>[
Container( Container(
child: Text( child: Text(
'ซีไลฟ์ แบงคอก โอเชียน เวิลด์', title,
style: TextStyle( style: TextStyle(
color: Colors.black87, color: Colors.black87,
fontSize: SizeConfig.getFontSize(16), fontSize: SizeConfig.getFontSize(16),
...@@ -189,26 +237,29 @@ class _NearmeListState extends State<NearmeList> { ...@@ -189,26 +237,29 @@ class _NearmeListState extends State<NearmeList> {
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
), ),
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(16), top: SizeConfig.getPadding(30),
left: SizeConfig.getPadding(16), left: SizeConfig.getPadding(16),
right: SizeConfig.getPadding(16), right: SizeConfig.getPadding(16),
bottom: SizeConfig.getPadding(4)), bottom: SizeConfig.getPadding(4)),
), ),
Container( // Container(
child: Text( // child: Text(
'พิพิธภัณฑ์สัตว์น้ำ', // '',
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),
), // ),
// alignment: Alignment.topLeft, //// alignment: Alignment.topLeft,
padding: EdgeInsets.only( // padding: EdgeInsets.only(
top: SizeConfig.getPadding(0), // top: SizeConfig.getPadding(0),
left: SizeConfig.getPadding(16), // left: SizeConfig.getPadding(16),
bottom: SizeConfig.getPadding(4)), // bottom: SizeConfig.getPadding(4)),
// ),
SizedBox(
height: 8,
), ),
Row( Row(
children: <Widget>[ children: <Widget>[
...@@ -224,7 +275,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -224,7 +275,7 @@ class _NearmeListState extends State<NearmeList> {
width: SizeConfig.getWidth(4), width: SizeConfig.getWidth(4),
), ),
Text( Text(
'54 km', distanceWithLocation + ' Km.',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(12),
...@@ -235,8 +286,9 @@ class _NearmeListState extends State<NearmeList> { ...@@ -235,8 +286,9 @@ class _NearmeListState extends State<NearmeList> {
), ),
Container( Container(
child: Text( child: Text(
'พิพิธภัณฑ์สัตว์น้ำ ซี ไลฟ์ โอเชียน เวิลด์ กรุงเทพ หรือ บางกอก ซี ไลฟ์ โอเชียนเวิลด์...', Util.removeHTMLTag('${detail}'),
textAlign: TextAlign.left, textAlign: TextAlign.left,
maxLines: 3,
style: TextStyle( style: TextStyle(
color: Colors.black54, color: Colors.black54,
fontSize: SizeConfig.getFontSize(12), fontSize: SizeConfig.getFontSize(12),
...@@ -247,6 +299,7 @@ class _NearmeListState extends State<NearmeList> { ...@@ -247,6 +299,7 @@ class _NearmeListState extends State<NearmeList> {
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: SizeConfig.getPadding(8), top: SizeConfig.getPadding(8),
left: SizeConfig.getPadding(16), left: SizeConfig.getPadding(16),
right: SizeConfig.getPadding(8),
bottom: SizeConfig.getPadding(0)), bottom: SizeConfig.getPadding(0)),
), ),
Row( Row(
...@@ -311,11 +364,12 @@ class _NearmeListState extends State<NearmeList> { ...@@ -311,11 +364,12 @@ class _NearmeListState extends State<NearmeList> {
size: SizeConfig.getFontSize(16), size: SizeConfig.getFontSize(16),
), ),
SizedBox( SizedBox(
width: SizeConfig.getWidth(40), width: SizeConfig.getWidth(20),
height: SizeConfig.getWidth(30), height: SizeConfig.getWidth(30),
), ),
], ],
), SizedBox( ),
SizedBox(
height: SizeConfig.getWidth(10), height: SizeConfig.getWidth(10),
), ),
], ],
......
import 'package:feelverapp/home_search/searchhomepage_model.dart';
import 'package:feelverapp/model/Login/login_model.dart';
import 'package:feelverapp/model/category/category_model.dart';
import 'package:feelverapp/model/editprofile/getprofilemodel.dart';
import 'package:feelverapp/model/home/home_model.dart';
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 'near_me_list.dart';
class NearmeListPresenter extends BasePresenter<NearmeList> {
final formkey = GlobalKey<FormState>();
Api _api;
String type = '3';
NearMeListModel getmodel ;
NearmeListPresenter(State<NearmeList> state) : super(state);
getnearme() async {
_api = Api<NearMeListModel>();
var res = await _api.getNearList({});
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();
// }
// }
}
...@@ -4,7 +4,6 @@ import 'dart:developer'; ...@@ -4,7 +4,6 @@ import 'dart:developer';
import 'package:feelverapp/model/Login/login_model.dart'; import 'package:feelverapp/model/Login/login_model.dart';
import 'package:feelverapp/model/register/register_model.dart'; import 'package:feelverapp/model/register/register_model.dart';
import 'package:feelverapp/service/Loading.dart'; import 'package:feelverapp/service/Loading.dart';
import 'package:feelverapp/service/api.dart'; import 'package:feelverapp/service/api.dart';
...@@ -16,11 +15,9 @@ import 'package:flutter/cupertino.dart'; ...@@ -16,11 +15,9 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rflutter_alert/rflutter_alert.dart'; import 'package:rflutter_alert/rflutter_alert.dart';
class RegisterPresenter extends BasePresenter<Registerpage> { class RegisterPresenter extends BasePresenter<Registerpage> {
Api _api; Api _api;
Timer _timer; Timer _timer;
final formKey = GlobalKey<FormState>(); final formKey = GlobalKey<FormState>();
TextEditingController emailCtrl = TextEditingController(); TextEditingController emailCtrl = TextEditingController();
TextEditingController passCtrl = TextEditingController(); TextEditingController passCtrl = TextEditingController();
...@@ -28,303 +25,276 @@ class RegisterPresenter extends BasePresenter<Registerpage> { ...@@ -28,303 +25,276 @@ class RegisterPresenter extends BasePresenter<Registerpage> {
TextEditingController lastnameCtrl = TextEditingController(); TextEditingController lastnameCtrl = TextEditingController();
TextEditingController phonenumberCtrl = TextEditingController(); TextEditingController phonenumberCtrl = TextEditingController();
RegisterPresenter(State<Registerpage> state) : super(state); RegisterPresenter(State<Registerpage> state) : super(state);
/////email Login///////// /////email Login/////////
letCheckData() async { letCheckData() async {
try {
if (emailCtrl.text.isEmpty)
try { throw ('กรุณากรอก\nอีเมล์');
if (emailCtrl.text.isEmpty ) throw ('กรุณากรอก\nอีเมล์'); else if (passCtrl.text.isEmpty)
else if (passCtrl.text.isEmpty ) throw('กรุณากรอก\nรหัสผ่าน'); throw ('กรุณากรอก\nรหัสผ่าน');
else if(firstnameCtrl.text.isEmpty) throw('กรุณากรอกชื่อ'); else if (firstnameCtrl.text.isEmpty)
else if(lastnameCtrl.text.isEmpty) throw('กรุณากรอกนามสกุล'); throw ('กรุณากรอกชื่อ');
else if (lastnameCtrl.text.isEmpty) throw ('กรุณากรอกนามสกุล');
Pattern pattern =
r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+"; Pattern pattern =
RegExp regex = new RegExp(pattern); r"^[a-zA-Z0-9.a-zA-Z0-9.!#$%&'*+-/=?^_`{|}~]+@[a-zA-Z0-9]+\.[a-zA-Z]+";
if (!regex.hasMatch(emailCtrl.text)) RegExp regex = new RegExp(pattern);
throw ('รูปแบบอีเมล์\nไม่ถูกต้อง'); if (!regex.hasMatch(emailCtrl.text)) throw ('รูปแบบอีเมล์\nไม่ถูกต้อง');
Pattern pattern2 = Pattern pattern2 = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$';
r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$'; RegExp regex2 = new RegExp(pattern2);
RegExp regex2 = new RegExp(pattern2); if (!regex2.hasMatch(passCtrl.text))
if (!regex2.hasMatch(passCtrl.text)) throw ('รหัสผ่านต้องมีความยาวอย่าง น้อย 8 ตัวอักษร และต้องประกอบด้วยอักขระ ดังต่อไปนี้\n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์เล็ก (a-z) \n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์ใหญ่ (A-Z) \n- ตัวเลข (0-9)');
throw ('รหัสผ่านต้องมีความยาวอย่าง น้อย 8 ตัวอักษร และต้องประกอบด้วยอักขระ ดังต่อไปนี้\n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์เล็ก (a-z) \n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์ใหญ่ (A-Z) \n- ตัวเลข (0-9)'); else {
await letregis();
else {
await letregis();
print("completeee"); print("completeee");
}
} catch (e) {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
} }
} catch (e) {
} Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
}
}
letregis() async { letregis() async {
LoadingView(state.context).show(); LoadingView(state.context).show();
_api = Api<RegisterModel>(); _api = Api<RegisterModel>();
var res = await _api.register({ var res = await _api.register({
"access_type":"mobile", "access_type": "mobile",
"name":firstnameCtrl.text, "name": firstnameCtrl.text,
"last_name":lastnameCtrl.text, "last_name": lastnameCtrl.text,
"email": emailCtrl.text, "email": emailCtrl.text,
'password':passCtrl.text 'password': passCtrl.text
}); });
LoadingView(state.context).hide(); LoadingView(state.context).hide();
if (res.fail == null) { if (res.fail == null) {
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "สมัครสมาชิกสำเร็จ",
title: "สมัครสมาชิกสำเร็จ", content: Icon(
content: Icon(Icons.check_circle,color: Color.fromRGBO(106, 179, 170, 1),size: 80,), Icons.check_circle,
buttons: [ color: Color.fromRGBO(106, 179, 170, 1),
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () => buttons: [
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => LoginPage())), DialogButton(
child: Text( color: Color.fromRGBO(106, 179, 170, 1),
"ตกลง", onPressed: () => Navigator.pushReplacement(state.context,
style: TextStyle(color: Colors.white, fontSize: 20), CupertinoPageRoute(builder: (_) => LoginPage())),
), child: Text(
) "ตกลง",
]).show(); style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
RegisterModel model = res.success; RegisterModel model = res.success;
// print("Username ="+"${model.user}"); // print("Username ="+"${model.user}");
print("Regist message ="+"${model.message}"); print("Regist message =" + "${model.message}");
} else { } else {
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "อีเมล์\nมีการลงทะเบียนแล้ว",
title: "อีเมล์\nมีการลงทะเบียนแล้ว", content: Icon(
content: Icon(Icons.warning,color: Colors.orange,size: 80,), Icons.warning,
buttons: [ color: Colors.orange,
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () => Navigator.pop(state.context), buttons: [
child: Text( DialogButton(
"ลองอีกครั้ง", color: Color.fromRGBO(106, 179, 170, 1),
style: TextStyle(color: Colors.white, fontSize: 20), onPressed: () => Navigator.pop(state.context),
), child: Text(
) "ลองอีกครั้ง",
]).show(); style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
} }
} }
///////phone log in//////////////// ///////phone log in////////////////
letregis_phone() async { letregis_phone() async {
LoadingView(state.context).show(); LoadingView(state.context).show();
_api = Api<RegisterModel>(); _api = Api<RegisterModel>();
var res = await _api.register({ var res = await _api.register({
"access_type":"mobile", "access_type": "mobile",
"phone_number": phonenumberCtrl.text, "phone_number": phonenumberCtrl.text,
'password':passCtrl.text 'password': passCtrl.text
}); });
LoadingView(state.context).hide(); LoadingView(state.context).hide();
if (res.fail == null) { if (res.fail == null) {
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "สมัครสมาชิกสำเร็จ",
title: "สมัครสมาชิกสำเร็จ", content: Icon(
content: Icon(Icons.check_circle,color: Color.fromRGBO(106, 179, 170, 1),size: 80,), Icons.check_circle,
buttons: [ color: Color.fromRGBO(106, 179, 170, 1),
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () => buttons: [
Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => LoginPage())), DialogButton(
child: Text( color: Color.fromRGBO(106, 179, 170, 1),
"ตกลง", onPressed: () => Navigator.pushReplacement(state.context,
style: TextStyle(color: Colors.white, fontSize: 20), CupertinoPageRoute(builder: (_) => LoginPage())),
), child: Text(
) "ตกลง",
]).show(); style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
RegisterModel model = res.success; RegisterModel model = res.success;
// print("Username ="+"${model.user}"); // print("Username ="+"${model.user}");
print("Regist message ="+"${model.message}"); print("Regist message =" + "${model.message}");
} else { } else {
Alert( Alert(
style: AlertStyle( style: AlertStyle(
animationType: AnimationType.fromTop, animationType: AnimationType.fromTop,
isCloseButton: false, isCloseButton: false,
),
), context: state.context,
context: state.context, title: "เบอร์โทรศัพท์ของท่าน\nมีการลงทะเบียนแล้ว",
title: "เบอร์โทรศัพท์ของท่าน\nมีการลงทะเบียนแล้ว", content: Icon(
content: Icon(Icons.warning,color: Colors.orange,size: 80,), Icons.warning,
buttons: [ color: Colors.orange,
DialogButton( size: 80,
color: Color.fromRGBO(106, 179, 170, 1), ),
onPressed: () => Navigator.pop(state.context), buttons: [
child: Text( DialogButton(
"ลองอีกครั้ง", color: Color.fromRGBO(106, 179, 170, 1),
style: TextStyle(color: Colors.white, fontSize: 20), onPressed: () => Navigator.pop(state.context),
), child: Text(
) "ลองอีกครั้ง",
]).show(); style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
} }
} }
letCheckData_phone() async {
// if(!verifyPhoneState){
// throw(allTranslations.text(key: 'please_verify_phone'));
// }
try {
if (phonenumberCtrl.text.isEmpty ) throw ('กรุณากรอก\nเบอร์โทรศัพท์มือถือ');
else if (passCtrl.text.isEmpty ) throw('กรุณากรอก\nรหัสผ่าน');
Pattern pattern =
r'(^(?:[+0]9)?[0-9]{10,12}$)';
RegExp regex = new RegExp(pattern);
if (!regex.hasMatch(phonenumberCtrl.text))
throw ('รูปแบบเบอร์โทรศัพท์\nไม่ถูกต้อง');
Pattern pattern2 = letCheckData_phone() async {
r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$'; // if(!verifyPhoneState){
RegExp regex2 = new RegExp(pattern2); // throw(allTranslations.text(key: 'please_verify_phone'));
if (!regex2.hasMatch(passCtrl.text)) // }
throw ('รหัสผ่านต้องมีความยาวอย่าง น้อย 8 ตัวอักษร และต้องประกอบด้วยอักขระ ดังต่อไปนี้\n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์เล็ก (a-z) \n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์ใหญ่ (A-Z) \n- ตัวเลข (0-9)');
try {
if (phonenumberCtrl.text.isEmpty)
else { throw ('กรุณากรอก\nเบอร์โทรศัพท์มือถือ');
await letregis_phone(); else if (passCtrl.text.isEmpty) throw ('กรุณากรอก\nรหัสผ่าน');
print("complete");
} Pattern pattern = r'(^(?:[+0]9)?[0-9]{10,12}$)';
} catch (e) { RegExp regex = new RegExp(pattern);
Alert( if (!regex.hasMatch(phonenumberCtrl.text))
style: AlertStyle( throw ('รูปแบบเบอร์โทรศัพท์\nไม่ถูกต้อง');
animationType: AnimationType.fromTop,
isCloseButton: false, Pattern pattern2 = r'^(?=.*?[A-Z])(?=.*?[a-z])(?=.*?[0-9]).{8,}$';
RegExp regex2 = new RegExp(pattern2);
), if (!regex2.hasMatch(passCtrl.text))
context: state.context, throw ('รหัสผ่านต้องมีความยาวอย่าง น้อย 8 ตัวอักษร และต้องประกอบด้วยอักขระ ดังต่อไปนี้\n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์เล็ก (a-z) \n- ตัวอักษรภาษาอังกฤษ ตัวพิมพ์ใหญ่ (A-Z) \n- ตัวเลข (0-9)');
title: '$e', else {
content: Icon(Icons.warning,color: Colors.orange,size: 80,), await letregis_phone();
buttons: [ print("complete");
DialogButton(
color: Color.fromRGBO(106, 179, 170, 1),
onPressed: () => Navigator.pop(state.context),
child: Text(
"ตกลง",
style: TextStyle(color: Colors.white, fontSize: 20),
),
)
]).show();
} }
} catch (e) {
Alert(
style: AlertStyle(
animationType: AnimationType.fromTop,
isCloseButton: false,
),
context: state.context,
title: '$e',
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();
}
}
} // facebookLogin() async {
// try {
// await _facebookLogin.logIn(['email']).then((result) async {
// var fbData = await Api().getFacebookInfo(result.accessToken.token);
// print(fbData);
// await _letSocialSignIn(result.accessToken.userId, 'facebook')
// facebookLogin() async { // .then((value) {
// try { // if (value) {
// await _facebookLogin.logIn(['email']).then((result) async { // Navigator.popUntil(state.context, (route) => route.isFirst);
// var fbData = await Api().getFacebookInfo(result.accessToken.token); // Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) =>
// print(fbData);
// NavigatorPage(),
// await _letSocialSignIn(result.accessToken.userId, 'facebook') // ));
// .then((value) { // } else {
// if (value) { // Navigator.push(
// Navigator.popUntil(state.context, (route) => route.isFirst); // state.context,
// Navigator.pushReplacement(state.context, CupertinoPageRoute(builder: (_) => // CupertinoPageRoute(
// builder: (_) => SignUpEmail(
// NavigatorPage(), // socialType: SocialType.facebook,
// )); // socialData: new RegisterSocialDataModel(
// } else { // socialId: result.accessToken.userId,
// Navigator.push( // token: result.accessToken.token,
// state.context, // email: fbData['email'],
// CupertinoPageRoute( // firstName: fbData['first_name'],
// builder: (_) => SignUpEmail( // lastName: fbData['last_name'],
// socialType: SocialType.facebook, // ),
// socialData: new RegisterSocialDataModel( // )));
// socialId: result.accessToken.userId, // }
// token: result.accessToken.token, // });
// email: fbData['email'], // });
// firstName: fbData['first_name'], // } catch (e) {
// lastName: fbData['last_name'], // print(e);
// ), // }
// ))); // }
// }
// });
// });
// } catch (e) {
// print(e);
// }
// }
} }
...@@ -250,7 +250,7 @@ class _ReserveListState extends State<ReserveList> { ...@@ -250,7 +250,7 @@ class _ReserveListState extends State<ReserveList> {
ClipRRect( ClipRRect(
borderRadius: BorderRadius.circular(50), borderRadius: BorderRadius.circular(50),
child: Image.network( child: Image.network(
'https://scontent.fbkk7-2.fna.fbcdn.net/v/t1.0-9/104204530_3370427592977187_6031309814586327212_o.jpg?_nc_cat=106&_nc_sid=110474&_nc_eui2=AeE2vpoR5NHZLbG8b3YABiSdSsMCoPYM3W1KwwKg9gzdbZuYqR1gPnkW3tGe-TS2Vtphdvn2OuvO2CdDLaCMVvcI&_nc_ohc=T5EK3sWOgtAAX994m4I&_nc_ht=scontent.fbkk7-2.fna&oh=0b3e434546b19e256c07ecd6a4d499fb&oe=5F098A94', 'https://scontent.fbkk6-2.fna.fbcdn.net/v/t1.0-9/80389874_111678823672376_4074351232779550720_n.jpg?_nc_cat=103&_nc_sid=dd9801&_nc_eui2=AeHBe_c_AYOcX30ES1cQGlcXShc5ivTsjQtKFzmK9OyNCwzw_ntkQ5eSPr8UZ-yqpKcklZYNfzdU055U-vGIFozt&_nc_ohc=Wgu6buTE8ecAX9S-qj3&_nc_ht=scontent.fbkk6-2.fna&oh=30e01e7bcf2f81cf48e95d7a512f4110&oe=5F580EF5',
width: 85.0, width: 85.0,
height: 85.0, height: 85.0,
fit: BoxFit.cover, fit: BoxFit.cover,
......
import 'package:html/parser.dart' as htmlParser;
class Util {
static removeHTMLTag(String html){
return htmlParser.parse(html).documentElement.text;
}
}
\ No newline at end of file
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: 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: async:
dependency: transitive dependency: transitive
description: description:
name: async name: async
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.1" version: "2.4.2"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
...@@ -29,6 +15,13 @@ packages: ...@@ -29,6 +15,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.0" version: "2.0.0"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.0"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
...@@ -36,27 +29,27 @@ packages: ...@@ -36,27 +29,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.3" version: "1.1.3"
collection: clock:
dependency: transitive dependency: transitive
description: description:
name: collection name: clock
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.14.12" version: "1.0.1"
convert: collection:
dependency: transitive dependency: transitive
description: description:
name: convert name: collection
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "1.14.13"
crypto: csslib:
dependency: transitive dependency: transitive
description: description:
name: crypto name: csslib
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.4" version: "0.16.2"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -64,6 +57,20 @@ packages: ...@@ -64,6 +57,20 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
date_format:
dependency: "direct main"
description:
name: date_format
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: file:
dependency: transitive dependency: transitive
description: description:
...@@ -100,13 +107,20 @@ packages: ...@@ -100,13 +107,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
html:
dependency: "direct main"
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0+3"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
name: http name: http
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.1" version: "0.12.2"
http_parser: http_parser:
dependency: transitive dependency: transitive
description: description:
...@@ -114,20 +128,13 @@ packages: ...@@ -114,20 +128,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.4" version: "3.1.4"
image:
dependency: transitive
description:
name: image
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.12"
image_cropper: image_cropper:
dependency: "direct main" dependency: "direct main"
description: description:
name: image_cropper name: image_cropper
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.2.3" version: "1.3.0"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -169,7 +176,7 @@ packages: ...@@ -169,7 +176,7 @@ packages:
name: matcher name: matcher
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.12.6" version: "0.12.8"
meta: meta:
dependency: transitive dependency: transitive
description: description:
...@@ -183,7 +190,7 @@ packages: ...@@ -183,7 +190,7 @@ packages:
name: path name: path
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.6.4" version: "1.7.0"
path_provider_linux: path_provider_linux:
dependency: transitive dependency: transitive
description: description:
...@@ -204,21 +211,21 @@ packages: ...@@ -204,21 +211,21 @@ packages:
name: pedantic name: pedantic
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0+1" version: "1.9.0"
petitparser: platform:
dependency: transitive dependency: transitive
description: description:
name: petitparser name: platform
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.0" version: "2.2.1"
platform: platform_detect:
dependency: transitive dependency: transitive
description: description:
name: platform name: platform_detect
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.2.1" version: "1.4.0"
plugin_platform_interface: plugin_platform_interface:
dependency: transitive dependency: transitive
description: description:
...@@ -233,13 +240,13 @@ packages: ...@@ -233,13 +240,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.0.13" version: "3.0.13"
quiver: pub_semver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: pub_semver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "1.4.4"
rflutter_alert: rflutter_alert:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -300,7 +307,7 @@ packages: ...@@ -300,7 +307,7 @@ packages:
name: stack_trace name: stack_trace
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.3" version: "1.9.5"
stream_channel: stream_channel:
dependency: transitive dependency: transitive
description: description:
...@@ -328,14 +335,49 @@ packages: ...@@ -328,14 +335,49 @@ packages:
name: test_api name: test_api
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.2.15" version: "0.2.17"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
name: typed_data name: typed_data
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.1.6" version: "1.2.0"
url_launcher:
dependency: "direct main"
description:
name: url_launcher
url: "https://pub.dartlang.org"
source: hosted
version: "5.5.0"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+1"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
url: "https://pub.dartlang.org"
source: hosted
version: "0.0.1+7"
url_launcher_platform_interface:
dependency: transitive
description:
name: url_launcher_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.7"
url_launcher_web:
dependency: transitive
description:
name: url_launcher_web
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
vector_math: vector_math:
dependency: transitive dependency: transitive
description: description:
...@@ -350,13 +392,6 @@ packages: ...@@ -350,13 +392,6 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.0" version: "0.1.0"
xml:
dependency: transitive
description:
name: xml
url: "https://pub.dartlang.org"
source: hosted
version: "3.6.1"
sdks: 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" flutter: ">=1.12.13+hotfix.5 <2.0.0"
...@@ -31,6 +31,9 @@ dependencies: ...@@ -31,6 +31,9 @@ dependencies:
rflutter_alert: ^1.0.3 rflutter_alert: ^1.0.3
shared_preferences: ^0.5.6+1 shared_preferences: ^0.5.6+1
loadmore: ^1.0.4 loadmore: ^1.0.4
html: ^0.14.0+3
url_launcher: ^5.4.2
date_format: ^1.0.8
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