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
620031b6
Commit
620031b6
authored
Jul 24, 2020
by
Mobile : Ball (Apprentice)
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
094947c9
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
254 additions
and
8 deletions
+254
-8
lib/main.dart
+2
-1
lib/model/shoplist/shoplist_Model.dart
+148
-0
lib/service/api.dart
+23
-0
lib/ui/home/home_presenter.dart
+3
-1
lib/ui/shop/shop_list.dart
+41
-6
lib/ui/shop/shoplist_presenter.dart
+29
-0
pubspec.lock
+7
-0
pubspec.yaml
+1
-0
No files found.
lib/main.dart
View file @
620031b6
...
...
@@ -4,6 +4,7 @@ import 'package:feelverapp/ui/booking/booking_detail.dart';
import
'package:feelverapp/ui/home/home.dart'
;
import
'package:feelverapp/ui/login/login.dart'
;
import
'package:feelverapp/ui/my_reviews/my_reviews_page.dart'
;
import
'package:feelverapp/ui/shop/shop_list.dart'
;
import
'package:feelverapp/ui/shop/shop_main.dart'
;
import
'package:feelverapp/ui/splashscreen/splash_screen_page.dart'
;
...
...
@@ -23,7 +24,7 @@ class MyApp extends StatelessWidget {
),
// home: SplashScreenPage(),
home:
HomePage
(),
home:
ShopList
(),
);
}
...
...
lib/model/shoplist/shoplist_Model.dart
0 → 100644
View file @
620031b6
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
;
dynamic
createdAt
;
dynamic
updatedAt
;
String
location
;
String
email
;
String
phone
;
String
mobile
;
String
address
;
String
city
;
String
country
;
String
zipCode
;
String
website
;
String
allowRoute
;
dynamic
excerpt
;
dynamic
detail
;
dynamic
storeLogo
;
dynamic
isFacilities
;
String
distanceWithLocation
;
int
star
;
dynamic
ratings
;
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
});
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'
];
}
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
;
return
data
;
}
}
\ No newline at end of file
lib/service/api.dart
View file @
620031b6
...
...
@@ -9,6 +9,7 @@ import 'package:feelverapp/model/home/home_model.dart';
import
'package:feelverapp/model/register/register_model.dart'
;
import
'package:feelverapp/model/category/category_model.dart'
;
import
'package:feelverapp/model/shoplist/shoplist_Model.dart'
;
import
'package:http/http.dart'
as
http
;
class
Api
<
T
>
{
...
...
@@ -101,6 +102,28 @@ class Api<T> {
}
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
=
shoplistModel
.
fromJson
(
myData
);
}
else
{
_fail
=
FailModel
.
fromJson
(
json
.
decode
(
response
.
body
));
}
result
=
new
Response
<
T
>(
_model
,
_fail
);
});
return
result
;
}
///api environment
Future
<
http
.
Response
>
_httpConnection
(
String
url
,
Map
<
String
,
String
>
headers
,
Object
body
)
async
{
...
...
lib/ui/home/home_presenter.dart
View file @
620031b6
...
...
@@ -13,7 +13,9 @@ class HomePresenter extends BasePresenter<HomePage> {
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
{
...
...
lib/ui/shop/shop_list.dart
View file @
620031b6
import
'package:feelverapp/ui/home/home.dart'
;
import
'package:feelverapp/ui/menu/menu.dart'
;
import
'package:feelverapp/ui/shop/shop_list_detail.dart'
;
import
'package:feelverapp/ui/shop/shoplist_presenter.dart'
;
import
'package:feelverapp/util/SizeConfig.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
class
ShopList
extends
StatefulWidget
{
@override
_ShopListState
createState
()
=>
_ShopListState
();
}
class
_ShopListState
extends
State
<
ShopList
>
{
class
_ShopListState
extends
State
<
ShopList
>
with
TickerProviderStateMixin
{
var
entries
=
new
List
<
String
>.
generate
(
2
,
(
i
)
=>
"Item
$i
"
);
ShoplistPresenter
presenter
;
@override
void
initState
()
{
presenter
=
ShoplistPresenter
(
this
);
presenter
.
Listitem
();
}
@override
void
dispose
()
{
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
SizeConfig
(
context
);
...
...
@@ -249,11 +265,30 @@ class _ShopListState extends State<ShopList> {
bottom:
SizeConfig
.
getPadding
(
10
),
),
child:
ListView
.
builder
(
itemCount:
entries
.
length
,
itemBuilder:
(
context
,
i
)
{
return
_shopItem
(
entries
[
i
]);
},
),
itemCount:
entries
.
length
+
1
,
itemBuilder:
(
context
,
i
)
{
final
widgetItem
=
(
i
==
entries
.
length
);
new
RaisedButton
(
child:
new
Text
(
'Load more ...'
,
style:
new
TextStyle
(
color:
Colors
.
white
,
fontWeight:
FontWeight
.
bold
,
),
),
onPressed:
()
{
var
nextItems
=
new
List
<
String
>.
generate
(
2
,
(
i
)
{
var
itemId
=
i
+
entries
.
length
;
return
"Item
$itemId
"
;
});
setState
(()
{
entries
.
addAll
(
nextItems
);
});
});
return
_shopItem
(
entries
[
i
]);
}),
),
);
}
...
...
lib/ui/shop/shoplist_presenter.dart
0 → 100644
View file @
620031b6
import
'package:feelverapp/model/shoplist/shoplist_Model.dart'
;
import
'package:feelverapp/service/api.dart'
;
import
'package:feelverapp/service/base_presenter.dart'
;
import
'package:feelverapp/ui/shop/shop_list.dart'
;
import
'package:flutter/material.dart'
;
class
ShoplistPresenter
extends
BasePresenter
<
ShopList
>{
Api
_api
;
final
formkey
=
GlobalKey
<
FormState
>();
ShoplistPresenter
(
State
<
ShopList
>
state
)
:
super
(
state
);
Listitem
()
async
{
_api
=
Api
<
shoplistModel
>();
var
res
=
await
_api
.
shoplist
({
"sort"
:
"asc"
,
"lang"
:
"en_US"
,
"limit"
:
"8"
,
});
if
(
res
.
fail
==
null
)
{
print
(
'res Success'
);
}
else
{
print
(
'res Fail'
);
}
}
}
\ No newline at end of file
pubspec.lock
View file @
620031b6
...
...
@@ -128,6 +128,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.1"
loadmore:
dependency: "direct main"
description:
name: loadmore
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
matcher:
dependency: transitive
description:
...
...
pubspec.yaml
View file @
620031b6
...
...
@@ -28,6 +28,7 @@ dependencies:
json_annotation
:
^3.0.1
rflutter_alert
:
^1.0.3
shared_preferences
:
^0.5.6+1
loadmore
:
^1.0.4
dev_dependencies
:
...
...
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