Skip to content

Commit

Permalink
update ui step 2
Browse files Browse the repository at this point in the history
  • Loading branch information
LEHOANGLONG0807 committed Feb 11, 2022
1 parent 0ecba16 commit eba0444
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 34 deletions.
Binary file modified assets/images/ic_add_book.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/ic_classify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ic_history.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/ic_home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/ic_story_board.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 10 additions & 2 deletions lib/pages/classify/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,28 @@ class ClassifyController extends GetxController {
@override
void onInit() {
super.onInit();

}

@override
void onReady() {
super.onReady();
mainCategory.value = appController.mainCategory;
subCategory.value = appController.subCategory;
}

void onTapItemCategory(TagModel model) async {
await analytics.setUserProperty(name: TAG_STORY, value: '${model.id}');
await analytics.logEvent(name: EVENT_LIST_BY_TAG, parameters: {'id': model.id});
Get.toNamed(Routes.LIST_STORY, arguments: {'title': model.name ?? '', 'url': '/stories/?tag_id=${model.id}'});
Get.toNamed(Routes.LIST_STORY,
arguments: {'title': model.name ?? '', 'url': '/stories/?tag_id=${model.id}'});
}

void onTapItemTag(TagModel model) async {
await analytics.setUserProperty(name: SUGGEST_TAG_STORY, value: '${model.id}');
await analytics.logEvent(name: EVENT_LIST_BY_SUGGEST_TAG, parameters: {'id': model.id});
Get.toNamed(Routes.LIST_STORY, arguments: {'title': model.name ?? '', 'url': '/stories/suggest/?tag_id=${model.id}'});
Get.toNamed(Routes.LIST_STORY,
arguments: {'title': model.name ?? '', 'url': '/stories/suggest/?tag_id=${model.id}'});
}

void feedBackStoryListen() {
Expand Down
17 changes: 2 additions & 15 deletions lib/pages/classify/widget/list_category_story_read.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,12 @@ class ListCategoryStoryRead extends StatelessWidget {

@override
Widget build(BuildContext context) {
return Obx(
() {
return SingleChildScrollView(
child: Column(
children: [
_buildMainCategory(),
// _buildSubCategory(),
],
),
);
},
);
return _buildMainCategory();
}

Widget _buildMainCategory() {
final _models = _controller.mainCategory+_controller.subCategory;
final _models = (_controller.mainCategory+_controller.subCategory).toList();
return GridView.count(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
crossAxisCount: 2,
childAspectRatio: 3.5,
padding: const EdgeInsets.only(bottom: 12),
Expand Down
5 changes: 2 additions & 3 deletions lib/pages/detail_story/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class DetailStoryController extends GetxController {

int _totalPageChapter = 0;

final backgroundColor = AssetColors.primary.obs;
final backgroundColor = Color(0xffbdd4e7).obs;

late RewardedAd _rewardedAd;

Expand Down Expand Up @@ -94,8 +94,6 @@ class DetailStoryController extends GetxController {
}
EasyLoading.dismiss();
_checkStoryBoardLocal();
final _random = Random().nextInt(8);
backgroundColor.value = AssetColors.primary;
} catch (e) {
EasyLoading.dismiss();
EasyLoading.showError('Đã xảy ra lỗi!');
Expand Down Expand Up @@ -158,6 +156,7 @@ class DetailStoryController extends GetxController {
EasyLoading.show();
final _boardLocalModel = storyModel.value.toStoryBroadLocalModel;
final _response = await dbService.addStoryBoard(model: _boardLocalModel);
EasyLoading.dismiss();
if (_response) {
showSnackBarSuccess(message: 'Thêm vào tủ truyện thành công!');
showButtonAddBoard.value = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/detail_story/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class DetailStoryPage extends GetView<DetailStoryController> {
width: 20,
)
: Text(
'+ Thêm vào tủ truyện',
'+ Lưu truyện',
style: TextStyle(color: Colors.white),
),
)
Expand Down
3 changes: 2 additions & 1 deletion lib/pages/home/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class HomePage extends GetView<HomeController> {
body: SafeArea(
child: Column(
children: [
20.verticalSpace,
TextFormField(
textInputAction: TextInputAction.search,
readOnly: true,
Expand All @@ -37,7 +38,7 @@ class HomePage extends GetView<HomeController> {
color: AssetColors.colorGrey262626,
),
),
).paddingSymmetric(horizontal: 20),
).paddingSymmetric(horizontal: 20).wrapHeight(40),
20.verticalSpace,
Expanded(child: _buildContainerStoryRead().paddingSymmetric(horizontal: 10)),
],
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/home/widget/container_story.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class ContainerStoryHome extends StatelessWidget {
padding: EdgeInsets.zero,
mainAxisSpacing: 10,
crossAxisSpacing: 6,
children: (models.length>8?models.sublist(0,8):models).map((item) {
children: (models.length>12?models.sublist(0,12):models).map((item) {
return ItemStoryHome(
model: item,
onTap: () => _controller.onTapStory(item.id),
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/main/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MainController extends GetxController {
BottomNavBarModel(icon: 'ic_home', label: 'Trang chủ', page: HomePage()),
BottomNavBarModel(icon: 'ic_classify', label: 'Phân Loại', page: ClassifyPage()),
BottomNavBarModel(icon: 'ic_story_board', label: 'Tủ truyện', page: StoryBoardPage()),
BottomNavBarModel(icon: 'ic_story_board', label: 'Lịch Sử', page: HistoryReadingPage()),
BottomNavBarModel(icon: 'ic_history', label: 'Lịch Sử', page: HistoryReadingPage()),
];
}

Expand Down
30 changes: 21 additions & 9 deletions lib/pages/main/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,27 @@ class MainPage extends GetResponsiveView<MainController> {
return Obx(
() => Scaffold(
bottomNavigationBar: BottomNavigationBar(
items: controller.bottomNavBarItems
.map(
(item) => BottomNavigationBarItem(
icon: Image.asset(item.icon.assetPathPNG, color: Colors.white, width: 24),
activeIcon: Image.asset(item.icon.assetPathPNG, color: Colors.white, width: 24),
label: item.label,
),
)
.toList(),
items: controller.bottomNavBarItems.asMap().keys.map((index) {
final item = controller.bottomNavBarItems[index];
return BottomNavigationBarItem(
icon: Image.asset(item.icon.assetPathPNG, color: Colors.white, width: 20),
activeIcon: Image.asset(item.icon.assetPathPNG, color: Colors.white, width: 24),
title: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(item.label),
2.verticalSpace,
AnimatedContainer(
duration: 250.milliseconds,
width: 50,
height: 3,
color: controller.currentTabIndex.value == index
? Colors.white
: Colors.transparent,
),
],
));
}).toList(),
type: BottomNavigationBarType.fixed,
showSelectedLabels: true,
backgroundColor: _theme.primaryColor,
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/read_story/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ class ReadStoryPage extends GetView<ReadStoryController> {
child: Row(
children: [
Text(
'Thêm vào tủ truyện',
'Lưu truyện',
style: _theme.textTheme.subtitle1!.text434343,
),
5.horizontalSpace,
Expand Down
1 change: 1 addition & 0 deletions lib/pages/search/widget/text_field_search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class TextFieldSearch extends StatelessWidget {
TextFormField(
controller: _controller.textController,
textInputAction: TextInputAction.search,
autofocus: true,
decoration: InputDecoration(
fillColor: AssetColors.colorGreyE7E7E7,
hintText: 'Nhập tên truyện',
Expand Down

0 comments on commit eba0444

Please sign in to comment.