-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ feat/#4: feat food category list in home view
- design food category list grid composition - add food category viewModel list object and get method - add food category dummy date for initialization - add tap event when clicking on items Signed-off-by: EunJiJung <bianbbc87@gmail.com>
- Loading branch information
Showing
8 changed files
with
138 additions
and
12 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:farm04_modeul/app/config/color_system.dart'; | ||
import 'package:farm04_modeul/app/config/font_system.dart'; | ||
import 'package:farm04_modeul/presentation/view_model/home/home_view_model.dart'; | ||
import 'package:farm04_modeul/presentation/widget/image/svg_image_box.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
|
||
class HomeFoodCategoryItem extends StatelessWidget { | ||
const HomeFoodCategoryItem({ | ||
super.key, | ||
required this.state, | ||
required this.onTap, | ||
}); | ||
|
||
final HomeFoodCategoryItemState state; | ||
final Function() onTap; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
onTap: onTap, | ||
child: Column( | ||
children: [ | ||
SvgImageBox( | ||
assetPath: state.assetsPath, | ||
width: 45, | ||
height: 45, | ||
color: ColorSystem.primary.shade500 | ||
), | ||
Text( | ||
state.name, | ||
style: FontSystem.Sub4Bold, | ||
) | ||
], | ||
), | ||
); | ||
} | ||
} |
33 changes: 28 additions & 5 deletions
33
lib/presentation/view/home/widget/home_food_category_list_view.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,40 @@ | ||
import 'package:farm04_modeul/app/config/app_routes.dart'; | ||
import 'package:farm04_modeul/core/view/base_widget.dart'; | ||
import 'package:farm04_modeul/presentation/view/home/widget/component/home_food_category_item.dart'; | ||
import 'package:farm04_modeul/presentation/view_model/home/home_view_model.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
|
||
class HomeFoodCategoryListView extends BaseWidget<HomeViewModel>{ | ||
const HomeFoodCategoryListView({super.key}); | ||
|
||
@override | ||
Widget buildView(BuildContext context) { | ||
return Scaffold( | ||
body: Center( | ||
child: const Text('This is the Home Food Category List View!'), | ||
), | ||
); /// 임시 scaffold | ||
return Obx( | ||
() { | ||
List<HomeFoodCategoryItemState> items = viewModel.homeFoodCategoryOverviewList; | ||
|
||
return GridView.builder( | ||
padding: EdgeInsets.symmetric(horizontal: 0), | ||
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( | ||
crossAxisCount: 5, mainAxisSpacing: 5), | ||
itemCount: items.length, | ||
itemBuilder: (context, index) { | ||
return HomeFoodCategoryItem( | ||
state: items[index], | ||
onTap: () { | ||
Get.toNamed( | ||
AppRoutes.HOME_LIST_DETAIL, | ||
arguments: { | ||
'id': items[index].id, | ||
} | ||
); | ||
}, | ||
); | ||
} | ||
); | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters