Skip to content

Commit

Permalink
fix setting read
Browse files Browse the repository at this point in the history
  • Loading branch information
LEHOANGLONG0807 committed Feb 15, 2022
1 parent ddd854e commit 69fc427
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 0 additions & 4 deletions lib/pages/read_story/controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 9 additions & 6 deletions lib/pages/read_story/setting_read_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,),
Expand All @@ -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,
],
Expand Down
5 changes: 4 additions & 1 deletion lib/pages/read_story/widget/container_bottom_action.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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: [
Expand Down

0 comments on commit 69fc427

Please sign in to comment.