update home and search

parent ac07dd74
65bf9efbfad64e1b5e4b50eeaed8247f be0f81c896162f43cdffd3c7f9c50177
\ No newline at end of file \ No newline at end of file
...@@ -44,4 +44,4 @@ SPEC CHECKSUMS: ...@@ -44,4 +44,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
COCOAPODS: 1.10.0.beta.1 COCOAPODS: 1.9.1
...@@ -33,7 +33,7 @@ class MyApp extends StatelessWidget { ...@@ -33,7 +33,7 @@ class MyApp extends StatelessWidget {
home: MainShop() home: SplashScreenPage()
//home: EditProfile(), //home: EditProfile(),
......
class categoryModel { class CategoryModel {
List<DATA> dATA; List<Result> result;
categoryModel({this.dATA}); CategoryModel({this.result});
categoryModel.fromJson(Map<String, dynamic> json) { CategoryModel.fromJson(Map<String, dynamic> json) {
if (json['DATA'] != null) { if (json['result'] != null) {
dATA = new List<DATA>(); result = new List<Result>();
json['DATA'].forEach((v) { json['result'].forEach((v) {
dATA.add(new DATA.fromJson(v)); result.add(new Result.fromJson(v));
}); });
} }
} }
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.result != null) {
data['DATA'] = this.dATA.map((v) => v.toJson()).toList(); data['result'] = this.result.map((v) => v.toJson()).toList();
} }
return data; return data;
} }
} }
class DATA { class Result {
int id; int id;
int parentId; int parentId;
String name; String name;
...@@ -29,16 +29,16 @@ class DATA { ...@@ -29,16 +29,16 @@ class DATA {
String displayName; String displayName;
String cover; String cover;
String detail; String detail;
dynamic type; Null type;
String status; String status;
int sortOrder; int sortOrder;
dynamic storeId; Null storeId;
dynamic vendorId; Null vendorId;
dynamic createdAt; Null createdAt;
String updatedAt; String updatedAt;
String visibility; String visibility;
DATA( Result(
{this.id, {this.id,
this.parentId, this.parentId,
this.name, this.name,
...@@ -55,7 +55,7 @@ class DATA { ...@@ -55,7 +55,7 @@ class DATA {
this.updatedAt, this.updatedAt,
this.visibility}); this.visibility});
DATA.fromJson(Map<String, dynamic> json) { Result.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'];
parentId = json['parent_id']; parentId = json['parent_id'];
name = json['name']; name = json['name'];
......
...@@ -220,21 +220,18 @@ class Api<T> { ...@@ -220,21 +220,18 @@ class Api<T> {
return result; return result;
} }
Future<Response<T>> category(Object body) async { Future<Response<T>> category(Object body) async {
var _model; var _model;
var _fail; var _fail;
var result; var result;
print("Result test ");
// (body as Map)['lang'] = allTranslations.currentLanguage;
await _httpConnection("${this._baseApi}/category", this._headerApi, body) await _httpConnection("${this._baseApi}/category", this._headerApi, body)
.then((response) { .then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}"); print("ผลลัพ เท่ากับบบบ " + "${response.body}");
if (response.statusCode == 200) { if (response.statusCode == 200) {
// Array to Map Json _model = CategoryModel.fromJson(json.decode(response.body));
Map<String, dynamic> myData = arrayToJson(response.body);
_model = categoryModel.fromJson(myData);
print('myModel ' + _model);
} else { } else {
_fail = FailModel.fromJson(json.decode(response.body)); _fail = FailModel.fromJson(json.decode(response.body));
} }
...@@ -243,6 +240,10 @@ class Api<T> { ...@@ -243,6 +240,10 @@ class Api<T> {
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;
......
...@@ -11,10 +11,9 @@ class BookingDetail extends StatefulWidget { ...@@ -11,10 +11,9 @@ class BookingDetail extends StatefulWidget {
class _BookingDetailState extends State<BookingDetail> { class _BookingDetailState extends State<BookingDetail> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return ListView(padding: EdgeInsets.all(0), children: <Widget>[
body: _setupView(), _setupView(),
]);
);
} }
_setupView() { _setupView() {
......
...@@ -21,7 +21,7 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -21,7 +21,7 @@ class HomePresenter extends BasePresenter<HomePage> {
GetprofileModel getmodel; GetprofileModel getmodel;
LoginModel logmodel; LoginModel logmodel;
categoryModel CatModel; CategoryModel CatModel;
TextEditingController searchCtrl = TextEditingController(); TextEditingController searchCtrl = TextEditingController();
SearchhomeModel searchhomeModel; SearchhomeModel searchhomeModel;
...@@ -29,19 +29,21 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -29,19 +29,21 @@ class HomePresenter extends BasePresenter<HomePage> {
HomePresenter(State<HomePage> state) : super(state); HomePresenter(State<HomePage> state) : super(state);
Listitem() async { Listitem() async {
_api = Api<categoryModel>();
_api = Api<CategoryModel>();
var res = await _api.category({ var res = await _api.category({
"access_type": "portal", "access_type": "mobile",
}); });
// LoadingView(state.context).hide();
if (res.fail == null){ if (res.success != null){
setState(() { setState(() {
CatModel = res.success; CatModel = res.success;
print("dddddddddddddddd"); print("dddddddddddddddd");
print('${CatModel.dATA[0].name}');
}); });
} else { } else {
...@@ -50,21 +52,23 @@ class HomePresenter extends BasePresenter<HomePage> { ...@@ -50,21 +52,23 @@ class HomePresenter extends BasePresenter<HomePage> {
} }
getSearch() async{ getSearch() async{
LoadingView(state.context).show();
_api = Api<SearchhomeModel>(); _api = Api<SearchhomeModel>();
var res = await _api.homesearch({ var res = await _api.homesearch({
"keyword_shop" : searchCtrl.text, "keyword_shop" : searchCtrl.text,
"lang" : "all", "lang" : "all",
"access" : "portal", "access" : "portal",
}); });
LoadingView(state.context).hide();
print('$searchCtrl'); print('$searchCtrl');
if (res.fail == null) if (res.success.status) { if (res.fail == null)
setState(() { setState(() {
searchhomeModel = res.success; searchhomeModel = res.success;
category_model = res.success; category_model = res.success;
}); });
}
else{ else{
} }
......
...@@ -117,6 +117,8 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage> { ...@@ -117,6 +117,8 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage> {
), ),
); );
}, },
child: Card( child: Card(
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
......
...@@ -345,6 +345,24 @@ class _ShopListState extends State<ShopList> with TickerProviderStateMixin { ...@@ -345,6 +345,24 @@ class _ShopListState extends State<ShopList> with TickerProviderStateMixin {
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
), ),
), ),
Positioned(
left: SizeConfig.getPadding(280),
top: SizeConfig.getPadding(190),
child:Icon(Icons.star,color: Colors.orangeAccent,size: SizeConfig.getFontSize(18),),
),
Positioned(
left: SizeConfig.getPadding(300),
top: SizeConfig.getPadding(190),
child: Text(
"4.9",
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
),
], ],
), ),
), ),
...@@ -390,104 +408,8 @@ class _ShopListState extends State<ShopList> with TickerProviderStateMixin { ...@@ -390,104 +408,8 @@ class _ShopListState extends State<ShopList> with TickerProviderStateMixin {
fontWeight: FontWeight.w700), fontWeight: FontWeight.w700),
), ),
), ),
Row(
children: <Widget>[
SizedBox(
width: SizeConfig.getWidth(20),
),
Image.asset(
'assets/images/clock.png',
width: SizeConfig.getWidth(20),
height: SizeConfig.getWidth(20),
),
SizedBox(
width: SizeConfig.getWidth(10),
),
Text(
'90 นาที',
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black87,
fontSize: SizeConfig.getFontSize(12),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
SizedBox(
width: SizeConfig.getWidth(30),
),
Image.asset(
'assets/images/sell.png',
width: SizeConfig.getWidth(20),
height: SizeConfig.getWidth(20),
),
SizedBox(
width: SizeConfig.getWidth(5),
),
Text(
'฿1,599.00 ',
textAlign: TextAlign.left,
style: TextStyle(
color: Color.fromRGBO(238, 175, 183, 1),
fontSize: SizeConfig.getFontSize(12),
decoration: TextDecoration.lineThrough,
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w500),
),
SizedBox(
width: SizeConfig.getWidth(5),
),
Text(
'฿1,599.00 ',
textAlign: TextAlign.left,
style: TextStyle(
color: Color.fromRGBO(253, 41, 86, 1),
fontSize: SizeConfig.getFontSize(22),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
],
),
InkWell(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ShopListDetail(),
),
);
},
child: Stack(
children: <Widget>[
Container(
child: Image.asset('assets/images/btn_shoplist.png'),
padding: EdgeInsets.only(
left: SizeConfig.getPadding(20),
right: SizeConfig.getPadding(20),
top: SizeConfig.getPadding(20),
bottom: SizeConfig.getPadding(20),
),
),
Container(
alignment: Alignment.center,
child: Text(
'หยิบใส่รถเข็น',
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: SizeConfig.getFontSize(14),
fontFamily: "SF_Pro_Text",
fontWeight: FontWeight.w700),
),
padding: EdgeInsets.only(
left: SizeConfig.getPadding(60),
right: SizeConfig.getPadding(20),
top: SizeConfig.getPadding(30),
bottom: SizeConfig.getPadding(20),
),
)
],
),
)
], ],
), ),
); );
......
import 'package:feelverapp/ui/booking/booking_detail.dart';
import 'package:feelverapp/ui/shop/shop.dart'; import 'package:feelverapp/ui/shop/shop.dart';
import 'package:feelverapp/ui/shop/shop_Nearby_places.dart'; import 'package:feelverapp/ui/shop/shop_Nearby_places.dart';
import 'package:feelverapp/ui/shop/shop_reviews.dart'; import 'package:feelverapp/ui/shop/shop_reviews.dart';
...@@ -154,7 +155,7 @@ class _MainShopState extends State<MainShop> with SingleTickerProviderStateMixi ...@@ -154,7 +155,7 @@ class _MainShopState extends State<MainShop> with SingleTickerProviderStateMixi
//service detail////////////// //service detail//////////////
child:Shop() child:BookingDetail()
), ),
......
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