update home and search

parent ac07dd74
65bf9efbfad64e1b5e4b50eeaed8247f
\ No newline at end of file
be0f81c896162f43cdffd3c7f9c50177
\ No newline at end of file
......@@ -44,4 +44,4 @@ SPEC CHECKSUMS:
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
COCOAPODS: 1.10.0.beta.1
COCOAPODS: 1.9.1
......@@ -33,7 +33,7 @@ class MyApp extends StatelessWidget {
home: MainShop()
home: SplashScreenPage()
//home: EditProfile(),
......
class categoryModel {
List<DATA> dATA;
class CategoryModel {
List<Result> result;
categoryModel({this.dATA});
CategoryModel({this.result});
categoryModel.fromJson(Map<String, dynamic> json) {
if (json['DATA'] != null) {
dATA = new List<DATA>();
json['DATA'].forEach((v) {
dATA.add(new DATA.fromJson(v));
CategoryModel.fromJson(Map<String, dynamic> json) {
if (json['result'] != null) {
result = new List<Result>();
json['result'].forEach((v) {
result.add(new Result.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();
if (this.result != null) {
data['result'] = this.result.map((v) => v.toJson()).toList();
}
return data;
}
}
class DATA {
class Result {
int id;
int parentId;
String name;
......@@ -29,16 +29,16 @@ class DATA {
String displayName;
String cover;
String detail;
dynamic type;
Null type;
String status;
int sortOrder;
dynamic storeId;
dynamic vendorId;
dynamic createdAt;
Null storeId;
Null vendorId;
Null createdAt;
String updatedAt;
String visibility;
DATA(
Result(
{this.id,
this.parentId,
this.name,
......@@ -55,7 +55,7 @@ class DATA {
this.updatedAt,
this.visibility});
DATA.fromJson(Map<String, dynamic> json) {
Result.fromJson(Map<String, dynamic> json) {
id = json['id'];
parentId = json['parent_id'];
name = json['name'];
......
......@@ -220,21 +220,18 @@ class Api<T> {
return result;
}
Future<Response<T>> category(Object body) async {
Future<Response<T>> category(Object body) async {
var _model;
var _fail;
var result;
print("Result test ");
// (body as Map)['lang'] = allTranslations.currentLanguage;
await _httpConnection("${this._baseApi}/category", this._headerApi, body)
.then((response) {
print("ผลลัพท์ เท่ากับ " "${response.body}");
print("ผลลัพ เท่ากับบบบ " + "${response.body}");
if (response.statusCode == 200) {
// Array to Map Json
Map<String, dynamic> myData = arrayToJson(response.body);
_model = categoryModel.fromJson(myData);
print('myModel ' + _model);
_model = CategoryModel.fromJson(json.decode(response.body));
} else {
_fail = FailModel.fromJson(json.decode(response.body));
}
......@@ -243,6 +240,10 @@ class Api<T> {
return result;
}
Future<Response<T>> shoplist(Object body) async {
var _model;
var _fail;
......
......@@ -11,10 +11,9 @@ class BookingDetail extends StatefulWidget {
class _BookingDetailState extends State<BookingDetail> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: _setupView(),
);
return ListView(padding: EdgeInsets.all(0), children: <Widget>[
_setupView(),
]);
}
_setupView() {
......
......@@ -21,7 +21,7 @@ class HomePresenter extends BasePresenter<HomePage> {
GetprofileModel getmodel;
LoginModel logmodel;
categoryModel CatModel;
CategoryModel CatModel;
TextEditingController searchCtrl = TextEditingController();
SearchhomeModel searchhomeModel;
......@@ -29,19 +29,21 @@ class HomePresenter extends BasePresenter<HomePage> {
HomePresenter(State<HomePage> state) : super(state);
Listitem() async {
_api = Api<categoryModel>();
_api = Api<CategoryModel>();
var res = await _api.category({
"access_type": "portal",
"access_type": "mobile",
});
if (res.fail == null){
// LoadingView(state.context).hide();
if (res.success != null){
setState(() {
CatModel = res.success;
print("dddddddddddddddd");
print('${CatModel.dATA[0].name}');
});
} else {
......@@ -50,21 +52,23 @@ class HomePresenter extends BasePresenter<HomePage> {
}
getSearch() async{
LoadingView(state.context).show();
_api = Api<SearchhomeModel>();
var res = await _api.homesearch({
"keyword_shop" : searchCtrl.text,
"lang" : "all",
"access" : "portal",
});
LoadingView(state.context).hide();
print('$searchCtrl');
if (res.fail == null) if (res.success.status) {
if (res.fail == null)
setState(() {
searchhomeModel = res.success;
category_model = res.success;
});
}
else{
}
......
......@@ -117,6 +117,8 @@ class _ShopNearbyPlacesPageState extends State<ShopNearbyPlacesPage> {
),
);
},
child: Card(
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
......
......@@ -345,6 +345,24 @@ class _ShopListState extends State<ShopList> with TickerProviderStateMixin {
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 {
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_Nearby_places.dart';
import 'package:feelverapp/ui/shop/shop_reviews.dart';
......@@ -154,7 +155,7 @@ class _MainShopState extends State<MainShop> with SingleTickerProviderStateMixi
//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