new: ssh tab

This commit is contained in:
lollipopkit
2023-11-12 15:58:54 +08:00
parent 8693ce07a2
commit 790812901d
8 changed files with 195 additions and 101 deletions

View File

@@ -111,7 +111,16 @@ class _HomePageState extends State<HomePage>
return Scaffold(
drawer: _buildDrawer(),
appBar: _buildAppBar(),
appBar: CustomAppBar(
title: const Text(BuildData.name),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),
tooltip: l10n.debug,
onPressed: () => AppRoute.debug().go(context),
),
],
),
body: PageView.builder(
controller: _pageController,
itemCount: AppTab.values.length,
@@ -129,37 +138,6 @@ class _HomePageState extends State<HomePage>
);
}
PreferredSizeWidget _buildAppBar() {
final actions = <Widget>[
IconButton(
icon: const Icon(Icons.developer_mode, size: 23),
tooltip: l10n.debug,
onPressed: () => AppRoute.debug().go(context),
),
];
if (isDesktop && _selectIndex.value == AppTab.server.index) {
actions.add(
ValueBuilder(
listenable: _selectIndex,
build: () {
if (_selectIndex.value != AppTab.server.index) {
return const SizedBox();
}
return IconButton(
icon: const Icon(Icons.refresh, size: 23),
tooltip: 'Refresh',
onPressed: () => Pros.server.refreshData(onlyFailed: true),
);
},
),
);
}
return CustomAppBar(
title: const Text(BuildData.name),
actions: actions,
);
}
Widget _buildBottomBar() {
return NavigationBar(
selectedIndex: _selectIndex.value,
@@ -185,16 +163,16 @@ class _HomePageState extends State<HomePage>
label: l10n.server,
selectedIcon: const Icon(Icons.cloud),
),
const NavigationDestination(
icon: Icon(Icons.terminal_outlined),
label: 'SSH',
selectedIcon: Icon(Icons.terminal),
),
NavigationDestination(
icon: const Icon(Icons.snippet_folder_outlined),
label: l10n.snippet,
selectedIcon: const Icon(Icons.snippet_folder),
),
const NavigationDestination(
icon: Icon(Icons.network_check_outlined),
label: 'Ping',
selectedIcon: Icon(Icons.network_check),
),
],
);
}