mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
@@ -942,7 +942,7 @@ abstract class S {
|
||||
/// No description provided for @setting.
|
||||
///
|
||||
/// In en, this message translates to:
|
||||
/// **'Setting'**
|
||||
/// **'Settings'**
|
||||
String get setting;
|
||||
|
||||
/// No description provided for @sftpDlPrepare.
|
||||
|
||||
@@ -454,7 +454,7 @@ class SEn extends S {
|
||||
String get serverTabUnkown => 'Unknown state';
|
||||
|
||||
@override
|
||||
String get setting => 'Setting';
|
||||
String get setting => 'Settings';
|
||||
|
||||
@override
|
||||
String get sftpDlPrepare => 'Preparing to connect...';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.6.10'
|
||||
ext.kotlin_version = '1.8.0'
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
|
||||
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-all.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
|
||||
|
||||
63
lib/app.dart
63
lib/app.dart
@@ -19,72 +19,27 @@ class MyApp extends StatelessWidget {
|
||||
setTransparentNavigationBar(context);
|
||||
primaryColor = Color(_setting.primaryColor.fetch()!);
|
||||
|
||||
final textStyle = TextStyle(color: primaryColor);
|
||||
final materialColor = primaryColor.materialStateColor;
|
||||
final materialColorAlpha = primaryColor.withOpacity(0.7).materialStateColor;
|
||||
final fabTheme =
|
||||
FloatingActionButtonThemeData(backgroundColor: primaryColor);
|
||||
final switchTheme = SwitchThemeData(
|
||||
thumbColor: materialColor,
|
||||
trackColor: materialColorAlpha,
|
||||
);
|
||||
final appBarTheme = AppBarTheme(backgroundColor: primaryColor);
|
||||
final iconTheme = IconThemeData(color: primaryColor);
|
||||
final inputDecorationTheme = InputDecorationTheme(
|
||||
labelStyle: textStyle,
|
||||
focusedBorder: UnderlineInputBorder(
|
||||
borderSide: BorderSide(color: primaryColor),
|
||||
),
|
||||
);
|
||||
final radioTheme = RadioThemeData(
|
||||
fillColor: materialColor,
|
||||
);
|
||||
final primarySwatch = primaryColor.materialColor;
|
||||
|
||||
return ValueListenableBuilder<int>(
|
||||
valueListenable: _setting.themeMode.listenable(),
|
||||
builder: (_, tMode, __) {
|
||||
final ok = tMode >= 0 && tMode <= ThemeMode.values.length - 1;
|
||||
final themeMode = ok ? ThemeMode.values[tMode] : ThemeMode.system;
|
||||
|
||||
final theme = ThemeData(
|
||||
useMaterial3: false,
|
||||
primaryColor: primaryColor,
|
||||
primarySwatch: primarySwatch,
|
||||
appBarTheme: appBarTheme,
|
||||
floatingActionButtonTheme: fabTheme,
|
||||
iconTheme: iconTheme,
|
||||
primaryIconTheme: iconTheme,
|
||||
switchTheme: switchTheme,
|
||||
inputDecorationTheme: inputDecorationTheme,
|
||||
radioTheme: radioTheme,
|
||||
);
|
||||
final darkTheme = ThemeData(
|
||||
useMaterial3: false,
|
||||
primaryColor: primaryColor,
|
||||
primarySwatch: primarySwatch,
|
||||
floatingActionButtonTheme: fabTheme,
|
||||
iconTheme: iconTheme,
|
||||
primaryIconTheme: iconTheme,
|
||||
switchTheme: switchTheme,
|
||||
inputDecorationTheme: inputDecorationTheme,
|
||||
radioTheme: radioTheme,
|
||||
brightness: Brightness.dark,
|
||||
colorScheme: ColorScheme.fromSwatch(
|
||||
primarySwatch: primaryColor.materialColor,
|
||||
brightness: Brightness.dark,
|
||||
accentColor: primaryColor,
|
||||
),
|
||||
);
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
localizationsDelegates: S.localizationsDelegates,
|
||||
supportedLocales: S.supportedLocales,
|
||||
title: BuildData.name,
|
||||
themeMode: themeMode,
|
||||
theme: theme,
|
||||
darkTheme: darkTheme,
|
||||
theme: ThemeData(
|
||||
useMaterial3: true,
|
||||
colorSchemeSeed: primaryColor,
|
||||
),
|
||||
darkTheme: ThemeData(
|
||||
useMaterial3: true,
|
||||
brightness: Brightness.dark,
|
||||
colorSchemeSeed: primaryColor,
|
||||
),
|
||||
home: const MyHomePage(),
|
||||
);
|
||||
},
|
||||
|
||||
@@ -29,6 +29,7 @@ void showSnackBarWithAction(BuildContext context, String content, String action,
|
||||
GestureTapCallback onTap) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
|
||||
content: Text(content),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
action: SnackBarAction(
|
||||
label: action,
|
||||
onPressed: onTap,
|
||||
|
||||
@@ -140,7 +140,7 @@
|
||||
"serverTabLoading": "Loading...",
|
||||
"serverTabPlzSave": "Please 'save' this private key again.",
|
||||
"serverTabUnkown": "Unknown state",
|
||||
"setting": "Setting",
|
||||
"setting": "Settings",
|
||||
"sftpDlPrepare": "Preparing to connect...",
|
||||
"sftpNoDownloadTask": "No download task.",
|
||||
"sftpSSHConnected": "SFTP Connected",
|
||||
|
||||
@@ -110,7 +110,7 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
return Scaffold(
|
||||
drawer: _buildDrawer(),
|
||||
appBar: AppBar(
|
||||
title: Text(tabTitleName(context, _selectIndex), style: textSize18),
|
||||
title: Text(tabTitleName(context, _selectIndex)),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.developer_mode, size: 23),
|
||||
@@ -123,68 +123,47 @@ class _MyHomePageState extends State<MyHomePage>
|
||||
body: PageView(
|
||||
physics: const ClampingScrollPhysics(),
|
||||
controller: _pageController,
|
||||
onPageChanged: (i) {
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
_selectIndex = i;
|
||||
setState(() {});
|
||||
onPageChanged: (index) {
|
||||
setState(() {
|
||||
_selectIndex = index;
|
||||
FocusScope.of(context).requestFocus(FocusNode());
|
||||
});
|
||||
},
|
||||
children: const [ServerPage(), ConvertPage(), PingPage()],
|
||||
),
|
||||
bottomNavigationBar: _buildBottom(context),
|
||||
bottomNavigationBar: _buildBottomBar(context),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottomItem(int idx, NavigationItem item, bool isSelected) {
|
||||
final width = _width / tabItems.length;
|
||||
return AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 377),
|
||||
curve: Curves.fastOutSlowIn,
|
||||
height: 50,
|
||||
width: isSelected ? width : width - 17,
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected
|
||||
? _bottomItemOverlayColor.resolve(context)
|
||||
: Colors.transparent,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(50),
|
||||
Widget _buildBottomBar(BuildContext context){
|
||||
return NavigationBar(
|
||||
selectedIndex: _selectIndex,
|
||||
animationDuration: const Duration(milliseconds: 250),
|
||||
onDestinationSelected: (int index) {
|
||||
setState(() {
|
||||
_selectIndex = index;
|
||||
_pageController.animateToPage(index,
|
||||
duration: const Duration(milliseconds: 677),
|
||||
curve: Curves.fastLinearToSlowEaseIn);
|
||||
});
|
||||
},
|
||||
labelBehavior: NavigationDestinationLabelBehavior.onlyShowSelected,
|
||||
destinations: const [
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.cloud_outlined),
|
||||
label: 'Server',
|
||||
selectedIcon: Icon(Icons.cloud),
|
||||
),
|
||||
),
|
||||
child: IconButton(
|
||||
icon: Icon(item.icon),
|
||||
tooltip: tabTitleName(context, idx),
|
||||
splashRadius: width / 3.3,
|
||||
padding: const EdgeInsets.only(left: 17, right: 17),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_pageController.animateToPage(idx,
|
||||
duration: const Duration(milliseconds: 677),
|
||||
curve: Curves.fastLinearToSlowEaseIn);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildBottom(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: Container(
|
||||
height: 56,
|
||||
padding: const EdgeInsets.only(left: 8, top: 4, bottom: 4, right: 8),
|
||||
width: _width,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||
children: tabItems.map(
|
||||
(item) {
|
||||
int itemIndex = tabItems.indexOf(item);
|
||||
return _buildBottomItem(
|
||||
itemIndex,
|
||||
item,
|
||||
_selectIndex == itemIndex,
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.code),
|
||||
label: 'Convert',
|
||||
),
|
||||
),
|
||||
NavigationDestination(
|
||||
icon: Icon(Icons.leak_add),
|
||||
label: 'Ping',
|
||||
selectedIcon: Icon(Icons.leak_add_outlined),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class _ServerPageState extends State<ServerPage>
|
||||
}
|
||||
final keys = pro.servers.keys.toList();
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.all(7),
|
||||
padding: const EdgeInsets.fromLTRB(7, 10, 7, 7),
|
||||
controller: ScrollController(),
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
itemBuilder: (ctx, idx) {
|
||||
|
||||
@@ -243,7 +243,9 @@ class _SettingPageState extends State<SettingPage> {
|
||||
Widget _buildAppColorPicker() {
|
||||
return MaterialColorPicker(
|
||||
shrinkWrap: true,
|
||||
onColorChange: (Color color) {
|
||||
allowShades: false,
|
||||
onMainColorChange: (ColorSwatch<dynamic>? color) {
|
||||
if(color == null) return;
|
||||
_selectedColorValue = color.value;
|
||||
},
|
||||
selectedColor: primaryColor,
|
||||
|
||||
@@ -1006,9 +1006,11 @@ packages:
|
||||
xterm:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
path: "../xterm.dart"
|
||||
relative: true
|
||||
source: path
|
||||
path: "."
|
||||
ref: master
|
||||
resolved-ref: "8039a582d855428cec49b23641bcfcafd6682574"
|
||||
url: "https://github.com/lollipopkit/xterm.dart"
|
||||
source: git
|
||||
version: "3.4.1"
|
||||
yaml:
|
||||
dependency: transitive
|
||||
|
||||
@@ -57,10 +57,10 @@ dependencies:
|
||||
share_plus_web: ^3.1.0
|
||||
# xterm: ^3.4.1
|
||||
xterm:
|
||||
path: ../xterm.dart
|
||||
# git:
|
||||
# ref: master
|
||||
# url: https://github.com/lollipopkit/xterm.dart
|
||||
#path: ../xterm.dart
|
||||
git:
|
||||
ref: master
|
||||
url: https://github.com/lollipopkit/xterm.dart
|
||||
file_picker: ^5.2.5
|
||||
plain_notification_token: ^0.0.4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user