Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
feelver
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2F-ART
feelver
Commits
e9f0973e
Commit
e9f0973e
authored
Sep 01, 2020
by
Mobile : Art
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
23705804
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
795 additions
and
61 deletions
+795
-61
lib/model/cart/add_cart_model.dart
+15
-0
lib/model/cart/my_cart_model.dart
+365
-0
lib/service/api.dart
+50
-5
lib/ui/booking/booking_detail.dart
+18
-17
lib/ui/booking/booking_detail_presenter.dart
+102
-10
lib/ui/payment/mycart.dart
+29
-6
lib/ui/payment/mycart_presenter.dart
+78
-0
lib/ui/payment/payment_detail.dart
+5
-5
lib/ui/shop/shop_list_detail.dart
+21
-12
lib/ui/shop/shop_main.dart
+6
-4
lib/ui/shop/shop_reviews.dart
+3
-1
lib/ui/shop/shop_service.dart
+3
-1
lib/ui/shop/shop_service_presenter.dart
+1
-0
lib/ui/shop/shoplistdetail_presenter.dart
+99
-0
No files found.
lib/model/cart/add_cart_model.dart
0 → 100644
View file @
e9f0973e
class
AddCartModel
{
String
message
;
AddCartModel
({
this
.
message
});
AddCartModel
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
message
=
json
[
'message'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'message'
]
=
this
.
message
;
return
data
;
}
}
lib/model/cart/my_cart_model.dart
0 → 100644
View file @
e9f0973e
class
OrderCartModel
{
List
<
DATA
>
dATA
;
OrderCartModel
({
this
.
dATA
});
OrderCartModel
.
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
cartDate
;
dynamic
cartExpire
;
dynamic
startDate
;
dynamic
endDate
;
String
createdBy
;
String
updatedBy
;
String
isGuestCustomer
;
dynamic
sessId
;
int
userId
;
dynamic
vendorTeamId
;
int
storeId
;
int
vendorId
;
String
createdAt
;
String
updatedAt
;
List
<
CartItem
>
cartItem
;
DATA
(
{
this
.
id
,
this
.
cartDate
,
this
.
cartExpire
,
this
.
startDate
,
this
.
endDate
,
this
.
createdBy
,
this
.
updatedBy
,
this
.
isGuestCustomer
,
this
.
sessId
,
this
.
userId
,
this
.
vendorTeamId
,
this
.
storeId
,
this
.
vendorId
,
this
.
createdAt
,
this
.
updatedAt
,
this
.
cartItem
});
DATA
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
cartDate
=
json
[
'cart_date'
];
cartExpire
=
json
[
'cart_expire'
];
startDate
=
json
[
'start_date'
];
endDate
=
json
[
'end_date'
];
createdBy
=
json
[
'created_by'
];
updatedBy
=
json
[
'updated_by'
];
isGuestCustomer
=
json
[
'is_guest_customer'
];
sessId
=
json
[
'sess_id'
];
userId
=
json
[
'user_id'
];
vendorTeamId
=
json
[
'vendor_team_id'
];
storeId
=
json
[
'store_id'
];
vendorId
=
json
[
'vendor_id'
];
createdAt
=
json
[
'created_at'
];
updatedAt
=
json
[
'updated_at'
];
if
(
json
[
'cart_item'
]
!=
null
)
{
cartItem
=
new
List
<
CartItem
>();
json
[
'cart_item'
].
forEach
((
v
)
{
cartItem
.
add
(
new
CartItem
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'cart_date'
]
=
this
.
cartDate
;
data
[
'cart_expire'
]
=
this
.
cartExpire
;
data
[
'start_date'
]
=
this
.
startDate
;
data
[
'end_date'
]
=
this
.
endDate
;
data
[
'created_by'
]
=
this
.
createdBy
;
data
[
'updated_by'
]
=
this
.
updatedBy
;
data
[
'is_guest_customer'
]
=
this
.
isGuestCustomer
;
data
[
'sess_id'
]
=
this
.
sessId
;
data
[
'user_id'
]
=
this
.
userId
;
data
[
'vendor_team_id'
]
=
this
.
vendorTeamId
;
data
[
'store_id'
]
=
this
.
storeId
;
data
[
'vendor_id'
]
=
this
.
vendorId
;
data
[
'created_at'
]
=
this
.
createdAt
;
data
[
'updated_at'
]
=
this
.
updatedAt
;
if
(
this
.
cartItem
!=
null
)
{
data
[
'cart_item'
]
=
this
.
cartItem
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
CartItem
{
int
id
;
int
cartId
;
int
productId
;
int
storeId
;
int
vendorId
;
String
createdAt
;
String
updatedAt
;
dynamic
vendorTeamId
;
int
qty
;
String
addedDate
;
dynamic
expireDate
;
Product
product
;
CartItem
(
{
this
.
id
,
this
.
cartId
,
this
.
productId
,
this
.
storeId
,
this
.
vendorId
,
this
.
createdAt
,
this
.
updatedAt
,
this
.
vendorTeamId
,
this
.
qty
,
this
.
addedDate
,
this
.
expireDate
,
this
.
product
});
CartItem
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
cartId
=
json
[
'cart_id'
];
productId
=
json
[
'product_id'
];
storeId
=
json
[
'store_id'
];
vendorId
=
json
[
'vendor_id'
];
createdAt
=
json
[
'created_at'
];
updatedAt
=
json
[
'updated_at'
];
vendorTeamId
=
json
[
'vendor_team_id'
];
qty
=
json
[
'qty'
];
addedDate
=
json
[
'added_date'
];
expireDate
=
json
[
'expire_date'
];
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
[
'cart_id'
]
=
this
.
cartId
;
data
[
'product_id'
]
=
this
.
productId
;
data
[
'store_id'
]
=
this
.
storeId
;
data
[
'vendor_id'
]
=
this
.
vendorId
;
data
[
'created_at'
]
=
this
.
createdAt
;
data
[
'updated_at'
]
=
this
.
updatedAt
;
data
[
'vendor_team_id'
]
=
this
.
vendorTeamId
;
data
[
'qty'
]
=
this
.
qty
;
data
[
'added_date'
]
=
this
.
addedDate
;
data
[
'expire_date'
]
=
this
.
expireDate
;
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
;
dynamic
tax
;
int
quantity
;
dynamic
weight
;
String
visibility
;
dynamic
newsFromDate
;
dynamic
newsToDate
;
dynamic
layout
;
dynamic
theme
;
String
duration
;
dynamic
sellingStartTime
;
dynamic
sellingEndTime
;
dynamic
redemptionStartTime
;
dynamic
redemptionEndTime
;
dynamic
availibility
;
String
isFeatured
;
String
isDeal
;
String
hasTeam
;
String
offpeak
;
String
reviewStatus
;
String
relatedStatus
;
String
upSellsStatus
;
String
crossSellsStatus
;
String
allowGiftMessage
;
String
stockStatus
;
String
status
;
int
businessTypeId
;
int
businessCateId
;
dynamic
businessServiceId
;
int
attributeSetId
;
int
vendorId
;
String
allowRoute
;
dynamic
type
;
int
star
;
List
<
Null
>
ratings
;
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
.
ratings
});
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['ratings'] != null) {
// ratings = new List<Null>();
// json['ratings'].forEach((v) {
// ratings.add(new Null.fromJson(v));
// });
// }
}
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.ratings != null) {
// data['ratings'] = this.ratings.map((v) => v.toJson()).toList();
// }
return
data
;
}
}
lib/service/api.dart
View file @
e9f0973e
...
@@ -3,6 +3,8 @@ import 'dart:convert';
...
@@ -3,6 +3,8 @@ import 'dart:convert';
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'
;
import
'package:feelverapp/model/cart/add_cart_model.dart'
;
import
'package:feelverapp/model/cart/my_cart_model.dart'
;
import
'package:feelverapp/model/editprofile/getprofilemodel.dart'
;
import
'package:feelverapp/model/editprofile/getprofilemodel.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
...
@@ -64,6 +66,7 @@ class Api<T> {
...
@@ -64,6 +66,7 @@ class Api<T> {
}
}
Future
<
Response
<
T
>>
deletefavorite
(
Object
body
)
async
{
Future
<
Response
<
T
>>
deletefavorite
(
Object
body
)
async
{
var
_model
;
var
_model
;
var
_fail
;
var
_fail
;
...
@@ -204,16 +207,12 @@ class Api<T> {
...
@@ -204,16 +207,12 @@ class Api<T> {
var
_fail
;
var
_fail
;
var
result
;
var
result
;
print
(
"this is body "
+
url
.
toString
());
print
(
"this is body "
+
url
.
toString
());
// (body as Map)['lang'] = allTranslations.currentLanguage;
await
http
.
get
(
Uri
.
encodeFull
(
url
.
toString
()),
headers:
this
.
_headerApi
,
).
then
((
response
)
{
await
http
.
get
(
Uri
.
encodeFull
(
url
.
toString
()),
headers:
this
.
_headerApi
,
).
then
((
response
)
{
print
(
"ผลลัพ เท่ากับบบบ2 "
+
"
${response.body}
"
);
print
(
"ผลลัพ เท่ากับบบบ2 "
+
"
${response.body}
"
);
print
(
"statusCode=
${response.statusCode}
"
);
print
(
"statusCode=
${response.statusCode}
"
);
if
(
response
.
statusCode
==
200
)
{
if
(
response
.
statusCode
==
200
)
{
print
(
"INif"
);
print
(
"INif"
);
// https://backend.feelver.com/api/product/1000?store_id=284&vendor_id=9
_model
=
ProductModel
.
fromJson
(
json
.
decode
(
response
.
body
));
_model
=
ProductModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
else
{
}
else
{
...
@@ -225,6 +224,52 @@ class Api<T> {
...
@@ -225,6 +224,52 @@ class Api<T> {
});
});
return
result
;
return
result
;
}
}
Future
<
Response
<
T
>>
orderCart
(
String
url
)
async
{
var
_model
;
var
_fail
;
var
result
;
print
(
"this is body "
+
url
.
toString
());
await
http
.
post
(
Uri
.
encodeFull
(
url
.
toString
()),
headers:
this
.
_headerApi
,
).
then
((
response
)
{
print
(
"ผลลัพ 78787878 "
+
"
${response.body}
"
);
print
(
"statusCode=
${response.statusCode}
"
);
if
(
response
.
statusCode
==
200
)
{
Map
<
String
,
dynamic
>
myData
=
arrayToJson
(
response
.
body
);
print
(
myData
);
_model
=
OrderCartModel
.
fromJson
(
myData
);
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
result
=
new
Response
<
T
>(
_model
,
_fail
);
},);
return
result
;
}
Future
<
Response
<
T
>>
addCart
(
String
url
)
async
{
var
_model
;
var
_fail
;
var
result
;
print
(
"this is body "
+
url
.
toString
());
await
http
.
post
(
Uri
.
encodeFull
(
url
.
toString
()),
headers:
this
.
_headerApi
,
).
then
((
response
)
{
print
(
"ผลลัพ เท่ากับบบบ55552 "
+
"
${response.body}
"
);
print
(
"statusCode=
${response.statusCode}
"
);
if
(
response
.
statusCode
==
200
)
{
print
(
"INif"
);
_model
=
AddCartModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
print
(
"return"
);
result
=
new
Response
<
T
>(
_model
,
_fail
);
});
return
result
;
}
Future
<
Response
<
T
>>
editProfile
(
Object
body
)
async
{
Future
<
Response
<
T
>>
editProfile
(
Object
body
)
async
{
var
_model
;
var
_model
;
...
@@ -355,7 +400,7 @@ class Api<T> {
...
@@ -355,7 +400,7 @@ class Api<T> {
var
_model
;
var
_model
;
var
_fail
;
var
_fail
;
var
result
;
var
result
;
print
(
"
${this._baseApi}
/store/detail"
);
await
_httpConnection
(
await
_httpConnection
(
"
${this._baseApi}
/store/detail"
,
this
.
_headerApi
,
body
)
"
${this._baseApi}
/store/detail"
,
this
.
_headerApi
,
body
)
.
then
((
response
)
{
.
then
((
response
)
{
...
...
lib/ui/booking/booking_detail.dart
View file @
e9f0973e
...
@@ -10,9 +10,13 @@ import '../splashscreen/splash_screen_page.dart';
...
@@ -10,9 +10,13 @@ import '../splashscreen/splash_screen_page.dart';
class
BookingDetail
extends
StatefulWidget
{
class
BookingDetail
extends
StatefulWidget
{
int
getid
;
int
getid
;
int
vendor_id
;
int
vendor_id
;
int
store_id
;
int
store_id
;
BookingDetail
({
Key
key
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
})
:
super
(
key:
key
);
String
user_id
;
BookingDetail
(
{
Key
key
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
,
this
.
user_id
})
:
super
(
key:
key
);
@override
@override
_BookingDetailState
createState
()
=>
_BookingDetailState
();
_BookingDetailState
createState
()
=>
_BookingDetailState
();
...
@@ -31,6 +35,7 @@ class _BookingDetailState extends State<BookingDetail> {
...
@@ -31,6 +35,7 @@ class _BookingDetailState extends State<BookingDetail> {
presenter
.
vendor_id
=
widget
.
vendor_id
;
presenter
.
vendor_id
=
widget
.
vendor_id
;
presenter
.
store_id
=
widget
.
store_id
;
presenter
.
store_id
=
widget
.
store_id
;
presenter
.
getid
=
widget
.
getid
;
presenter
.
getid
=
widget
.
getid
;
presenter
.
user_id
=
widget
.
user_id
;
});
});
presenter
.
getudid
();
presenter
.
getudid
();
...
@@ -401,20 +406,16 @@ class _BookingDetailState extends State<BookingDetail> {
...
@@ -401,20 +406,16 @@ class _BookingDetailState extends State<BookingDetail> {
fontWeight:
FontWeight
.
w500
),
fontWeight:
FontWeight
.
w500
),
),
),
),
),
InkWell
(
onTap:
(){
InkWell
(
Navigator
.
push
(
onTap:
()
{
context
,
setState
(()
{
CupertinoPageRoute
(
presenter
.
user_id
=
widget
.
user_id
;
builder:
(
context
)
=>
MyCart
(
presenter
.
store_id
=
widget
.
store_id
;
// getid: presenter.model.result[0]
presenter
.
vendor_id
=
widget
.
vendor_id
;
// .storeProduct[i].product.id,
presenter
.
getid
=
widget
.
getid
;
// vendor_id: presenter.model.result[0].storeProduct[i]
presenter
.
addCart
(
context
);
// .product.vendorId,
},);
// store_id: presenter.model.result[0].storeProduct[i].storeId,
},
),
),
);
},
child:
Container
(
child:
Container
(
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
top:
SizeConfig
.
getPadding
(
20
),
top:
SizeConfig
.
getPadding
(
20
),
...
...
lib/ui/booking/booking_detail_presenter.dart
View file @
e9f0973e
import
'package:feelverapp/model/cart/add_cart_model.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/nearme/nearme_list_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'
;
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/ui/
home/home
.dart'
;
import
'package:feelverapp/ui/
payment/mycart
.dart'
;
import
'package:feelverapp/util/Accout_util.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
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'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:feelverapp/ui/booking/booking_detail.dart'
;
import
'package:feelverapp/ui/booking/booking_detail.dart'
;
import
'../../model/booking_detail/booking_detail_model.dart'
;
import
'../../model/booking_detail/booking_detail_model.dart'
;
class
BookingDetailtPresenter
extends
BasePresenter
<
BookingDetail
>
{
class
BookingDetailtPresenter
extends
BasePresenter
<
BookingDetail
>
{
final
formkey
=
GlobalKey
<
FormState
>();
final
formkey
=
GlobalKey
<
FormState
>();
Api
_api
;
Api
_api
;
String
type
=
'3'
;
String
type
=
'3'
;
int
getid
;
int
getid
;
int
vendor_id
;
int
vendor_id
;
int
store_id
;
int
store_id
;
bool
fav
=
false
;
String
user_id
;
bool
fav
=
false
;
AddfavModel
addmodel
;
AddfavModel
addmodel
;
String
uid
;
String
uid
;
ProductModel
getmodel
;
ProductModel
getmodel
;
AddCartModel
addCartModel
;
BookingDetailtPresenter
(
State
<
BookingDetail
>
state
)
:
super
(
state
);
BookingDetailtPresenter
(
State
<
BookingDetail
>
state
)
:
super
(
state
);
...
@@ -34,12 +36,17 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
...
@@ -34,12 +36,17 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
print
(
getid
);
print
(
getid
);
print
(
store_id
);
print
(
store_id
);
print
(
vendor_id
);
print
(
vendor_id
);
print
(
user_id
);
_api
=
Api
<
ProductModel
>();
_api
=
Api
<
ProductModel
>();
var
res
=
await
_api
.
getProductDetail
(
var
res
=
await
_api
.
getProductDetail
(
'https://backend.feelver.com/api/product/'
+
getid
.
toString
()
+
'?store_id='
+
store_id
.
toString
()
+
'&vendor_id='
+
vendor_id
.
toString
()
'https://backend.feelver.com/api/product/'
+
);
getid
.
toString
()
+
'?store_id='
+
store_id
.
toString
()
+
'&vendor_id='
+
vendor_id
.
toString
());
if
(
res
.
fail
==
null
)
{
if
(
res
.
fail
==
null
)
{
if
(
res
.
success
.
status
)
{
if
(
res
.
success
.
status
)
{
...
@@ -47,7 +54,6 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
...
@@ -47,7 +54,6 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
()
{
()
{
print
(
"AAAA :
${res.success}
"
);
print
(
"AAAA :
${res.success}
"
);
getmodel
=
res
.
success
;
getmodel
=
res
.
success
;
},
},
);
);
}
}
...
@@ -120,4 +126,90 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
...
@@ -120,4 +126,90 @@ class BookingDetailtPresenter extends BasePresenter<BookingDetail> {
print
(
'res Fail'
);
print
(
'res Fail'
);
}
}
}
}
addCart
(
BuildContext
context
)
async
{
print
(
getid
);
print
(
store_id
);
print
(
vendor_id
);
_api
=
Api
<
AddCartModel
>();
var
res
=
await
_api
.
addCart
(
'https://backend.feelver.com/api/cart/add?'
+
'store_id='
+
store_id
.
toString
()
+
'&vendor_id='
+
vendor_id
.
toString
()
+
'&user_id='
+
user_id
.
toString
()
+
'&product_id='
+
getid
.
toString
()
+
'&access_type=portal'
);
if
(
res
.
fail
==
null
)
{
// if (res.success.status) {
setState
(
()
{
print
(
"AAAA :
${res.success}
"
);
addCartModel
=
res
.
success
;
Alert
(
style:
AlertStyle
(
animationType:
AnimationType
.
fromTop
,
isCloseButton:
true
,
),
context:
state
.
context
,
title:
addCartModel
.
message
.
toString
(),
content:
Icon
(
Icons
.
warning
,
color:
Colors
.
orange
,
size:
80
,
),
buttons:
[
DialogButton
(
color:
Color
.
fromRGBO
(
106
,
179
,
170
,
1
),
onPressed:
()
{
if
(
addCartModel
!=
null
)
{
Navigator
.
push
(
context
,
CupertinoPageRoute
(
builder:
(
context
)
=>
MyCart
(
user_id:
user_id
,
),
),
);
}
},
child:
Text
(
"Ok"
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
20
),
),
),
],
).
show
();
},
);
}
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
();
}
}
}
}
lib/ui/payment/mycart.dart
View file @
e9f0973e
import
'package:feelverapp/ui/menu/menu.dart'
;
import
'package:feelverapp/ui/menu/menu.dart'
;
import
'package:feelverapp/ui/payment/mycart_presenter.dart'
;
import
'package:feelverapp/ui/payment/payment_page.dart'
;
import
'package:feelverapp/ui/payment/payment_page.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
class
MyCart
extends
StatefulWidget
{
class
MyCart
extends
StatefulWidget
{
String
user_id
;
MyCart
({
Key
key
,
this
.
user_id
})
:
super
(
key:
key
);
@override
@override
_MyCartState
createState
()
=>
_MyCartState
();
_MyCartState
createState
()
=>
_MyCartState
();
}
}
...
@@ -13,8 +18,29 @@ class _MyCartState extends State<MyCart> {
...
@@ -13,8 +18,29 @@ class _MyCartState extends State<MyCart> {
int
a
=
1
;
int
a
=
1
;
int
b
=
1
;
int
b
=
1
;
List
<
int
>
_counter
=
List
();
List
<
int
>
_counter
=
List
();
MyCartPresenter
presenter
;
@override
void
initState
()
{
super
.
initState
();
// widget.getid = 55;
// print(widget.getid);
presenter
=
MyCartPresenter
(
this
);
setState
(()
{
// presenter.vendor_id = widget.v;
// presenter.store_id = widget.store_id;
// presenter.getid = widget.getid;
presenter
.
user_id
=
widget
.
user_id
;
});
presenter
.
getListCart
();
}
@override
@override
void
dispose
()
{
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
SizeConfig
(
context
);
SizeConfig
(
context
);
return
Scaffold
(
return
Scaffold
(
...
@@ -168,8 +194,6 @@ class _MyCartState extends State<MyCart> {
...
@@ -168,8 +194,6 @@ class _MyCartState extends State<MyCart> {
}
}
_getlist
()
{
_getlist
()
{
int
_itemCount
=
0
;
return
Expanded
(
return
Expanded
(
child:
Container
(
child:
Container
(
margin:
EdgeInsets
.
only
(
margin:
EdgeInsets
.
only
(
...
@@ -183,7 +207,7 @@ class _MyCartState extends State<MyCart> {
...
@@ -183,7 +207,7 @@ class _MyCartState extends State<MyCart> {
itemBuilder:
(
context
,
i
)
{
itemBuilder:
(
context
,
i
)
{
return
InkWell
(
return
InkWell
(
onTap:
()
{
onTap:
()
{
print
(
i
);
print
(
a
);
},
},
child:
list1
(),
child:
list1
(),
);
);
...
@@ -194,7 +218,6 @@ class _MyCartState extends State<MyCart> {
...
@@ -194,7 +218,6 @@ class _MyCartState extends State<MyCart> {
}
}
Widget
list1
()
{
Widget
list1
()
{
return
Card
(
return
Card
(
elevation:
5
,
elevation:
5
,
child:
Container
(
child:
Container
(
...
@@ -306,7 +329,7 @@ class _MyCartState extends State<MyCart> {
...
@@ -306,7 +329,7 @@ class _MyCartState extends State<MyCart> {
),
),
onPressed:
()
{
onPressed:
()
{
setState
(()
{
setState
(()
{
a
=
a
-
1
;
a
--
;
});
});
},
},
),
),
...
@@ -325,7 +348,7 @@ class _MyCartState extends State<MyCart> {
...
@@ -325,7 +348,7 @@ class _MyCartState extends State<MyCart> {
),
),
onPressed:
()
{
onPressed:
()
{
setState
(()
{
setState
(()
{
a
=
a
+
1
;
a
++
;
});
});
},
},
),
),
...
...
lib/ui/payment/mycart_presenter.dart
0 → 100644
View file @
e9f0973e
import
'package:feelverapp/model/cart/add_cart_model.dart'
;
import
'package:feelverapp/model/cart/my_cart_model.dart'
;
import
'package:feelverapp/model/favorite/addfav_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/payment/mycart.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:flutter/material.dart'
;
import
'package:rflutter_alert/rflutter_alert.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:feelverapp/ui/booking/booking_detail.dart'
;
import
'../../model/booking_detail/booking_detail_model.dart'
;
class
MyCartPresenter
extends
BasePresenter
<
MyCart
>
{
final
formkey
=
GlobalKey
<
FormState
>();
Api
_api
;
int
getid
;
int
vendor_id
;
int
store_id
;
String
user_id
;
bool
fav
=
false
;
String
uid
;
OrderCartModel
orderCartModel
;
MyCartPresenter
(
State
<
MyCart
>
state
)
:
super
(
state
);
getListCart
()
async
{
print
(
user_id
);
_api
=
Api
<
OrderCartModel
>();
var
res
=
await
_api
.
orderCart
(
'https://backend.feelver.com/api/cart/order?customer_id='
+
user_id
.
toString
()
+
'&access_type=portal'
);
if
(
res
.
fail
==
null
)
{
setState
(
()
{
print
(
"AAAA :
${res.success}
"
);
orderCartModel
=
res
.
success
;
print
(
orderCartModel
.
dATA
[
0
]);
},
);
}
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
();
}
}
}
\ No newline at end of file
lib/ui/payment/payment_detail.dart
View file @
e9f0973e
...
@@ -86,12 +86,12 @@ class _PaymentdetailState extends State<Paymentdetail> {
...
@@ -86,12 +86,12 @@ class _PaymentdetailState extends State<Paymentdetail> {
padding:
EdgeInsets
.
only
(
top:
SizeConfig
.
getPadding
(
6
),
bottom:
SizeConfig
.
getPadding
(
16
)),
padding:
EdgeInsets
.
only
(
top:
SizeConfig
.
getPadding
(
6
),
bottom:
SizeConfig
.
getPadding
(
16
)),
child:
Column
(
child:
Column
(
children:
<
Widget
>[
children:
<
Widget
>[
Divider
(
//
Divider(
color:
Colors
.
black
,
//
color: Colors.black,
height:
SizeConfig
.
getHeight
(
1
),
//
height: SizeConfig.getHeight(1),
),
//
),
SizedBox
(
SizedBox
(
height:
SizeConfig
.
getHeight
(
16
),
height:
SizeConfig
.
getHeight
(
0
),
),
),
Row
(
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
...
...
lib/ui/shop/shop_list_detail.dart
View file @
e9f0973e
...
@@ -358,6 +358,8 @@ class _ShopListDetailState extends State<ShopListDetail> {
...
@@ -358,6 +358,8 @@ class _ShopListDetailState extends State<ShopListDetail> {
.
model
.
result
[
0
].
storeProduct
[
i
].
product
.
vendorId
,
.
model
.
result
[
0
].
storeProduct
[
i
].
product
.
vendorId
,
store_id:
store_id:
presenter
.
model
.
result
[
0
].
storeProduct
[
i
].
storeId
,
presenter
.
model
.
result
[
0
].
storeProduct
[
i
].
storeId
,
user_id:
widget
.
id
,
),
),
),
),
);
);
...
@@ -487,18 +489,25 @@ class _ShopListDetailState extends State<ShopListDetail> {
...
@@ -487,18 +489,25 @@ class _ShopListDetailState extends State<ShopListDetail> {
],
],
),
),
onPressed:
()
{
onPressed:
()
{
Navigator
.
push
(
setState
(()
{
context
,
presenter
.
user_id
=
widget
.
id
;
CupertinoPageRoute
(
presenter
.
store_id
=
presenter
.
model
.
result
[
0
].
storeProduct
[
i
].
storeId
.
toString
();
builder:
(
context
)
=>
MyCart
(
presenter
.
vendor_id
=
presenter
.
model
.
result
[
0
].
storeProduct
[
i
].
vendorId
.
toString
();
// getid: presenter.model.result[0]
presenter
.
product_id
=
presenter
.
model
.
result
[
0
].
storeProduct
[
i
].
productId
.
toString
();
// .storeProduct[i].product.id,
presenter
.
addCart
(
context
);
// vendor_id: presenter.model.result[0].storeProduct[i]
});
// .product.vendorId,
// Navigator.push(
// store_id: presenter.model.result[0].storeProduct[i].storeId,
// context,
),
// CupertinoPageRoute(
),
// builder: (context) => MyCart(
);
// // getid: presenter.model.result[0]
// // .storeProduct[i].product.id,
// // vendor_id: presenter.model.result[0].storeProduct[i]
// // .product.vendorId,
// // store_id: presenter.model.result[0].storeProduct[i].storeId,
// ),
// ),
// );
print
(
" Go to cart"
);
print
(
" Go to cart"
);
},
},
),
),
...
...
lib/ui/shop/shop_main.dart
View file @
e9f0973e
...
@@ -13,8 +13,9 @@ class MainShop extends StatefulWidget {
...
@@ -13,8 +13,9 @@ class MainShop extends StatefulWidget {
int
getid
;
int
getid
;
int
vendor_id
;
int
vendor_id
;
int
store_id
;
int
store_id
;
String
user_id
;
MainShop
({
Key
key
,
this
.
title
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
})
:
super
(
key:
key
);
MainShop
({
Key
key
,
this
.
title
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
,
this
.
user_id
})
:
super
(
key:
key
);
final
String
title
;
final
String
title
;
...
@@ -69,6 +70,7 @@ class _MainShopState extends State<MainShop>
...
@@ -69,6 +70,7 @@ class _MainShopState extends State<MainShop>
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
SizeConfig
(
context
);
SizeConfig
(
context
);
// Init the items
// Init the items
print
(
widget
.
user_id
);
return
Scaffold
(
return
Scaffold
(
// backgroundColor: Colors.transparent,
// backgroundColor: Colors.transparent,
...
@@ -179,7 +181,7 @@ class _MainShopState extends State<MainShop>
...
@@ -179,7 +181,7 @@ class _MainShopState extends State<MainShop>
controller:
_controller
,
controller:
_controller
,
children:
<
Widget
>[
children:
<
Widget
>[
Container
(
Container
(
child:
BookingDetail
(
getid:
widget
.
getid
,
vendor_id:
widget
.
vendor_id
,
store_id:
widget
.
store_id
,),
child:
BookingDetail
(
getid:
widget
.
getid
,
vendor_id:
widget
.
vendor_id
,
store_id:
widget
.
store_id
,
user_id:
widget
.
user_id
,
),
// child: getlist(),
// child: getlist(),
//width: 20,
//width: 20,
),
),
...
@@ -287,7 +289,7 @@ class _MainShopState extends State<MainShop>
...
@@ -287,7 +289,7 @@ class _MainShopState extends State<MainShop>
child:
Container
(
child:
Container
(
// color: Colors.blue,
// color: Colors.blue,
// height: double.maxFinite,
// height: double.maxFinite,
child:
ShopServicePage
(
getid:
widget
.
getid
,
vendor_id:
widget
.
vendor_id
,
store_id:
widget
.
store_id
,),
child:
ShopServicePage
(
getid:
widget
.
getid
,
vendor_id:
widget
.
vendor_id
,
store_id:
widget
.
store_id
,
user_id:
widget
.
user_id
,
),
),
),
),
),
],
],
...
@@ -297,7 +299,7 @@ class _MainShopState extends State<MainShop>
...
@@ -297,7 +299,7 @@ class _MainShopState extends State<MainShop>
Container
(
Container
(
// color: Colors.red,
// color: Colors.red,
child:
ShopReviewsPage
(
getid:
widget
.
getid
,
vendor_id:
widget
.
vendor_id
,
store_id:
widget
.
store_id
,),
child:
ShopReviewsPage
(
getid:
widget
.
getid
,
vendor_id:
widget
.
vendor_id
,
store_id:
widget
.
store_id
,
user_id:
widget
.
user_id
,
),
// child: getlist(),
// child: getlist(),
//width: 20,
//width: 20,
),
),
...
...
lib/ui/shop/shop_reviews.dart
View file @
e9f0973e
...
@@ -6,7 +6,8 @@ class ShopReviewsPage extends StatefulWidget {
...
@@ -6,7 +6,8 @@ class ShopReviewsPage extends StatefulWidget {
int
getid
;
int
getid
;
int
vendor_id
;
int
vendor_id
;
int
store_id
;
int
store_id
;
ShopReviewsPage
({
Key
key
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
})
:
super
(
key:
key
);
String
user_id
;
ShopReviewsPage
({
Key
key
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
,
this
.
user_id
})
:
super
(
key:
key
);
@override
@override
_ShopReviewsPageState
createState
()
=>
_ShopReviewsPageState
();
_ShopReviewsPageState
createState
()
=>
_ShopReviewsPageState
();
...
@@ -15,6 +16,7 @@ class ShopReviewsPage extends StatefulWidget {
...
@@ -15,6 +16,7 @@ class ShopReviewsPage extends StatefulWidget {
// presenter.vendor_id = widget.vendor_id;
// presenter.vendor_id = widget.vendor_id;
// presenter.store_id = widget.store_id;
// presenter.store_id = widget.store_id;
// presenter.getid = widget.getid;
// presenter.getid = widget.getid;
// presenter.user_id = widget.user_id;
// });
// });
}
}
...
...
lib/ui/shop/shop_service.dart
View file @
e9f0973e
...
@@ -12,8 +12,9 @@ class ShopServicePage extends StatefulWidget {
...
@@ -12,8 +12,9 @@ class ShopServicePage extends StatefulWidget {
int
getid
;
int
getid
;
int
vendor_id
;
int
vendor_id
;
int
store_id
;
int
store_id
;
String
user_id
;
ShopServicePage
({
Key
key
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
})
ShopServicePage
({
Key
key
,
this
.
getid
,
this
.
vendor_id
,
this
.
store_id
,
this
.
user_id
})
:
super
(
key:
key
);
:
super
(
key:
key
);
@override
@override
...
@@ -35,6 +36,7 @@ class _ShopServicePageState extends State<ShopServicePage>
...
@@ -35,6 +36,7 @@ class _ShopServicePageState extends State<ShopServicePage>
presenter
.
vendor_id
=
widget
.
vendor_id
;
presenter
.
vendor_id
=
widget
.
vendor_id
;
presenter
.
store_id
=
widget
.
store_id
;
presenter
.
store_id
=
widget
.
store_id
;
presenter
.
getid
=
widget
.
getid
;
presenter
.
getid
=
widget
.
getid
;
presenter
.
user_id
=
widget
.
user_id
;
});
});
presenter
.
Servicelistitem
();
presenter
.
Servicelistitem
();
...
...
lib/ui/shop/shop_service_presenter.dart
View file @
e9f0973e
...
@@ -9,6 +9,7 @@ class ShopServicePresenter extends BasePresenter<ShopServicePage> {
...
@@ -9,6 +9,7 @@ class ShopServicePresenter extends BasePresenter<ShopServicePage> {
int
getid
;
int
getid
;
int
vendor_id
;
int
vendor_id
;
int
store_id
;
int
store_id
;
String
user_id
;
final
formkey
=
GlobalKey
<
FormState
>();
final
formkey
=
GlobalKey
<
FormState
>();
shopserviceModel
serviceModel
;
shopserviceModel
serviceModel
;
...
...
lib/ui/shop/shoplistdetail_presenter.dart
View file @
e9f0973e
import
'package:feelverapp/model/cart/add_cart_model.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/favorite/addfav_model.dart'
;
import
'package:feelverapp/model/shoplistdetail/shoplistdetail_Model.dart'
;
import
'package:feelverapp/model/shoplistdetail/shoplistdetail_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'
;
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/ui/payment/mycart.dart'
;
import
'package:feelverapp/ui/shop/shop_list_detail.dart'
;
import
'package:feelverapp/ui/shop/shop_list_detail.dart'
;
import
'package:feelverapp/ui/splashscreen/splash_screen_page.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:rflutter_alert/rflutter_alert.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
import
'package:url_launcher/url_launcher.dart'
;
...
@@ -14,11 +20,104 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail> {
...
@@ -14,11 +20,104 @@ class ShoplistdetailPresenter extends BasePresenter<ShopListDetail> {
final
formkey
=
GlobalKey
<
FormState
>();
final
formkey
=
GlobalKey
<
FormState
>();
shoplistdetailModel
model
;
shoplistdetailModel
model
;
AddfavModel
addmodel
;
AddfavModel
addmodel
;
AddCartModel
addCartModel
;
bool
fav
=
false
;
bool
fav
=
false
;
int
get_id
;
String
vendor_id
;
String
store_id
;
String
user_id
;
String
product_id
;
ShoplistdetailPresenter
(
State
<
ShopListDetail
>
state
)
:
super
(
state
);
ShoplistdetailPresenter
(
State
<
ShopListDetail
>
state
)
:
super
(
state
);
String
uid
;
String
uid
;
addCart
(
BuildContext
context
)
async
{
print
(
getid
);
print
(
store_id
);
print
(
vendor_id
);
_api
=
Api
<
AddCartModel
>();
var
res
=
await
_api
.
addCart
(
'https://backend.feelver.com/api/cart/add?'
+
'store_id='
+
store_id
.
toString
()
+
'&vendor_id='
+
vendor_id
.
toString
()
+
'&user_id='
+
id
.
toString
()
+
'&product_id='
+
product_id
.
toString
()
+
'&access_type=portal'
);
if
(
res
.
fail
==
null
)
{
// if (res.success.status) {
setState
(
()
{
print
(
"AAAA :
${res.success}
"
);
addCartModel
=
res
.
success
;
Alert
(
style:
AlertStyle
(
animationType:
AnimationType
.
grow
,
isCloseButton:
true
,
),
context:
state
.
context
,
title:
addCartModel
.
message
.
toString
(),
content:
Icon
(
Icons
.
warning
,
color:
Colors
.
orange
,
size:
80
,
),
buttons:
[
DialogButton
(
color:
Color
.
fromRGBO
(
106
,
179
,
170
,
1
),
onPressed:
()
{
if
(
addCartModel
!=
null
)
{
Navigator
.
push
(
context
,
CupertinoPageRoute
(
builder:
(
context
)
=>
MyCart
(
user_id:
user_id
,
),
),
);
}
},
child:
Text
(
"Ok"
,
style:
TextStyle
(
color:
Colors
.
white
,
fontSize:
20
),
),
),
],
).
show
();
},
);
}
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
();
}
}
Detai
(
String
id
)
async
{
Detai
(
String
id
)
async
{
_api
=
Api
<
shoplistdetailModel
>();
_api
=
Api
<
shoplistdetailModel
>();
var
res
=
await
_api
.
shoplistDetail
({
var
res
=
await
_api
.
shoplistDetail
({
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment