no message

parent b82e93a4
......@@ -22,7 +22,8 @@ class MyApp extends StatelessWidget {
primarySwatch: Colors.blue,
),
home: SplashScreenPage(),
// home: SplashScreenPage(),
home: HomePage(),
);
}
......
class categoryModel {
class categoryModel {
List<DATA> dATA;
categoryModel({this.dATA});
......@@ -20,9 +20,9 @@
}
return data;
}
}
}
class DATA {
class DATA {
int id;
int parentId;
String name;
......@@ -30,12 +30,12 @@
String displayName;
String cover;
String detail;
Null type;
dynamic type;
String status;
int sortOrder;
Null storeId;
Null vendorId;
Null createdAt;
dynamic storeId;
dynamic vendorId;
dynamic createdAt;
String updatedAt;
String visibility;
......@@ -93,4 +93,4 @@
data['visibility'] = this.visibility;
return data;
}
}
\ No newline at end of file
}
class shoplistModel {
List<DATA> dATA;
shoplistModel({this.dATA});
shoplistModel.fromJson(Map<String, dynamic> json) {
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>();
if (this.dATA != null) {
data['DATA'] = this.dATA.map((v) => v.toJson()).toList();
}
return data;
}
}
class DATA {
int id;
String storeCode;
String storeName;
String storeCover;
String displayCover;
String isActive;
int storeOrder;
int customerGroupId;
int vendorId;
Null createdAt;
Null updatedAt;
String location;
String email;
String phone;
String mobile;
String address;
String city;
String country;
String zipCode;
String website;
String allowRoute;
Null excerpt;
Null detail;
Null storeLogo;
Null isFacilities;
String distanceWithLocation;
int star;
Null ratings;
List<Null> storeProduct;
DATA(
{this.id,
this.storeCode,
this.storeName,
this.storeCover,
this.displayCover,
this.isActive,
this.storeOrder,
this.customerGroupId,
this.vendorId,
this.createdAt,
this.updatedAt,
this.location,
this.email,
this.phone,
this.mobile,
this.address,
this.city,
this.country,
this.zipCode,
this.website,
this.allowRoute,
this.excerpt,
this.detail,
this.storeLogo,
this.isFacilities,
this.distanceWithLocation,
this.star,
this.ratings,
this.storeProduct});
DATA.fromJson(Map<String, dynamic> json) {
id = json['id'];
storeCode = json['store_code'];
storeName = json['store_name'];
storeCover = json['store_cover'];
displayCover = json['display_cover'];
isActive = json['is_active'];
storeOrder = json['store_order'];
customerGroupId = json['customer_group_id'];
vendorId = json['vendor_id'];
createdAt = json['created_at'];
updatedAt = json['updated_at'];
location = json['location'];
email = json['email'];
phone = json['phone'];
mobile = json['mobile'];
address = json['address'];
city = json['city'];
country = json['country'];
zipCode = json['zip_code'];
website = json['website'];
allowRoute = json['allow_route'];
excerpt = json['excerpt'];
detail = json['detail'];
storeLogo = json['store_logo'];
isFacilities = json['is_facilities'];
distanceWithLocation = json['distance_with_location'];
star = json['star'];
ratings = json['ratings'];
if (json['store_product'] != null) {
storeProduct = new List<Null>();
json['store_product'].forEach((v) {
storeProduct.add(new Null.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['store_code'] = this.storeCode;
data['store_name'] = this.storeName;
data['store_cover'] = this.storeCover;
data['display_cover'] = this.displayCover;
data['is_active'] = this.isActive;
data['store_order'] = this.storeOrder;
data['customer_group_id'] = this.customerGroupId;
data['vendor_id'] = this.vendorId;
data['created_at'] = this.createdAt;
data['updated_at'] = this.updatedAt;
data['location'] = this.location;
data['email'] = this.email;
data['phone'] = this.phone;
data['mobile'] = this.mobile;
data['address'] = this.address;
data['city'] = this.city;
data['country'] = this.country;
data['zip_code'] = this.zipCode;
data['website'] = this.website;
data['allow_route'] = this.allowRoute;
data['excerpt'] = this.excerpt;
data['detail'] = this.detail;
data['store_logo'] = this.storeLogo;
data['is_facilities'] = this.isFacilities;
data['distance_with_location'] = this.distanceWithLocation;
data['star'] = this.star;
data['ratings'] = this.ratings;
if (this.storeProduct != null) {
data['store_product'] = this.storeProduct.map((v) => v.toJson()).toList();
}
return data;
}
}
\ No newline at end of file
......@@ -19,8 +19,7 @@ class Api<T> {
"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYmFja2VuZC11YXQuZmVlbHZlci5jb21cL2FwaVwvbG9naW4iLCJpYXQiOjE1OTQ5NzIzMjYsImV4cCI6MTYwMjE3MjMyNiwibmJmIjoxNTk0OTcyMzI2LCJqdGkiOiJsM1BldUJVcTdDNldSbzVGIiwic3ViIjo1LCJwcnYiOiI4N2UwYWYxZWY5ZmQxNTgxMmZkZWM5NzE1M2ExNGUwYjA0NzU0NmFhIn0.fwFqcbzG2T_ZHtIcGF13Ek7nIxxwbnaE9ZXGomo-nzY",
};
Future<Response<T>> forgetPassword(Object body) async {
Future<Response<T>> forgetPassword(Object body) async {
var _model;
var _fail;
var result;
......@@ -29,8 +28,8 @@ Future<Response<T>> forgetPassword(Object body) async {
await _httpConnection(
"${this._baseApi}/customer/forget-password", this._headerApi, body)
.then((response) {
print("ผลลัพ เท่ากับบบบ "+"${response.body}");
if (response.statusCode == 200 ) {
print("ผลลัพ เท่ากับบบบ " + "${response.body}");
if (response.statusCode == 200) {
_model = FogetPasswordModel.fromJson(json.decode(response.body));
} else {
_fail = FailModel.fromJson(json.decode(response.body));
......@@ -40,10 +39,6 @@ Future<Response<T>> forgetPassword(Object body) async {
return result;
}
Future<Response<T>> login(Object body) async {
var _model;
var _fail;
......@@ -82,7 +77,6 @@ Future<Response<T>> forgetPassword(Object body) async {
return result;
}
Future<Response<T>> category(Object body) async {
var _model;
var _fail;
......@@ -91,11 +85,13 @@ Future<Response<T>> forgetPassword(Object body) async {
await _httpConnection("${this._baseApi}/category", this._headerApi, body)
.then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}");
if (response.statusCode == 200){
if (response.statusCode == 200) {
// Array to Map Json
Map<String, dynamic> myData = arrayToJson(response.body);
print('testtt');
print(myData);
_model = categoryModel.fromJson(json.decode(response.body));
_model = categoryModel.fromJson(myData);
} else {
_fail = FailModel.fromJson(json.decode(response.body));
}
......@@ -104,7 +100,23 @@ Future<Response<T>> forgetPassword(Object body) async {
return result;
}
Future<Response<T>> shoplist(Object body) async{
var _model;
var _fail;
var result;
await _httpConnection("${this._baseApi}/store", this._headerApi, body).then((response){
print("ผลลัพท์ เท่ากับ " "${response.body}");
if (response.statusCode == 200) {
// Array to Map Json
Map<String, dynamic> myData = arrayToJson(response.body);
print(myData);
_model =
}
});
}
///api environment
Future<http.Response> _httpConnection(
......@@ -126,6 +138,17 @@ Future<Response<T>> forgetPassword(Object body) async {
var resJson = jsonDecode(json);
return resJson;
}
dynamic arrayToJson(dynamic array) {
List<dynamic> data = _jsonDecode(array);
Map<String, dynamic> myJson = {};
if (data != null && data.length > 0) {
myJson['data'] = data;
}
return myJson;
}
}
class Response<T> {
......
......@@ -260,7 +260,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
fit: BoxFit.fill,
),
'SPA',
'99 View',NearmeList()),
'99 View',ShopList()),
_listItem(
Image.asset(
'assets/images/banner_massage.png',
......
......@@ -5,29 +5,19 @@ import 'package:feelverapp/service/base_presenter.dart';
import 'package:feelverapp/ui/home/home.dart';
import 'package:flutter/material.dart';
class HomePresenter extends BasePresenter<HomePage>{
class HomePresenter extends BasePresenter<HomePage> {
Api _api;
final formkey = GlobalKey<FormState>();
HomePresenter(State<HomePage> state) : super(state);
Listitem() async{
Listitem() async {
_api = Api<categoryModel>();
var res = await _api.category({
"access_type":"portal"
});
var res = await _api.category({"access_type": "portal"});
if (res.fail == null) {
print('res Success');
}else{
} else {
print('res Fail');
}
}
}
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