opt.: home ui

- new: top left settings btn
- opt.: top logo
This commit is contained in:
lollipopkit
2024-12-02 21:41:17 +08:00
parent ddd32e82d4
commit 4ace4af7da
6 changed files with 52 additions and 30 deletions

View File

@@ -2,7 +2,7 @@ import 'package:fl_lib/fl_lib.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:server_box/core/extension/context/locale.dart'; import 'package:server_box/core/extension/context/locale.dart';
import 'package:server_box/view/page/server/tab.dart'; import 'package:server_box/view/page/server/tab.dart';
import 'package:server_box/view/page/setting/entry.dart'; // import 'package:server_box/view/page/setting/entry.dart';
import 'package:server_box/view/page/snippet/list.dart'; import 'package:server_box/view/page/snippet/list.dart';
import 'package:server_box/view/page/ssh/tab.dart'; import 'package:server_box/view/page/ssh/tab.dart';
import 'package:icons_plus/icons_plus.dart'; import 'package:icons_plus/icons_plus.dart';
@@ -13,13 +13,13 @@ enum AppTab {
ssh, ssh,
file, file,
snippet, snippet,
settings, //settings,
; ;
Widget get page { Widget get page {
return switch (this) { return switch (this) {
server => const ServerPage(), server => const ServerPage(),
settings => const SettingsPage(), //settings => const SettingsPage(),
ssh => const SSHTabPage(), ssh => const SSHTabPage(),
file => const LocalFilePage(), file => const LocalFilePage(),
snippet => const SnippetListPage(), snippet => const SnippetListPage(),
@@ -33,11 +33,11 @@ enum AppTab {
label: l10n.server, label: l10n.server,
selectedIcon: const Icon(BoxIcons.bxs_server), selectedIcon: const Icon(BoxIcons.bxs_server),
), ),
settings => NavigationDestination( // settings => NavigationDestination(
icon: const Icon(Icons.settings), // icon: const Icon(Icons.settings),
label: libL10n.setting, // label: libL10n.setting,
selectedIcon: const Icon(Icons.settings), // selectedIcon: const Icon(Icons.settings),
), // ),
ssh => const NavigationDestination( ssh => const NavigationDestination(
icon: Icon(Icons.terminal_outlined), icon: Icon(Icons.terminal_outlined),
label: 'SSH', label: 'SSH',

View File

@@ -9,9 +9,26 @@ final class _AppBar extends StatelessWidget implements PreferredSizeWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SizedBox( return SizedBox(
height: preferredSize.height, height: preferredSize.height,
child: isIOS child: isIOS ? Center(child: _buildLogo()) : null,
? const Center(child: Text(BuildData.name, style: UIs.text15Bold)) );
: null, }
Widget _buildLogo() {
final text = Text(
BuildData.name,
style: TextStyle(
fontSize: 10,
fontWeight: FontWeight.bold,
color: UIs.primaryColor.isBrightColor ? Colors.black : Colors.white,
),
);
return Container(
decoration: BoxDecoration(
color: UIs.primaryColor,
borderRadius: BorderRadius.circular(11),
),
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 1),
child: text,
); );
} }

View File

@@ -25,16 +25,17 @@ final class _TopBar extends StatelessWidget implements PreferredSizeWidget {
context, context,
args: const DebugPageArgs(title: 'Logs(${BuildData.build})'), args: const DebugPageArgs(title: 'Logs(${BuildData.build})'),
), ),
child: const Padding( child: Padding(
padding: EdgeInsets.symmetric(horizontal: 7), padding: const EdgeInsets.symmetric(horizontal: 7),
child: Row( child: Row(
children: [ children: [
Text( Btn.icon(
BuildData.name, icon: const Icon(Icons.settings),
style: TextStyle(fontSize: 20), onTap: () {
textAlign: TextAlign.center, SettingsPage.route.go(context);
},
), ),
Icon( const Icon(
Icons.keyboard_arrow_right, Icons.keyboard_arrow_right,
color: Colors.grey, color: Colors.grey,
size: 17, size: 17,

View File

@@ -70,7 +70,9 @@ class _SettingsPageState extends State<SettingsPage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: TabBar( appBar: AppBar(
title: Text(libL10n.setting, style: const TextStyle(fontSize: 20)),
bottom: TabBar(
controller: _tabCtrl, controller: _tabCtrl,
dividerHeight: 0, dividerHeight: 0,
tabAlignment: TabAlignment.center, tabAlignment: TabAlignment.center,
@@ -79,6 +81,7 @@ class _SettingsPageState extends State<SettingsPage>
.map((e) => Tab(text: e.i18n)) .map((e) => Tab(text: e.i18n))
.toList(growable: false), .toList(growable: false),
), ),
),
// actions: [ // actions: [
// IconButton( // IconButton(
// icon: const Icon(Icons.delete), // icon: const Icon(Icons.delete),
@@ -134,8 +137,9 @@ final class _AppAboutPageState extends State<AppAboutPage>
), ),
UIs.height13, UIs.height13,
SizedBox( SizedBox(
height: 47, height: 77,
child: ListView( child: ListView(
padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 7),
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
children: <Widget>[ children: <Widget>[
Btn.elevated( Btn.elevated(

View File

@@ -478,8 +478,8 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
path: "." path: "."
ref: "v1.0.217" ref: "v1.0.218"
resolved-ref: a07b1d2a004574b3d083f87a295a428286524ef7 resolved-ref: b8108c9ffe1e67da22e8f9003e0adfe2692f3b0b
url: "https://github.com/lppcg/fl_lib" url: "https://github.com/lppcg/fl_lib"
source: git source: git
version: "0.0.1" version: "0.0.1"

View File

@@ -60,7 +60,7 @@ dependencies:
fl_lib: fl_lib:
git: git:
url: https://github.com/lppcg/fl_lib url: https://github.com/lppcg/fl_lib
ref: v1.0.217 ref: v1.0.218
dependency_overrides: dependency_overrides:
# dartssh2: # dartssh2: