Skip to content

Commit

Permalink
Merge pull request #298 from project-violet/ios-appbar-text-color
Browse files Browse the repository at this point in the history
Add appbar to main page
  • Loading branch information
violet-dev authored Jan 1, 2024
2 parents fdd2e1c + 0712701 commit 0c55f18
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 48 deletions.
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

0 comments on commit 0c55f18

Please sign in to comment.