From 69fc427fd06ecb730565039afec3898f74a3ae41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=AA=20Ho=C3=A0ng=20Long?= <58676739+LEHOANGLONG1999@users.noreply.github.com> Date: Tue, 15 Feb 2022 22:34:49 +0700 Subject: [PATCH] fix setting read --- lib/pages/read_story/controller.dart | 4 ---- lib/pages/read_story/setting_read_page.dart | 15 +++++++++------ .../widget/container_bottom_action.dart | 5 ++++- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lib/pages/read_story/controller.dart b/lib/pages/read_story/controller.dart index 8bd2b7d..7e030f0 100644 --- a/lib/pages/read_story/controller.dart +++ b/lib/pages/read_story/controller.dart @@ -322,10 +322,6 @@ class ReadStoryController extends GetxController { scaffoldKey.currentState!.openDrawer(); } - void onTapSetting() { - Get.to(() => SettingReadPage()); -// itemScrollController.scrollTo(index: _firstTimeLoad ? _initPageIndex : 0, duration: 150.milliseconds, curve: Curves.linear); - } /// sort truyện diff --git a/lib/pages/read_story/setting_read_page.dart b/lib/pages/read_story/setting_read_page.dart index c59b17b..1f99800 100644 --- a/lib/pages/read_story/setting_read_page.dart +++ b/lib/pages/read_story/setting_read_page.dart @@ -4,14 +4,17 @@ import '../pages.dart'; import '../../common/common.dart'; class SettingReadPage extends StatelessWidget { - ReadStoryController get _controller => Get.find(); + final ReadStoryController controller; + + SettingReadPage(this.controller); + final _theme = Get.theme; final _fontSize = 16.0.obs; final _readHorizontal = false.obs; @override Widget build(BuildContext context) { - _readHorizontal.value = _controller.appController.readHorizontal.value; - _fontSize.value = _controller.textStyle.value.fontSize!; + _readHorizontal.value = controller.appController.readHorizontal.value; + _fontSize.value = controller.textStyle.value.fontSize!; return Scaffold( appBar: AppBar( title: Text('Cài đặt',style: _theme.textTheme.headline6!.textWhite,), @@ -33,10 +36,10 @@ class SettingReadPage extends StatelessWidget { const Spacer(), Text('Lưu lại').elevatedButton( onPressed: () { - if (_controller.appController.readHorizontal.value != _readHorizontal.value) { - _controller.onSaveSettingScrollDirectionStory(readHorizontal: _readHorizontal.value); + if (controller.appController.readHorizontal.value != _readHorizontal.value) { + controller.onSaveSettingScrollDirectionStory(readHorizontal: _readHorizontal.value); } - _controller.onSaveSettingFontSize(fontSize: _fontSize.value); + controller.onSaveSettingFontSize(fontSize: _fontSize.value); }, ).fullWidth, ], diff --git a/lib/pages/read_story/widget/container_bottom_action.dart b/lib/pages/read_story/widget/container_bottom_action.dart index 67c6e61..ac274f8 100644 --- a/lib/pages/read_story/widget/container_bottom_action.dart +++ b/lib/pages/read_story/widget/container_bottom_action.dart @@ -4,6 +4,7 @@ import 'package:truyen_chu/theme/theme.dart'; import '../../../common/common.dart'; import '../../pages.dart'; +import '../setting_read_page.dart'; class ContainerBottomReadAction extends StatelessWidget { final ReadStoryController controller; @@ -73,7 +74,9 @@ class ContainerBottomReadAction extends StatelessWidget { ), 20.verticalSpace, InkWell( - onTap: controller.onTapSetting, + onTap: (){ + Get.to(() => SettingReadPage(controller)); + }, child: Column( mainAxisSize: MainAxisSize.min, children: [