Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add appbar to main page #298

Merged
merged 6 commits into from
Jan 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 26 additions & 20 deletions lib/pages/after_loading/afterloading_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:fluttertoast/fluttertoast.dart';
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
import 'package:uni_links/uni_links.dart';
Expand Down Expand Up @@ -342,26 +343,31 @@ class AfterLoadingPageState extends State<AfterLoadingPage>
? _buildBottomNavigationBar(context)
: null,
drawer: _usesDrawer ? _buildDrawer(context) : null,
body: Stack(
children: [
if (kReleaseMode) const ScriptWebView(),
PageView(
controller: _pageController,
physics:
_usesDrawer ? const NeverScrollableScrollPhysics() : null,
onPageChanged: (newPage) {
setState(() {});
},
children: <Widget>[
if (!Settings.liteMode) MainPage(key: _widgetKeys[0]),
SearchPage(key: _widgetKeys[1]),
if (Settings.liteMode) HotPage(key: _widgetKeys[2]),
BookmarkPage(key: _widgetKeys[3]),
DownloadPage(key: _widgetKeys[4]),
SettingsPage(key: _widgetKeys[5]),
],
),
],
body: AnnotatedRegion<SystemUiOverlayStyle>(
value: Settings.themeWhat
? SystemUiOverlayStyle.dark
: SystemUiOverlayStyle.light,
child: Stack(
children: [
if (kReleaseMode) const ScriptWebView(),
PageView(
controller: _pageController,
physics:
_usesDrawer ? const NeverScrollableScrollPhysics() : null,
onPageChanged: (newPage) {
setState(() {});
},
children: <Widget>[
if (!Settings.liteMode) MainPage(key: _widgetKeys[0]),
SearchPage(key: _widgetKeys[1]),
if (Settings.liteMode) HotPage(key: _widgetKeys[2]),
BookmarkPage(key: _widgetKeys[3]),
DownloadPage(key: _widgetKeys[4]),
SettingsPage(key: _widgetKeys[5]),
],
),
],
),
),
),
);
Expand Down
44 changes: 22 additions & 22 deletions lib/pages/settings/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -811,30 +811,30 @@ class _SettingsPageState extends State<SettingsPage>
},
),
if (!Settings.liteMode) _buildDivider(),
// if (!Settings.liteMode)
InkWell(
child: ListTile(
leading: Icon(Mdi.compassOutline, color: Settings.majorColor),
title: const Text('Pure Search'),
trailing: Switch(
value: Settings.searchPure,
onChanged: (newValue) async {
await Settings.setSearchPure(newValue);
setState(() {
_shouldReload = true;
});
},
activeTrackColor: Settings.majorColor,
activeColor: Settings.majorAccentColor,
if (!Settings.liteMode)
InkWell(
child: ListTile(
leading: Icon(Mdi.compassOutline, color: Settings.majorColor),
title: const Text('Pure Search'),
trailing: Switch(
value: Settings.searchPure,
onChanged: (newValue) async {
await Settings.setSearchPure(newValue);
setState(() {
_shouldReload = true;
});
},
activeTrackColor: Settings.majorColor,
activeColor: Settings.majorAccentColor,
),
),
onTap: () async {
await Settings.setSearchPure(!Settings.searchPure);
setState(() {
_shouldReload = true;
});
},
),
onTap: () async {
await Settings.setSearchPure(!Settings.searchPure);
setState(() {
_shouldReload = true;
});
},
),
_buildDivider(),
InkWell(
customBorder: const RoundedRectangleBorder(
Expand Down
8 changes: 3 additions & 5 deletions lib/pages/viewer/viewer_controller.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// This source code is a part of Project Violet.
// Copyright (C) 2020-2023. violet-team. Licensed under the Apache-2.0 License.

import 'dart:io';

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
Expand Down Expand Up @@ -40,7 +38,7 @@ class ViewerController extends GetxController {
var animation = Settings.animation.obs;
var rightToLeft = Settings.rightToLeft.obs;
var imgQuality = Settings.imageQuality.obs;
var fullscreen = (!Settings.disableFullScreen || Platform.isIOS).obs;
var fullscreen = (!Settings.disableFullScreen).obs;

/// horizontal viewer option
var viewScrollType =
Expand Down Expand Up @@ -216,14 +214,14 @@ class ViewerController extends GetxController {
if (!overlay.value) {
overlay.value = !overlay.value;
opacity.value = 1.0;
if (!Settings.disableFullScreen || Platform.isIOS) {
if (!Settings.disableFullScreen) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: [
SystemUiOverlay.top,
SystemUiOverlay.bottom,
]);
}
} else {
if (!Settings.disableFullScreen || Platform.isIOS) {
if (!Settings.disableFullScreen) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
}
opacity.value = 0.0;
Expand Down
2 changes: 1 addition & 1 deletion lib/pages/viewer/viewer_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class _ViewerPageState extends State<ViewerPage> {
_initProvider = CallOnce(_initAfterProvider);
_startsTime = DateTime.now();

if (!Settings.disableFullScreen || Platform.isIOS) {
if (!Settings.disableFullScreen) {
SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);
}

Expand Down
Loading