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
f6cc3b6d
Commit
f6cc3b6d
authored
Aug 21, 2020
by
Mobile : Jetrin Phuekkaew (N'new)
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of
https://gitlab.2fellows.com/art/feelver
into develop
parents
633981e4
7068ae0c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
194 additions
and
10 deletions
+194
-10
lib/main.dart
+1
-0
lib/model/favorite/delete_favorite_Model.dart
+16
-0
lib/model/favorite/favorite_Model.dart
+125
-8
lib/service/api.dart
+25
-0
lib/ui/favorite/favorite.dart
+7
-2
lib/ui/favorite/favorite_presenter.dart
+20
-0
No files found.
lib/main.dart
View file @
f6cc3b6d
...
...
@@ -37,6 +37,7 @@ class MyApp extends StatelessWidget {
//home: EditProfile(),
);
...
...
lib/model/favorite/delete_favorite_Model.dart
0 → 100644
View file @
f6cc3b6d
class
DeletefavoriteModel
{
String
message
;
DeletefavoriteModel
({
this
.
message
});
DeletefavoriteModel
.
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
;
}
}
\ No newline at end of file
lib/model/favorite/favorite_Model.dart
View file @
f6cc3b6d
class
FavoriteModel
{
int
id
;
int
customerId
;
...
...
@@ -117,7 +118,7 @@ class Product {
String
excerpt
;
String
detail
;
String
price
;
String
specialPrice
;
dynamic
specialPrice
;
String
sku
;
dynamic
tax
;
int
quantity
;
...
...
@@ -146,11 +147,11 @@ class Product {
String
status
;
int
businessTypeId
;
int
businessCateId
;
dynamic
businessServiceId
;
int
businessServiceId
;
int
attributeSetId
;
int
vendorId
;
String
allowRoute
;
dynamic
type
;
String
type
;
int
star
;
List
<
Null
>
ratings
;
...
...
@@ -289,7 +290,6 @@ class Product {
data
[
'allow_route'
]
=
this
.
allowRoute
;
data
[
'type'
]
=
this
.
type
;
data
[
'star'
]
=
this
.
star
;
return
data
;
}
}
...
...
@@ -321,8 +321,8 @@ class Store {
String
storeLogo
;
String
isFacilities
;
String
distanceWithLocation
;
int
star
;
dynamic
ratings
;
String
star
;
Ratings
ratings
;
Store
(
{
this
.
id
,
...
...
@@ -382,7 +382,8 @@ class Store {
isFacilities
=
json
[
'is_facilities'
];
distanceWithLocation
=
json
[
'distance_with_location'
];
star
=
json
[
'star'
];
ratings
=
json
[
'ratings'
];
ratings
=
json
[
'ratings'
]
!=
null
?
new
Ratings
.
fromJson
(
json
[
'ratings'
])
:
null
;
}
Map
<
String
,
dynamic
>
toJson
()
{
...
...
@@ -414,7 +415,122 @@ class Store {
data
[
'is_facilities'
]
=
this
.
isFacilities
;
data
[
'distance_with_location'
]
=
this
.
distanceWithLocation
;
data
[
'star'
]
=
this
.
star
;
data
[
'ratings'
]
=
this
.
ratings
;
if
(
this
.
ratings
!=
null
)
{
data
[
'ratings'
]
=
this
.
ratings
.
toJson
();
}
return
data
;
}
}
class
Ratings
{
int
id
;
String
title
;
String
rateType
;
String
rateCate
;
String
rateTb
;
int
rateRowId
;
String
isCustom
;
dynamic
customScore
;
int
rateRange
;
int
storeId
;
int
vendorId
;
String
createdAt
;
String
updatedAt
;
List
<
RatingScore
>
ratingScore
;
Ratings
(
{
this
.
id
,
this
.
title
,
this
.
rateType
,
this
.
rateCate
,
this
.
rateTb
,
this
.
rateRowId
,
this
.
isCustom
,
this
.
customScore
,
this
.
rateRange
,
this
.
storeId
,
this
.
vendorId
,
this
.
createdAt
,
this
.
updatedAt
,
this
.
ratingScore
});
Ratings
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
title
=
json
[
'title'
];
rateType
=
json
[
'rate_type'
];
rateCate
=
json
[
'rate_cate'
];
rateTb
=
json
[
'rate_tb'
];
rateRowId
=
json
[
'rate_row_id'
];
isCustom
=
json
[
'is_custom'
];
customScore
=
json
[
'custom_score'
];
rateRange
=
json
[
'rate_range'
];
storeId
=
json
[
'store_id'
];
vendorId
=
json
[
'vendor_id'
];
createdAt
=
json
[
'created_at'
];
updatedAt
=
json
[
'updated_at'
];
if
(
json
[
'rating_score'
]
!=
null
)
{
ratingScore
=
new
List
<
RatingScore
>();
json
[
'rating_score'
].
forEach
((
v
)
{
ratingScore
.
add
(
new
RatingScore
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'title'
]
=
this
.
title
;
data
[
'rate_type'
]
=
this
.
rateType
;
data
[
'rate_cate'
]
=
this
.
rateCate
;
data
[
'rate_tb'
]
=
this
.
rateTb
;
data
[
'rate_row_id'
]
=
this
.
rateRowId
;
data
[
'is_custom'
]
=
this
.
isCustom
;
data
[
'custom_score'
]
=
this
.
customScore
;
data
[
'rate_range'
]
=
this
.
rateRange
;
data
[
'store_id'
]
=
this
.
storeId
;
data
[
'vendor_id'
]
=
this
.
vendorId
;
data
[
'created_at'
]
=
this
.
createdAt
;
data
[
'updated_at'
]
=
this
.
updatedAt
;
if
(
this
.
ratingScore
!=
null
)
{
data
[
'rating_score'
]
=
this
.
ratingScore
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
RatingScore
{
int
id
;
int
ratingId
;
String
ratingScore
;
String
createdAt
;
String
updatedAt
;
int
customerId
;
RatingScore
(
{
this
.
id
,
this
.
ratingId
,
this
.
ratingScore
,
this
.
createdAt
,
this
.
updatedAt
,
this
.
customerId
});
RatingScore
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
id
=
json
[
'id'
];
ratingId
=
json
[
'rating_id'
];
ratingScore
=
json
[
'rating_score'
];
createdAt
=
json
[
'created_at'
];
updatedAt
=
json
[
'updated_at'
];
customerId
=
json
[
'customer_id'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'id'
]
=
this
.
id
;
data
[
'rating_id'
]
=
this
.
ratingId
;
data
[
'rating_score'
]
=
this
.
ratingScore
;
data
[
'created_at'
]
=
this
.
createdAt
;
data
[
'updated_at'
]
=
this
.
updatedAt
;
data
[
'customer_id'
]
=
this
.
customerId
;
return
data
;
}
}
\ No newline at end of file
lib/service/api.dart
View file @
f6cc3b6d
...
...
@@ -5,6 +5,7 @@ import 'package:feelverapp/model/Login/login_model.dart';
import
'package:feelverapp/model/base/base.dart'
;
import
'package:feelverapp/model/editprofile/getprofilemodel.dart'
;
import
'package:feelverapp/model/favorite/delete_favorite_Model.dart'
;
import
'package:feelverapp/model/favorite/favorite_Model.dart'
;
import
'package:feelverapp/model/forgetpassword/forgetpassModel.dart'
;
...
...
@@ -29,7 +30,31 @@ class Api<T> {
"Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczpcL1wvYmFja2VuZC11YXQuZmVlbHZlci5jb21cL2FwaVwvbG9naW4iLCJpYXQiOjE1OTYxMDAzNTgsImV4cCI6MTYwMzMwMDM1OCwibmJmIjoxNTk2MTAwMzU4LCJqdGkiOiJ2YjA2S0FHR1JtZDFseEw1Iiwic3ViIjozNzMsInBydiI6Ijg3ZTBhZjFlZjlmZDE1ODEyZmRlYzk3MTUzYTE0ZTBiMDQ3NTQ2YWEifQ.UkY70AshvW5O4M63XY_Iv2IPBohSUUwnRF1oi46p2zs"
,
};
static
final
String
baseApi
=
"https://backend-uat.feelver.com/api"
;
Future
<
Response
<
T
>>
deletefavorite
(
Object
body
)
async
{
var
_model
;
var
_fail
;
var
result
;
print
(
"this is body"
+
body
.
toString
());
await
_httpConnection
(
"
${this._baseApi}
/wishlist-item/delete"
,
this
.
_headerApi
,
body
).
then
((
response
){
print
(
"ผลลัพท เท่ากับ"
+
"
${response.body}
"
);
if
(
response
.
statusCode
==
200
){
_model
=
DeletefavoriteModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
result
=
new
Response
<
T
>(
_model
,
_fail
);
});
return
result
;
}
static
final
String
baseApiforimage
=
"https://backend-uat.feelver.com/api/storage/"
;
Future
<
Response
<
T
>>
favorite
(
Object
body
)
async
{
var
_model
;
var
_fail
;
...
...
lib/ui/favorite/favorite.dart
View file @
f6cc3b6d
...
...
@@ -14,12 +14,15 @@ class _FavoriteState extends State<Favorite> {
FavoritePresenter
presenter
;
@override
void
initState
()
{
super
.
initState
();
presenter
=
FavoritePresenter
(
this
);
presenter
.
Favoriteitem
();
presenter
.
Deletefavoriteitem
();
}
@override
...
...
@@ -120,7 +123,9 @@ class _FavoriteState extends State<Favorite> {
icon:
Icon
(
Icons
.
favorite
),
color:
Color
(
0xFFDD175F
),
onPressed:
()
{
print
(
'delete'
);
setState
(()
{
});
},
),
],
...
...
@@ -155,7 +160,7 @@ class _FavoriteState extends State<Favorite> {
color:
Color
(
0xFFEEAFB7
),
),
Text
(
"฿
"
+
presenter
.
favoriteModel
.
wishListItem
[
index
].
product
.
specialPrice
,
"฿
0000"
,
style:
TextStyle
(
decoration:
TextDecoration
.
lineThrough
,
fontSize:
SizeConfig
.
getFontSize
(
16
),
...
...
lib/ui/favorite/favorite_presenter.dart
View file @
f6cc3b6d
import
'package:feelverapp/model/favorite/delete_favorite_Model.dart'
;
import
'package:feelverapp/model/favorite/favorite_Model.dart'
;
import
'package:feelverapp/service/api.dart'
;
import
'package:feelverapp/service/base_presenter.dart'
;
...
...
@@ -8,6 +9,7 @@ class FavoritePresenter extends BasePresenter<Favorite> {
Api
_api
;
final
formkey
=
GlobalKey
<
FormState
>();
FavoriteModel
favoriteModel
;
DeletefavoriteModel
deletefavoriteModel
;
FavoritePresenter
(
State
<
Favorite
>
state
)
:
super
(
state
);
...
...
@@ -25,4 +27,22 @@ class FavoritePresenter extends BasePresenter<Favorite> {
print
(
'res Fail'
);
}
}
Deletefavoriteitem
()
async
{
_api
=
Api
<
DeletefavoriteModel
>();
var
res
=
await
_api
.
deletefavorite
({
"id"
:
"146"
,
});
if
(
res
.
fail
==
null
)
{
setState
(()
{
deletefavoriteModel
=
res
.
success
;
});
}
else
{
print
(
'res Fail'
);
}
}
}
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