new: hideTitlebar & cupertinoRoute

This commit is contained in:
lollipopkit
2024-04-08 23:43:24 +08:00
parent 7d2fbde2fe
commit 4fd82afade
19 changed files with 93 additions and 29 deletions

View File

@@ -31,7 +31,6 @@ import 'package:toolbox/view/widget/appbar.dart';
import 'package:toolbox/view/widget/cardx.dart';
import 'package:toolbox/view/widget/markdown.dart';
part 'appbar.dart';
class HomePage extends StatefulWidget {
@@ -332,6 +331,7 @@ ${GithubIds.participants.map((e) => '[$e](${e.url})').join(' ')}
}
Future<void> _reqNotiPerm() async {
if (!isAndroid) return;
final suc = await PermUtils.request(Permission.notification);
if (!suc) {
final noNotiPerm = Stores.setting.noNotiPerm;

View File

@@ -42,13 +42,13 @@ Widget _buildLineChart(
Range<double> x, {
String? tooltipPrefix,
bool curve = false,
int verticalInterval = 20,
}) {
return LineChart(LineChartData(
lineTouchData: LineTouchData(
touchTooltipData: LineTouchTooltipData(
tooltipPadding: const EdgeInsets.all(5),
tooltipRoundedRadius: 8,
tooltipMargin: 3,
getTooltipItems: (List<LineBarSpot> touchedSpots) {
return touchedSpots.map((e) {
return LineTooltipItem(
@@ -66,11 +66,12 @@ Widget _buildLineChart(
gridData: FlGridData(
show: true,
drawVerticalLine: false,
horizontalInterval: 20,
horizontalInterval: verticalInterval.toDouble(),
getDrawingHorizontalLine: (value) {
return const FlLine(
color: Color(0xff37434d),
strokeWidth: 1,
dashArray: [5, 17],
);
},
),
@@ -90,21 +91,22 @@ Widget _buildLineChart(
showTitles: true,
interval: 1,
getTitlesWidget: (val, meta) {
if (val % 20 != 0) return UIs.placeholder;
if (val % verticalInterval != 0) return UIs.placeholder;
if (val == 0) return const Text('0 %', style: UIs.text12Grey);
return Text(
val.toInt().toString(),
style: UIs.text12Grey,
);
},
reservedSize: 42,
reservedSize: 27,
),
),
),
borderData: FlBorderData(show: false),
minX: x.start,
maxX: x.end,
minY: 0,
maxY: 100,
minY: -1,
maxY: 101,
lineBarsData: spots
.map((e) => LineChartBarData(
spots: e,

View File

@@ -186,7 +186,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
),
),
childrenPadding: const EdgeInsets.symmetric(vertical: 13),
initiallyExpanded: true,
initiallyExpanded: _getInitExpand(1),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: details,
@@ -201,7 +201,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
ss.cpu.spots,
ss.cpu.rangeX,
tooltipPrefix: 'CPU',
curve: true,
),
),
),

View File

@@ -119,7 +119,7 @@ class _SettingPageState extends State<SettingPage> {
_buildAppColor(),
//_buildLaunchPage(),
_buildCheckUpdate(),
_buildCollapseUI(),
_buildAppMore(),
];
/// Platform specific settings
@@ -1065,4 +1065,29 @@ class _SettingPageState extends State<SettingPage> {
},
);
}
Widget _buildAppMore() {
return ExpandTile(
title: Text(l10n.more),
children: [
_buildCollapseUI(),
_buildCupertinoRoute(),
if (isDesktop) _buildHideTitleBar(),
],
);
}
Widget _buildCupertinoRoute() {
return ListTile(
title: Text('Cupertino ${l10n.route}'),
trailing: StoreSwitch(prop: _setting.cupertinoRoute),
);
}
Widget _buildHideTitleBar() {
return ListTile(
title: Text(l10n.hideTitleBar),
trailing: StoreSwitch(prop: _setting.hideTitleBar),
);
}
}