mod: remove gradient bg

This commit is contained in:
bggRGjQaUbCoE
2024-09-01 18:22:22 +08:00
parent 280f690f8b
commit d117119890
4 changed files with 71 additions and 145 deletions

View File

@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
@@ -29,7 +28,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
late List defaultTabs;
late List<String> tabbarSort;
RxString defaultSearch = ''.obs;
late bool enableGradientBg;
late bool useSideBar;
@override
@@ -43,8 +41,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
if (setting.get(SettingBoxKey.enableSearchWord, defaultValue: true)) {
searchDefault();
}
enableGradientBg =
setting.get(SettingBoxKey.enableGradientBg, defaultValue: false);
useSideBar = setting.get(SettingBoxKey.useSideBar, defaultValue: false);
// 进行tabs配置
setTabConfig();
@@ -98,22 +94,6 @@ class HomeController extends GetxController with GetTickerProviderStateMixin {
length: tabs.length,
vsync: this,
);
// 监听 tabController 切换
if (enableGradientBg) {
tabController.animation!.addListener(() {
if (tabController.indexIsChanging) {
if (initialIndex.value != tabController.index) {
initialIndex.value = tabController.index;
}
} else {
final int temp = tabController.animation!.value.round();
if (initialIndex.value != temp) {
initialIndex.value = temp;
tabController.index = initialIndex.value;
}
}
});
}
}
@override

View File

@@ -5,7 +5,6 @@ import 'package:flutter/services.dart';
import 'package:get/get.dart';
import 'package:PiliPalaX/common/widgets/network_img_layer.dart';
import 'package:PiliPalaX/utils/feed_back.dart';
import '../../utils/storage.dart';
import './controller.dart';
class HomePage extends StatefulWidget {
@@ -33,30 +32,15 @@ class _HomePageState extends State<HomePage>
@override
Widget build(BuildContext context) {
super.build(context);
// Brightness currentBrightness = MediaQuery.of(context).platformBrightness;
// // 设置状态栏图标的亮度
// if (_homeController.enableGradientBg) {
// SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
// statusBarIconBrightness: currentBrightness == Brightness.light
// ? Brightness.dark
// : Brightness.light,
// ));
// }
Brightness currentBrightness = MediaQuery.of(context).platformBrightness;
// 设置状态栏图标的亮度
SystemChrome.setSystemUIOverlayStyle(SystemUiOverlayStyle(
statusBarIconBrightness: currentBrightness == Brightness.light
? Brightness.dark
: Brightness.light,
));
return Scaffold(
extendBody: true,
// extendBodyBehindAppBar: true,
backgroundColor: Colors.transparent,
appBar: AppBar(
toolbarHeight: 0,
elevation: 0,
backgroundColor: Colors.transparent,
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness:
Theme.of(context).brightness == Brightness.dark
? Brightness.light
: Brightness.dark,
),
),
appBar: AppBar(toolbarHeight: 0, elevation: 0),
body: Column(
children: [
if (!_homeController.useSideBar)
@@ -67,9 +51,7 @@ class _HomePageState extends State<HomePage>
ctr: _homeController,
),
if (_homeController.tabs.length > 1) ...[
if (_homeController.enableGradientBg) ...[
const CustomTabs(),
] else ...[
...[
const SizedBox(height: 4),
SizedBox(
width: double.infinity,