mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-21 15:44:30 +01:00
Compare commits
34 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e8a8056f8 | ||
|
|
587e0a4640 | ||
|
|
9608c9139c | ||
|
|
913ce312de | ||
|
|
b6ab4b7fde | ||
|
|
7c6649f941 | ||
|
|
7c84957230 | ||
|
|
092c3f522a | ||
|
|
877b93ae3a | ||
|
|
565bc8012a | ||
|
|
96034f9487 | ||
|
|
0522cfef1c | ||
|
|
0ecc321115 | ||
|
|
9c8f9c3b9f | ||
|
|
b2e2d4c603 | ||
|
|
599bd2cfd3 | ||
|
|
6bda94bd7b | ||
|
|
cfd28c3009 | ||
|
|
7e01c4cbb3 | ||
|
|
78b46998d1 | ||
|
|
d43d251d92 | ||
|
|
1c29b76455 | ||
|
|
611518f790 | ||
|
|
62a1122174 | ||
|
|
ca17af30cf | ||
|
|
3998f549e4 | ||
|
|
9541c0c7ab | ||
|
|
475bb8c4b0 | ||
|
|
a0b68862fc | ||
|
|
bfd31e561c | ||
|
|
5b8468effa | ||
|
|
bd04fd3f1a | ||
|
|
398c49bb99 | ||
|
|
c036b78708 |
@@ -1,4 +0,0 @@
|
|||||||
{
|
|
||||||
"flutterSdkVersion": "3.3.4",
|
|
||||||
"flavors": {}
|
|
||||||
}
|
|
||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -48,4 +48,4 @@ app.*.map.json
|
|||||||
/android/app/fjy.androidstudio.key
|
/android/app/fjy.androidstudio.key
|
||||||
/release
|
/release
|
||||||
test.dart
|
test.dart
|
||||||
.fvm/flutter_sdk
|
.fvm
|
||||||
24
.metadata
24
.metadata
@@ -1,10 +1,30 @@
|
|||||||
# This file tracks properties of this Flutter project.
|
# This file tracks properties of this Flutter project.
|
||||||
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
# Used by Flutter tool to assess capabilities and perform upgrades etc.
|
||||||
#
|
#
|
||||||
# This file should be version controlled and should not be manually edited.
|
# This file should be version controlled.
|
||||||
|
|
||||||
version:
|
version:
|
||||||
revision: 4cc385b4b84ac2f816d939a49ea1f328c4e0b48e
|
revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
|
||||||
channel: stable
|
channel: stable
|
||||||
|
|
||||||
project_type: app
|
project_type: app
|
||||||
|
|
||||||
|
# Tracks metadata for the flutter migrate command
|
||||||
|
migration:
|
||||||
|
platforms:
|
||||||
|
- platform: root
|
||||||
|
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
|
||||||
|
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
|
||||||
|
- platform: macos
|
||||||
|
create_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
|
||||||
|
base_revision: b06b8b2710955028a6b562f5aa6fe62941d6febf
|
||||||
|
|
||||||
|
# User provided section
|
||||||
|
|
||||||
|
# List of Local paths (relative to this file) that should be
|
||||||
|
# ignored by the migrate tool.
|
||||||
|
#
|
||||||
|
# Files that are not part of the templates will be ignored by default.
|
||||||
|
unmanaged_files:
|
||||||
|
- 'lib/main.dart'
|
||||||
|
- 'ios/Runner.xcodeproj/project.pbxproj'
|
||||||
|
|||||||
6
.vscode/settings.json
vendored
6
.vscode/settings.json
vendored
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"dart.flutterSdkPath": ".fvm/flutter_sdk",
|
"dart.flutterSdkPath": ".fvm",
|
||||||
"search.exclude": {
|
"files.watcherExclude": {
|
||||||
"**/.fvm": true
|
"**/.fvm": true
|
||||||
},
|
},
|
||||||
"files.watcherExclude": {
|
"search.exclude": {
|
||||||
"**/.fvm": true
|
"**/.fvm": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
674
LICENCE
Normal file
674
LICENCE
Normal file
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
{one line to give the program's name and a brief idea of what it does.}
|
||||||
|
Copyright (C) {year} {name of author}
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
{project} Copyright (C) {year} {fullname}
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
41
README.md
41
README.md
@@ -5,59 +5,62 @@
|
|||||||
|
|
||||||
<!-- Badges-->
|
<!-- Badges-->
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="https://apps.apple.com/app/serverbox-status-tools/id1586449703">
|
<a href="https://apps.apple.com/app/id1586449703">
|
||||||
<img style="height: 37px" src="screenshots/appstore.svg">
|
<img style="height: 37px" src="screenshots/appstore.svg">
|
||||||
</a>
|
</a>
|
||||||
<a href="https://github.com/LollipopKit/flutter_server_box/releases/latest">
|
<a href="https://github.com/lollipopkit/flutter_server_box/releases/latest">
|
||||||
<img style="height: 37px" src="screenshots/dl-android.svg">
|
<img style="height: 37px" src="screenshots/dl-android.svg">
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
A Flutter project which provide charts to display server status and tools to manage server. Especially thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartssh2</a>.
|
A Flutter project which provide charts to display server status and tools to manage server.
|
||||||
|
<br>
|
||||||
|
Especially thanks to <a href="https://github.com/TerminalStudio/dartssh2">dartssh2</a> & <a href="https://github.com/TerminalStudio/xterm.dart">xterm.dart</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## 🔖 Milestone
|
## 🔖 Feature
|
||||||
- [x] Status chart view
|
- [x] 📊 Status chart view
|
||||||
- [x] Snippet ~~market~~, Ping, SFTP, Docker, Apt/Yum and etc.
|
- [x] ⌨️ `SSH` terminal
|
||||||
- [x] i18n (English, Chinese)
|
- [x] ⚙️ `Docker & Pkg` Manager, `SFTP`, `Snippet` ~~market~~, `Ping` and etc.
|
||||||
- [x] Desktop support
|
- [x] 📚 i18n (English, Chinese), **welcome contribution** :)
|
||||||
|
- [x] 🖥️ Desktop support
|
||||||
|
|
||||||
## 📱 ScreenShots
|
## 📱 ScreenShots
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/server.jpg">
|
<img width="200px" src="screenshots/server.jpg">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/server_detail.png">
|
<img width="200px" src="screenshots/server_detail.png">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/convert.png">
|
<img width="200px" src="screenshots/ssh.jpg">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/ping.png">
|
<img width="200px" src="screenshots/ping.png">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/apt.png">
|
<img width="200px" src="screenshots/sftp.jpg">
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<img width="200px" src="https://raw.githubusercontent.com/LollipopKit/flutter_server_monitor_toolbox/main/screenshots/docker.png">
|
<img width="200px" src="screenshots/docker.jpg">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
## 🖥 Platform
|
## 🖥 Platform
|
||||||
Status|Platform
|
Status|Platform
|
||||||
--|--|
|
--- | ---
|
||||||
Full Support|Android/iOS/macOS
|
Full Support|Android/iOS
|
||||||
Support, but not tested|Windows/Linux
|
Support, but not tested|macOS/Windows/Linux
|
||||||
|
|
||||||
|
|
||||||
## 📝 License
|
## 📝 License
|
||||||
`LGPL License. LollipopKit 2021`
|
`GPL v3. lollipopkit 2023`
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ apply plugin: 'kotlin-android'
|
|||||||
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
|
||||||
|
|
||||||
android {
|
android {
|
||||||
compileSdkVersion 31
|
compileSdkVersion 33
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
sourceCompatibility JavaVersion.VERSION_1_8
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
@@ -48,7 +48,6 @@ android {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
|
|
||||||
applicationId "tech.lolli.toolbox"
|
applicationId "tech.lolli.toolbox"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 30
|
targetSdkVersion 30
|
||||||
@@ -67,12 +66,18 @@ android {
|
|||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
release {
|
release {
|
||||||
// TODO: Add your own signing config for the release build.
|
|
||||||
// Signing with the debug keys for now, so `flutter run --release` works.
|
|
||||||
signingConfig signingConfigs.release
|
signingConfig signingConfigs.release
|
||||||
minifyEnabled true
|
minifyEnabled true
|
||||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
debug {
|
||||||
|
applicationIdSuffix '.debug'
|
||||||
|
}
|
||||||
|
|
||||||
|
profile {
|
||||||
|
applicationIdSuffix '.debug'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
BIN
assets/linux/armbian.png
Normal file
BIN
assets/linux/armbian.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
BIN
assets/linux/rocky.png
Normal file
BIN
assets/linux/rocky.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@@ -1,11 +1,12 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- countly_flutter (21.11.0):
|
- countly_flutter (22.09.0):
|
||||||
- Flutter
|
- Flutter
|
||||||
- Flutter (1.0.0)
|
- Flutter (1.0.0)
|
||||||
- flutter_native_splash (0.0.1):
|
- flutter_native_splash (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- path_provider_ios (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
|
- FlutterMacOS
|
||||||
- r_upgrade (0.0.1):
|
- r_upgrade (0.0.1):
|
||||||
- Flutter
|
- Flutter
|
||||||
- share_plus (0.0.1):
|
- share_plus (0.0.1):
|
||||||
@@ -17,7 +18,7 @@ DEPENDENCIES:
|
|||||||
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
|
- countly_flutter (from `.symlinks/plugins/countly_flutter/ios`)
|
||||||
- Flutter (from `Flutter`)
|
- Flutter (from `Flutter`)
|
||||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||||
- path_provider_ios (from `.symlinks/plugins/path_provider_ios/ios`)
|
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/ios`)
|
||||||
- r_upgrade (from `.symlinks/plugins/r_upgrade/ios`)
|
- r_upgrade (from `.symlinks/plugins/r_upgrade/ios`)
|
||||||
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
- share_plus (from `.symlinks/plugins/share_plus/ios`)
|
||||||
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
|
||||||
@@ -29,8 +30,8 @@ EXTERNAL SOURCES:
|
|||||||
:path: Flutter
|
:path: Flutter
|
||||||
flutter_native_splash:
|
flutter_native_splash:
|
||||||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||||
path_provider_ios:
|
path_provider_foundation:
|
||||||
:path: ".symlinks/plugins/path_provider_ios/ios"
|
:path: ".symlinks/plugins/path_provider_foundation/ios"
|
||||||
r_upgrade:
|
r_upgrade:
|
||||||
:path: ".symlinks/plugins/r_upgrade/ios"
|
:path: ".symlinks/plugins/r_upgrade/ios"
|
||||||
share_plus:
|
share_plus:
|
||||||
@@ -39,13 +40,13 @@ EXTERNAL SOURCES:
|
|||||||
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
:path: ".symlinks/plugins/url_launcher_ios/ios"
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
countly_flutter: e245f94349d8adf306c22e60c10648c69aae7380
|
countly_flutter: 135f1a4930f8e26ba223a14201d3f265ea7b4c83
|
||||||
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
|
||||||
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
flutter_native_splash: 52501b97d1c0a5f898d687f1646226c1f93c56ef
|
||||||
path_provider_ios: 14f3d2fd28c4fdb42f44e0f751d12861c43cee02
|
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
|
||||||
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
|
r_upgrade: 44d715c61914cce3d01ea225abffe894fd51c114
|
||||||
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68
|
||||||
url_launcher_ios: 839c58cdb4279282219f5e248c3321761ff3c4de
|
url_launcher_ios: ae1517e5e344f5544fb090b079e11f399dfbe4d2
|
||||||
|
|
||||||
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
|
PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 51;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@@ -199,6 +199,7 @@
|
|||||||
/* Begin PBXShellScriptBuildPhase section */
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -213,6 +214,7 @@
|
|||||||
};
|
};
|
||||||
9740EEB61CF901F6004384FC /* Run Script */ = {
|
9740EEB61CF901F6004384FC /* Run Script */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -354,7 +356,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 153;
|
CURRENT_PROJECT_VERSION = 174;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -362,7 +364,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.153;
|
MARKETING_VERSION = 1.0.174;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -484,7 +486,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 153;
|
CURRENT_PROJECT_VERSION = 174;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -492,7 +494,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.153;
|
MARKETING_VERSION = 1.0.174;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
@@ -508,7 +510,7 @@
|
|||||||
buildSettings = {
|
buildSettings = {
|
||||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
CLANG_ENABLE_MODULES = YES;
|
CLANG_ENABLE_MODULES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 153;
|
CURRENT_PROJECT_VERSION = 174;
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
DEVELOPMENT_TEAM = BA88US33G6;
|
||||||
ENABLE_BITCODE = NO;
|
ENABLE_BITCODE = NO;
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
@@ -516,7 +518,7 @@
|
|||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/Frameworks",
|
"@executable_path/Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.153;
|
MARKETING_VERSION = 1.0.174;
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
|
||||||
|
|||||||
@@ -48,5 +48,7 @@
|
|||||||
</array>
|
</array>
|
||||||
<key>CADisableMinimumFrameDurationOnPhone</key>
|
<key>CADisableMinimumFrameDurationOnPhone</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>UIApplicationSupportsIndirectInputEvents</key>
|
||||||
|
<true/>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
74
lib/app.dart
74
lib/app.dart
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
|
import 'package:toolbox/core/extension/colorx.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/res/build_data.dart';
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
@@ -10,21 +11,6 @@ import 'package:toolbox/view/page/home.dart';
|
|||||||
class MyApp extends StatelessWidget {
|
class MyApp extends StatelessWidget {
|
||||||
const MyApp({Key? key}) : super(key: key);
|
const MyApp({Key? key}) : super(key: key);
|
||||||
|
|
||||||
MaterialStateProperty<Color?> getMaterialStateColor(Color primaryColor) {
|
|
||||||
return MaterialStateProperty.resolveWith((states) {
|
|
||||||
const Set<MaterialState> interactiveStates = <MaterialState>{
|
|
||||||
MaterialState.pressed,
|
|
||||||
MaterialState.hovered,
|
|
||||||
MaterialState.focused,
|
|
||||||
MaterialState.selected
|
|
||||||
};
|
|
||||||
if (states.any(interactiveStates.contains)) {
|
|
||||||
return primaryColor;
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
setTransparentNavigationBar(context);
|
setTransparentNavigationBar(context);
|
||||||
@@ -33,16 +19,16 @@ class MyApp extends StatelessWidget {
|
|||||||
builder: (_, value, __) {
|
builder: (_, value, __) {
|
||||||
final primaryColor = Color(value);
|
final primaryColor = Color(value);
|
||||||
final textStyle = TextStyle(color: primaryColor);
|
final textStyle = TextStyle(color: primaryColor);
|
||||||
|
final materialColor = primaryColor.materialStateColor;
|
||||||
|
final materialColorAlpha =
|
||||||
|
primaryColor.withOpacity(0.7).materialStateColor;
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
localizationsDelegates: const [
|
localizationsDelegates: const [
|
||||||
S.delegate,
|
S.delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
...GlobalMaterialLocalizations.delegates,
|
||||||
GlobalWidgetsLocalizations.delegate,
|
|
||||||
GlobalCupertinoLocalizations.delegate,
|
|
||||||
],
|
],
|
||||||
supportedLocales: S.delegate.supportedLocales,
|
supportedLocales: S.delegate.supportedLocales,
|
||||||
title: BuildData.name,
|
title: BuildData.name,
|
||||||
debugShowCheckedModeBanner: false,
|
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
|
||||||
@@ -51,37 +37,41 @@ class MyApp extends StatelessWidget {
|
|||||||
iconTheme: IconThemeData(color: primaryColor),
|
iconTheme: IconThemeData(color: primaryColor),
|
||||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||||
switchTheme: SwitchThemeData(
|
switchTheme: SwitchThemeData(
|
||||||
thumbColor: getMaterialStateColor(primaryColor),
|
thumbColor: materialColor,
|
||||||
trackColor:
|
trackColor: materialColorAlpha,
|
||||||
getMaterialStateColor(primaryColor.withOpacity(0.7)),
|
|
||||||
),
|
),
|
||||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
labelStyle: textStyle,
|
labelStyle: textStyle,
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(color: primaryColor))),
|
borderSide: BorderSide(color: primaryColor),
|
||||||
|
),
|
||||||
|
),
|
||||||
radioTheme: RadioThemeData(
|
radioTheme: RadioThemeData(
|
||||||
fillColor: getMaterialStateColor(primaryColor),
|
fillColor: materialColor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData.dark().copyWith(
|
darkTheme: ThemeData.dark().copyWith(
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
floatingActionButtonTheme: FloatingActionButtonThemeData(
|
floatingActionButtonTheme:
|
||||||
backgroundColor: primaryColor),
|
FloatingActionButtonThemeData(backgroundColor: primaryColor),
|
||||||
iconTheme: IconThemeData(color: primaryColor),
|
iconTheme: IconThemeData(color: primaryColor),
|
||||||
primaryIconTheme: IconThemeData(color: primaryColor),
|
primaryIconTheme: IconThemeData(color: primaryColor),
|
||||||
switchTheme: SwitchThemeData(
|
switchTheme: SwitchThemeData(
|
||||||
thumbColor: getMaterialStateColor(primaryColor),
|
thumbColor: materialColor,
|
||||||
trackColor:
|
trackColor: materialColorAlpha,
|
||||||
getMaterialStateColor(primaryColor.withOpacity(0.7)),
|
),
|
||||||
|
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
||||||
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
labelStyle: textStyle,
|
||||||
|
focusedBorder: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor),
|
||||||
),
|
),
|
||||||
buttonTheme: ButtonThemeData(splashColor: primaryColor),
|
),
|
||||||
inputDecorationTheme: InputDecorationTheme(
|
radioTheme: RadioThemeData(
|
||||||
labelStyle: textStyle,
|
fillColor: materialColor,
|
||||||
focusedBorder: UnderlineInputBorder(
|
),
|
||||||
borderSide: BorderSide(color: primaryColor))),
|
),
|
||||||
radioTheme: RadioThemeData(
|
|
||||||
fillColor: getMaterialStateColor(primaryColor))),
|
|
||||||
home: MyHomePage(primaryColor: primaryColor),
|
home: MyHomePage(primaryColor: primaryColor),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import 'dart:io';
|
|||||||
import 'package:countly_flutter/countly_config.dart';
|
import 'package:countly_flutter/countly_config.dart';
|
||||||
import 'package:countly_flutter/countly_flutter.dart';
|
import 'package:countly_flutter/countly_flutter.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:toolbox/core/build_mode.dart';
|
||||||
|
|
||||||
class Analysis {
|
class Analysis {
|
||||||
static const _url = 'https://countly.xuty.cc';
|
static const _url = 'https://countly.xuty.cc';
|
||||||
@@ -11,11 +12,14 @@ class Analysis {
|
|||||||
|
|
||||||
static bool _enabled = false;
|
static bool _enabled = false;
|
||||||
|
|
||||||
static Future<void> init(bool debug) async {
|
static Future<void> init() async {
|
||||||
|
if (!BuildMode.isRelease) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (Platform.isAndroid || Platform.isIOS) {
|
if (Platform.isAndroid || Platform.isIOS) {
|
||||||
_enabled = true;
|
_enabled = true;
|
||||||
final config = CountlyConfig(_url, _key)
|
final config = CountlyConfig(_url, _key)
|
||||||
.setLoggingEnabled(debug)
|
.setLoggingEnabled(false)
|
||||||
.enableCrashReporting();
|
.enableCrashReporting();
|
||||||
await Countly.initWithConfig(config);
|
await Countly.initWithConfig(config);
|
||||||
await Countly.start();
|
await Countly.start();
|
||||||
|
|||||||
@@ -1,5 +1,12 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
const Set<MaterialState> interactiveStates = <MaterialState>{
|
||||||
|
MaterialState.pressed,
|
||||||
|
MaterialState.hovered,
|
||||||
|
MaterialState.focused,
|
||||||
|
MaterialState.selected
|
||||||
|
};
|
||||||
|
|
||||||
extension ColorX on Color {
|
extension ColorX on Color {
|
||||||
bool get isBrightColor {
|
bool get isBrightColor {
|
||||||
return getBrightnessFromColor == Brightness.light;
|
return getBrightnessFromColor == Brightness.light;
|
||||||
@@ -8,4 +15,13 @@ extension ColorX on Color {
|
|||||||
Brightness get getBrightnessFromColor {
|
Brightness get getBrightnessFromColor {
|
||||||
return ThemeData.estimateBrightnessForColor(this);
|
return ThemeData.estimateBrightnessForColor(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaterialStateProperty<Color?> get materialStateColor {
|
||||||
|
return MaterialStateProperty.resolveWith((states) {
|
||||||
|
if (states.any(interactiveStates.contains)) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
49
lib/core/extension/ssh_client.dart
Normal file
49
lib/core/extension/ssh_client.dart
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:toolbox/core/extension/uint8list.dart';
|
||||||
|
|
||||||
|
typedef OnStd = void Function(String data, StreamSink<Uint8List> sink);
|
||||||
|
typedef OnStdin = void Function(StreamSink<Uint8List> sink);
|
||||||
|
|
||||||
|
typedef PwdRequestFunc = Future<String> Function();
|
||||||
|
final pwdRequestWithUserReg = RegExp(r'\[sudo\] password for (.+):');
|
||||||
|
|
||||||
|
extension SSHClientX on SSHClient {
|
||||||
|
Future<int?> exec(String cmd,
|
||||||
|
{OnStd? onStderr, OnStd? onStdout, OnStdin? stdin}) async {
|
||||||
|
final session = await execute(cmd);
|
||||||
|
|
||||||
|
final stdoutDone = Completer<void>();
|
||||||
|
final stderrDone = Completer<void>();
|
||||||
|
|
||||||
|
if (onStdout != null) {
|
||||||
|
session.stdout.listen(
|
||||||
|
(e) => onStdout(e.string, session.stdin),
|
||||||
|
onDone: stdoutDone.complete,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
stdoutDone.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (onStderr != null) {
|
||||||
|
session.stderr.listen(
|
||||||
|
(e) => onStderr(e.string, session.stdin),
|
||||||
|
onDone: stderrDone.complete,
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
stderrDone.complete();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (stdin != null) {
|
||||||
|
stdin(session.stdin);
|
||||||
|
}
|
||||||
|
|
||||||
|
await stdoutDone.future;
|
||||||
|
await stderrDone.future;
|
||||||
|
|
||||||
|
session.close();
|
||||||
|
return session.exitCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,24 +1,11 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:toolbox/data/model/distribution.dart';
|
|
||||||
|
|
||||||
extension StringX on String {
|
extension StringX on String {
|
||||||
int get i => int.parse(this);
|
int get i => int.parse(this);
|
||||||
|
|
||||||
Distribution get dist {
|
|
||||||
final lower = toLowerCase();
|
|
||||||
for (var dist in debianDistList) {
|
|
||||||
if (lower.contains(dist)) {
|
|
||||||
return Distribution.debian;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (var dist in rehlDistList) {
|
|
||||||
if (lower.contains(dist)) {
|
|
||||||
return Distribution.rehl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return Distribution.unknown;
|
|
||||||
}
|
|
||||||
|
|
||||||
Uri get uri {
|
Uri get uri {
|
||||||
return Uri.parse(this);
|
return Uri.parse(this);
|
||||||
}
|
}
|
||||||
@@ -32,7 +19,7 @@ extension StringX on String {
|
|||||||
// Build the textspan
|
// Build the textspan
|
||||||
var span = TextSpan(
|
var span = TextSpan(
|
||||||
text: 'A' * 7 + substring(length - len),
|
text: 'A' * 7 + substring(length - len),
|
||||||
style: style ?? Theme.of(context).textTheme.bodyText2,
|
style: style ?? Theme.of(context).textTheme.bodyMedium,
|
||||||
);
|
);
|
||||||
|
|
||||||
// Use a textpainter to determine if it will exceed max lines
|
// Use a textpainter to determine if it will exceed max lines
|
||||||
@@ -60,4 +47,6 @@ extension StringX on String {
|
|||||||
}
|
}
|
||||||
|
|
||||||
String get withLangExport => 'export LANG=en_US.UTF-8 && $this';
|
String get withLangExport => 'export LANG=en_US.UTF-8 && $this';
|
||||||
|
|
||||||
|
Uint8List get uint8List => Uint8List.fromList(utf8.encode(this));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:hive/hive.dart';
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
class PersistentStore<E> {
|
class PersistentStore<E> {
|
||||||
late Box<E> box;
|
late Box<E> box;
|
||||||
|
|||||||
@@ -11,14 +11,14 @@ import 'package:toolbox/data/service/app.dart';
|
|||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
|
|
||||||
final logger = Logger('UPDATE');
|
final _logger = Logger('UPDATE');
|
||||||
|
|
||||||
Future<bool> isFileAvailable(String url) async {
|
Future<bool> isFileAvailable(String url) async {
|
||||||
try {
|
try {
|
||||||
final resp = await Dio().head(url);
|
final resp = await Dio().head(url);
|
||||||
return resp.statusCode == 200;
|
return resp.statusCode == 200;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
logger.warning('update file not available: $e');
|
_logger.warning('update file not available: $e');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -40,11 +40,11 @@ Future<void> doUpdate(BuildContext context, {bool force = false}) async {
|
|||||||
}();
|
}();
|
||||||
|
|
||||||
if (!force && newest <= BuildData.build) {
|
if (!force && newest <= BuildData.build) {
|
||||||
logger.info('Update ignored due to current: ${BuildData.build}, '
|
_logger.info('Update ignored due to current: ${BuildData.build}, '
|
||||||
'update: $newest');
|
'update: $newest');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info('Update available: $newest');
|
_logger.info('Update available: $newest');
|
||||||
|
|
||||||
if (Platform.isAndroid && !await isFileAvailable(update.android)) {
|
if (Platform.isAndroid && !await isFileAvailable(update.android)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ import 'package:toolbox/view/widget/card_dialog.dart';
|
|||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
|
|
||||||
void unawaited(Future<void> future) {}
|
|
||||||
|
|
||||||
bool isDarkMode(BuildContext context) =>
|
bool isDarkMode(BuildContext context) =>
|
||||||
Theme.of(context).brightness == Brightness.dark;
|
Theme.of(context).brightness == Brightness.dark;
|
||||||
|
|
||||||
@@ -30,15 +28,7 @@ void showSnackBarWithAction(BuildContext context, String content, String action,
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> openUrl(String url) async {
|
Future<bool> openUrl(String url) async {
|
||||||
final uri = url.uri;
|
return await launchUrl(url.uri, mode: LaunchMode.externalApplication);
|
||||||
if (!await canLaunchUrl(uri)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final ok = await launchUrl(uri);
|
|
||||||
if (ok == true) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<T?>? showRoundDialog<T>(
|
Future<T?>? showRoundDialog<T>(
|
||||||
@@ -107,6 +97,25 @@ Future<bool> shareFiles(BuildContext context, List<String> filePaths) async {
|
|||||||
} else {
|
} else {
|
||||||
text = '${filePaths.length} ${S.of(context).files}';
|
text = '${filePaths.length} ${S.of(context).files}';
|
||||||
}
|
}
|
||||||
await Share.shareFiles(filePaths, text: 'ServerBox -> $text');
|
final xfiles = filePaths.map((e) => XFile(e)).toList();
|
||||||
|
await Share.shareXFiles(xfiles, text: 'ServerBox -> $text');
|
||||||
return filePaths.isNotEmpty;
|
return filePaths.isNotEmpty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget buildPopuopMenu(
|
||||||
|
{required List<PopupMenuEntry> items,
|
||||||
|
required Function(dynamic) onSelected}) {
|
||||||
|
return PopupMenuButton(
|
||||||
|
itemBuilder: (_) => items,
|
||||||
|
onSelected: onSelected,
|
||||||
|
padding: EdgeInsets.zero,
|
||||||
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||||
|
child: const Padding(
|
||||||
|
padding: EdgeInsets.only(left: 7),
|
||||||
|
child: Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
size: 21,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ class DropdownBtnItem {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ServerTabMenuItems {
|
class ServerTabMenuItems {
|
||||||
static const List<DropdownBtnItem> firstItems = [sftp, snippet, apt, docker];
|
static const List<DropdownBtnItem> firstItems = [sftp, snippet, pkg, docker];
|
||||||
static const List<DropdownBtnItem> secondItems = [edit];
|
static const List<DropdownBtnItem> secondItems = [edit];
|
||||||
|
|
||||||
static const sftp =
|
static const sftp =
|
||||||
DropdownBtnItem(text: 'SFTP', icon: Icons.insert_drive_file);
|
DropdownBtnItem(text: 'SFTP', icon: Icons.insert_drive_file);
|
||||||
static const snippet = DropdownBtnItem(text: 'Snippet', icon: Icons.label);
|
static const snippet = DropdownBtnItem(text: 'Snippet', icon: Icons.code);
|
||||||
static const apt =
|
static const pkg =
|
||||||
DropdownBtnItem(text: 'Apt/Yum', icon: Icons.system_security_update);
|
DropdownBtnItem(text: 'Pkg', icon: Icons.system_security_update);
|
||||||
static const docker =
|
static const docker =
|
||||||
DropdownBtnItem(text: 'Docker', icon: Icons.view_agenda);
|
DropdownBtnItem(text: 'Docker', icon: Icons.view_agenda);
|
||||||
static const edit = DropdownBtnItem(text: 'Edit', icon: Icons.edit);
|
static const edit = DropdownBtnItem(text: 'Edit', icon: Icons.edit);
|
||||||
|
|||||||
@@ -1,41 +0,0 @@
|
|||||||
import 'package:toolbox/data/model/distribution.dart';
|
|
||||||
|
|
||||||
class UpgradePkgInfo {
|
|
||||||
final String _raw;
|
|
||||||
final Distribution _dist;
|
|
||||||
|
|
||||||
late String package;
|
|
||||||
late String nowVersion;
|
|
||||||
late String newVersion;
|
|
||||||
late String arch;
|
|
||||||
|
|
||||||
UpgradePkgInfo(this._raw, this._dist) {
|
|
||||||
switch (_dist) {
|
|
||||||
case Distribution.debian:
|
|
||||||
case Distribution.unknown:
|
|
||||||
_parseApt();
|
|
||||||
break;
|
|
||||||
case Distribution.rehl:
|
|
||||||
_parseYum();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void _parseApt() {
|
|
||||||
final split1 = _raw.split("/");
|
|
||||||
package = split1[0];
|
|
||||||
final split2 = split1[1].split(" ");
|
|
||||||
newVersion = split2[1];
|
|
||||||
arch = split2[2];
|
|
||||||
nowVersion = split2[5].replaceFirst(']', '');
|
|
||||||
}
|
|
||||||
|
|
||||||
void _parseYum() {
|
|
||||||
final result = RegExp(r'\S+').allMatches(_raw);
|
|
||||||
final pkgAndArch = result.elementAt(0).group(0) ?? '.';
|
|
||||||
final split1 = pkgAndArch.split('.');
|
|
||||||
package = split1[0];
|
|
||||||
arch = split1[1];
|
|
||||||
newVersion = result.elementAt(1).group(0) ?? 'Unknown';
|
|
||||||
nowVersion = '';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
enum Distribution {
|
|
||||||
unknown,
|
|
||||||
debian,
|
|
||||||
rehl,
|
|
||||||
}
|
|
||||||
|
|
||||||
const debianDistList = [
|
|
||||||
'debian',
|
|
||||||
'ubuntu',
|
|
||||||
'linuxmint',
|
|
||||||
'elementary',
|
|
||||||
'raspbian'
|
|
||||||
];
|
|
||||||
const rehlDistList = [
|
|
||||||
'redhat',
|
|
||||||
'fedora',
|
|
||||||
'centos',
|
|
||||||
'scientificlinux',
|
|
||||||
'rhel',
|
|
||||||
'oraclelinux'
|
|
||||||
];
|
|
||||||
47
lib/data/model/docker/image.dart
Normal file
47
lib/data/model/docker/image.dart
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
final _dockerImageReg = RegExp(r'(\S+) +(\S+) +(\S+) +(.+) +(\S+)');
|
||||||
|
|
||||||
|
class DockerImage {
|
||||||
|
final String repo;
|
||||||
|
final String tag;
|
||||||
|
final String id;
|
||||||
|
final String created;
|
||||||
|
final String size;
|
||||||
|
|
||||||
|
static final Map<String, DockerImage> _cache = <String, DockerImage>{};
|
||||||
|
|
||||||
|
DockerImage({
|
||||||
|
required this.repo,
|
||||||
|
required this.tag,
|
||||||
|
required this.id,
|
||||||
|
required this.created,
|
||||||
|
required this.size,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'repo': repo,
|
||||||
|
'tag': tag,
|
||||||
|
'id': id,
|
||||||
|
'created': created,
|
||||||
|
'size': size,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
factory DockerImage.fromRawStr(String raw) {
|
||||||
|
return _cache.putIfAbsent(raw, () => _parse(raw));
|
||||||
|
}
|
||||||
|
|
||||||
|
static DockerImage _parse(String raw) {
|
||||||
|
final match = _dockerImageReg.firstMatch(raw);
|
||||||
|
if (match == null) {
|
||||||
|
throw Exception('Invalid docker image: $raw');
|
||||||
|
}
|
||||||
|
return DockerImage(
|
||||||
|
repo: match.group(1)!,
|
||||||
|
tag: match.group(2)!,
|
||||||
|
id: match.group(3)!,
|
||||||
|
created: match.group(4)!,
|
||||||
|
size: match.group(5)!,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
lib/data/model/pkg/manager.dart
Normal file
1
lib/data/model/pkg/manager.dart
Normal file
@@ -0,0 +1 @@
|
|||||||
|
enum PkgManager { apt, yum, zypper, pacman, opkg }
|
||||||
75
lib/data/model/pkg/upgrade_info.dart
Normal file
75
lib/data/model/pkg/upgrade_info.dart
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import 'package:toolbox/data/model/pkg/manager.dart';
|
||||||
|
|
||||||
|
class UpgradePkgInfo {
|
||||||
|
final PkgManager? _mgr;
|
||||||
|
|
||||||
|
late String package;
|
||||||
|
late String nowVersion;
|
||||||
|
late String newVersion;
|
||||||
|
late String arch;
|
||||||
|
|
||||||
|
UpgradePkgInfo(String raw, this._mgr) {
|
||||||
|
switch (_mgr) {
|
||||||
|
case PkgManager.apt:
|
||||||
|
_parseApt(raw);
|
||||||
|
break;
|
||||||
|
case PkgManager.yum:
|
||||||
|
_parseYum(raw);
|
||||||
|
break;
|
||||||
|
case PkgManager.zypper:
|
||||||
|
_parseZypper(raw);
|
||||||
|
break;
|
||||||
|
case PkgManager.pacman:
|
||||||
|
_parsePacman(raw);
|
||||||
|
break;
|
||||||
|
case PkgManager.opkg:
|
||||||
|
_parseOpkg(raw);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw Exception('Unsupported pkg type: $_mgr');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parseApt(String raw) {
|
||||||
|
final split1 = raw.split("/");
|
||||||
|
package = split1[0];
|
||||||
|
final split2 = split1[1].split(" ");
|
||||||
|
newVersion = split2[1];
|
||||||
|
arch = split2[2];
|
||||||
|
nowVersion = split2[5].replaceFirst(']', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parseYum(String raw) {
|
||||||
|
final result = RegExp(r'\S+').allMatches(raw);
|
||||||
|
final pkgAndArch = result.elementAt(0).group(0) ?? '.';
|
||||||
|
final split1 = pkgAndArch.split('.');
|
||||||
|
package = split1[0];
|
||||||
|
arch = split1[1];
|
||||||
|
newVersion = result.elementAt(1).group(0) ?? 'Unknown';
|
||||||
|
nowVersion = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parseZypper(String raw) {
|
||||||
|
final cols = raw.split("|");
|
||||||
|
package = cols[2].trim();
|
||||||
|
nowVersion = cols[3].trim();
|
||||||
|
newVersion = cols[4].trim();
|
||||||
|
arch = cols[5].trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parsePacman(String raw) {
|
||||||
|
final parts = raw.split(' ');
|
||||||
|
package = parts[0];
|
||||||
|
nowVersion = parts[1];
|
||||||
|
newVersion = parts[3];
|
||||||
|
arch = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parseOpkg(String raw) {
|
||||||
|
final parts = raw.split(' - ');
|
||||||
|
package = parts[0];
|
||||||
|
nowVersion = parts[1];
|
||||||
|
newVersion = parts[2];
|
||||||
|
arch = '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,53 +1,53 @@
|
|||||||
import 'package:toolbox/data/model/server/cpu_status.dart';
|
import 'package:toolbox/data/model/server/cpu_status.dart';
|
||||||
|
|
||||||
class Cpu2Status {
|
class Cpu2Status {
|
||||||
List<CpuStatus> pre;
|
List<CpuStatus> _pre;
|
||||||
List<CpuStatus> now;
|
List<CpuStatus> _now;
|
||||||
String temp;
|
String temp;
|
||||||
Cpu2Status(this.pre, this.now, this.temp);
|
Cpu2Status(this._pre, this._now, this.temp);
|
||||||
|
|
||||||
double usedPercent({int coreIdx = 0}) {
|
double usedPercent({int coreIdx = 0}) {
|
||||||
if (now.length != pre.length) return 0;
|
if (_now.length != _pre.length) return 0;
|
||||||
final idleDelta = now[coreIdx].idle - pre[coreIdx].idle;
|
final idleDelta = _now[coreIdx].idle - _pre[coreIdx].idle;
|
||||||
final totalDelta = now[coreIdx].total - pre[coreIdx].total;
|
final totalDelta = _now[coreIdx].total - _pre[coreIdx].total;
|
||||||
final used = idleDelta / totalDelta;
|
final used = idleDelta / totalDelta;
|
||||||
return used.isNaN ? 0 : 100 - used * 100;
|
return used.isNaN ? 0 : 100 - used * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(List<CpuStatus> newStatus, String newTemp) {
|
void update(List<CpuStatus> newStatus, String newTemp) {
|
||||||
pre = now;
|
_pre = _now;
|
||||||
now = newStatus;
|
_now = newStatus;
|
||||||
temp = newTemp;
|
temp = newTemp;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get coresCount => now.length;
|
int get coresCount => _now.length;
|
||||||
|
|
||||||
int get totalDelta => now[0].total - pre[0].total;
|
int get totalDelta => _now[0].total - _pre[0].total;
|
||||||
|
|
||||||
double get user {
|
double get user {
|
||||||
if (now.length != pre.length) return 0;
|
if (_now.length != _pre.length) return 0;
|
||||||
final delta = now[0].user - pre[0].user;
|
final delta = _now[0].user - _pre[0].user;
|
||||||
final used = delta / totalDelta;
|
final used = delta / totalDelta;
|
||||||
return used.isNaN ? 0 : used * 100;
|
return used.isNaN ? 0 : used * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
double get sys {
|
double get sys {
|
||||||
if (now.length != pre.length) return 0;
|
if (_now.length != _pre.length) return 0;
|
||||||
final delta = now[0].sys - pre[0].sys;
|
final delta = _now[0].sys - _pre[0].sys;
|
||||||
final used = delta / totalDelta;
|
final used = delta / totalDelta;
|
||||||
return used.isNaN ? 0 : used * 100;
|
return used.isNaN ? 0 : used * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
double get nice {
|
double get nice {
|
||||||
if (now.length != pre.length) return 0;
|
if (_now.length != _pre.length) return 0;
|
||||||
final delta = now[0].nice - pre[0].nice;
|
final delta = _now[0].nice - _pre[0].nice;
|
||||||
final used = delta / totalDelta;
|
final used = delta / totalDelta;
|
||||||
return used.isNaN ? 0 : used * 100;
|
return used.isNaN ? 0 : used * 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
double get iowait {
|
double get iowait {
|
||||||
if (now.length != pre.length) return 0;
|
if (_now.length != _pre.length) return 0;
|
||||||
final delta = now[0].iowait - pre[0].iowait;
|
final delta = _now[0].iowait - _pre[0].iowait;
|
||||||
final used = delta / totalDelta;
|
final used = delta / totalDelta;
|
||||||
return used.isNaN ? 0 : used * 100;
|
return used.isNaN ? 0 : used * 100;
|
||||||
}
|
}
|
||||||
|
|||||||
28
lib/data/model/server/dist.dart
Normal file
28
lib/data/model/server/dist.dart
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
enum Dist {
|
||||||
|
debian,
|
||||||
|
ubuntu,
|
||||||
|
centos,
|
||||||
|
fedora,
|
||||||
|
opensuse,
|
||||||
|
kali,
|
||||||
|
wrt,
|
||||||
|
armbian,
|
||||||
|
arch,
|
||||||
|
rocky;
|
||||||
|
|
||||||
|
String? get iconPath {
|
||||||
|
return 'assets/linux/$name.png';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
extension StringX on String {
|
||||||
|
Dist? get dist {
|
||||||
|
final lower = toLowerCase();
|
||||||
|
for (final dist in Dist.values) {
|
||||||
|
if (lower.contains(dist.name)) {
|
||||||
|
return dist;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
class LinuxIcons {
|
|
||||||
List<String> db;
|
|
||||||
|
|
||||||
LinuxIcons(this.db);
|
|
||||||
|
|
||||||
String? search(String sysVer) {
|
|
||||||
for (var item in db) {
|
|
||||||
if (sysVer.toLowerCase().contains(item)) {
|
|
||||||
return 'assets/linux/$item.png';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,46 +9,46 @@ class NetSpeedPart {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class NetSpeed {
|
class NetSpeed {
|
||||||
List<NetSpeedPart> old;
|
List<NetSpeedPart> _old;
|
||||||
List<NetSpeedPart> now;
|
List<NetSpeedPart> _now;
|
||||||
NetSpeed(this.old, this.now);
|
NetSpeed(this._old, this._now);
|
||||||
|
|
||||||
List<String> get devices {
|
List<String> get devices {
|
||||||
final devices = <String>[];
|
final devices = <String>[];
|
||||||
for (var item in now) {
|
for (var item in _now) {
|
||||||
devices.add(item.device);
|
devices.add(item.device);
|
||||||
}
|
}
|
||||||
return devices;
|
return devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(List<NetSpeedPart> newOne) {
|
void update(List<NetSpeedPart> newOne) {
|
||||||
old = now;
|
_old = _now;
|
||||||
now = newOne;
|
_now = newOne;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get timeDiff => now[0].time - old[0].time;
|
int get timeDiff => _now[0].time - _old[0].time;
|
||||||
|
|
||||||
String speedIn({String? device}) {
|
String speedIn({String? device}) {
|
||||||
if (old[0].device == '' || now[0].device == '') return '0kb/s';
|
if (_old[0].device == '' || _now[0].device == '') return '0kb/s';
|
||||||
final idx = deviceIdx(device);
|
final idx = deviceIdx(device);
|
||||||
final speedInBytesPerSecond =
|
final speedInBytesPerSecond =
|
||||||
(now[idx].bytesIn - old[idx].bytesIn) / timeDiff;
|
(_now[idx].bytesIn - _old[idx].bytesIn) / timeDiff;
|
||||||
return buildStandardOutput(speedInBytesPerSecond);
|
return buildStandardOutput(speedInBytesPerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
String speedOut({String? device}) {
|
String speedOut({String? device}) {
|
||||||
if (old[0].device == '' || now[0].device == '') return '0kb/s';
|
if (_old[0].device == '' || _now[0].device == '') return '0kb/s';
|
||||||
final idx = deviceIdx(device);
|
final idx = deviceIdx(device);
|
||||||
final speedOutBytesPerSecond =
|
final speedOutBytesPerSecond =
|
||||||
(now[idx].bytesOut - old[idx].bytesOut) / timeDiff;
|
(_now[idx].bytesOut - _old[idx].bytesOut) / timeDiff;
|
||||||
return buildStandardOutput(speedOutBytesPerSecond);
|
return buildStandardOutput(speedOutBytesPerSecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
int deviceIdx(String? device) {
|
int deviceIdx(String? device) {
|
||||||
if (device != null) {
|
if (device != null) {
|
||||||
for (var item in now) {
|
for (var item in _now) {
|
||||||
if (item.device == device) {
|
if (item.device == device) {
|
||||||
return now.indexOf(item);
|
return _now.indexOf(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
|
part 'private_key_info.g.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
||||||
///
|
///
|
||||||
|
@HiveType(typeId: 1)
|
||||||
class PrivateKeyInfo {
|
class PrivateKeyInfo {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
@@ -12,8 +17,11 @@ class PrivateKeyInfo {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
late String id;
|
late String id;
|
||||||
|
@HiveField(1)
|
||||||
late String privateKey;
|
late String privateKey;
|
||||||
|
@HiveField(2)
|
||||||
late String password;
|
late String password;
|
||||||
|
|
||||||
PrivateKeyInfo(
|
PrivateKeyInfo(
|
||||||
|
|||||||
47
lib/data/model/server/private_key_info.g.dart
Normal file
47
lib/data/model/server/private_key_info.g.dart
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'private_key_info.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class PrivateKeyInfoAdapter extends TypeAdapter<PrivateKeyInfo> {
|
||||||
|
@override
|
||||||
|
final int typeId = 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
PrivateKeyInfo read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return PrivateKeyInfo(
|
||||||
|
fields[0] as String,
|
||||||
|
fields[1] as String,
|
||||||
|
fields[2] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, PrivateKeyInfo obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(3)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.id)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.privateKey)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.password);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is PrivateKeyInfoAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@@ -1,8 +1,13 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
|
part 'server_private_info.g.dart';
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
/// Code generated by jsonToDartModel https://ashamp.github.io/jsonToDartModel/
|
||||||
///
|
///
|
||||||
|
@HiveType(typeId: 3)
|
||||||
class ServerPrivateInfo {
|
class ServerPrivateInfo {
|
||||||
/*
|
/*
|
||||||
{
|
{
|
||||||
@@ -13,13 +18,21 @@ class ServerPrivateInfo {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@HiveField(0)
|
||||||
late String name;
|
late String name;
|
||||||
|
@HiveField(1)
|
||||||
late String ip;
|
late String ip;
|
||||||
|
@HiveField(2)
|
||||||
late int port;
|
late int port;
|
||||||
|
@HiveField(3)
|
||||||
late String user;
|
late String user;
|
||||||
|
@HiveField(4)
|
||||||
late String pwd;
|
late String pwd;
|
||||||
|
@HiveField(5)
|
||||||
String? pubKeyId;
|
String? pubKeyId;
|
||||||
|
|
||||||
|
String get id => '$user@$ip:$port';
|
||||||
|
|
||||||
ServerPrivateInfo(
|
ServerPrivateInfo(
|
||||||
{required this.name,
|
{required this.name,
|
||||||
required this.ip,
|
required this.ip,
|
||||||
|
|||||||
56
lib/data/model/server/server_private_info.g.dart
Normal file
56
lib/data/model/server/server_private_info.g.dart
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'server_private_info.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class ServerPrivateInfoAdapter extends TypeAdapter<ServerPrivateInfo> {
|
||||||
|
@override
|
||||||
|
final int typeId = 3;
|
||||||
|
|
||||||
|
@override
|
||||||
|
ServerPrivateInfo read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return ServerPrivateInfo(
|
||||||
|
name: fields[0] as String,
|
||||||
|
ip: fields[1] as String,
|
||||||
|
port: fields[2] as int,
|
||||||
|
user: fields[3] as String,
|
||||||
|
pwd: fields[4] as String,
|
||||||
|
pubKeyId: fields[5] as String?,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, ServerPrivateInfo obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(6)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.ip)
|
||||||
|
..writeByte(2)
|
||||||
|
..write(obj.port)
|
||||||
|
..writeByte(3)
|
||||||
|
..write(obj.user)
|
||||||
|
..writeByte(4)
|
||||||
|
..write(obj.pwd)
|
||||||
|
..writeByte(5)
|
||||||
|
..write(obj.pubKeyId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is ServerPrivateInfoAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@@ -1,7 +1,14 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:hive_flutter/hive_flutter.dart';
|
||||||
|
|
||||||
|
part 'snippet.g.dart';
|
||||||
|
|
||||||
|
@HiveType(typeId: 2)
|
||||||
class Snippet {
|
class Snippet {
|
||||||
|
@HiveField(0)
|
||||||
late String name;
|
late String name;
|
||||||
|
@HiveField(1)
|
||||||
late String script;
|
late String script;
|
||||||
Snippet(this.name, this.script);
|
Snippet(this.name, this.script);
|
||||||
|
|
||||||
|
|||||||
44
lib/data/model/server/snippet.g.dart
Normal file
44
lib/data/model/server/snippet.g.dart
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'snippet.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// TypeAdapterGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
class SnippetAdapter extends TypeAdapter<Snippet> {
|
||||||
|
@override
|
||||||
|
final int typeId = 2;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Snippet read(BinaryReader reader) {
|
||||||
|
final numOfFields = reader.readByte();
|
||||||
|
final fields = <int, dynamic>{
|
||||||
|
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
|
||||||
|
};
|
||||||
|
return Snippet(
|
||||||
|
fields[0] as String,
|
||||||
|
fields[1] as String,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void write(BinaryWriter writer, Snippet obj) {
|
||||||
|
writer
|
||||||
|
..writeByte(2)
|
||||||
|
..writeByte(0)
|
||||||
|
..write(obj.name)
|
||||||
|
..writeByte(1)
|
||||||
|
..write(obj.script);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => typeId.hashCode;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) =>
|
||||||
|
identical(this, other) ||
|
||||||
|
other is SnippetAdapter &&
|
||||||
|
runtimeType == other.runtimeType &&
|
||||||
|
typeId == other.typeId;
|
||||||
|
}
|
||||||
@@ -1,29 +1,35 @@
|
|||||||
class AbsolutePath {
|
class AbsolutePath {
|
||||||
String path;
|
String _path;
|
||||||
String? _prePath;
|
String get path => _path;
|
||||||
AbsolutePath(this.path);
|
final List<String> _prePath;
|
||||||
|
|
||||||
|
AbsolutePath(this._path) : _prePath = ['/'];
|
||||||
|
|
||||||
void update(String newPath) {
|
void update(String newPath) {
|
||||||
_prePath = path;
|
_prePath.add(_path);
|
||||||
if (newPath == '..') {
|
if (newPath == '..') {
|
||||||
path = path.substring(0, path.lastIndexOf('/'));
|
_path = _path.substring(0, _path.lastIndexOf('/'));
|
||||||
if (path == '') {
|
if (_path == '') {
|
||||||
path = '/';
|
_path = '/';
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (newPath == '/') {
|
if (newPath == '/') {
|
||||||
path = '/';
|
_path = '/';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
path = path + (path.endsWith('/') ? '' : '/') + newPath;
|
if (newPath.startsWith('/')) {
|
||||||
|
_path = newPath;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_path = _path + (_path.endsWith('/') ? '' : '/') + newPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool undo() {
|
bool undo() {
|
||||||
if (_prePath == null || _prePath == path) {
|
if (_prePath.isEmpty) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
path = _prePath!;
|
_path = _prePath.removeLast();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
|
||||||
import 'package:toolbox/data/model/sftp/absolute_path.dart';
|
import 'package:toolbox/data/model/sftp/absolute_path.dart';
|
||||||
|
|
||||||
class SftpBrowserStatus {
|
class SftpBrowserStatus {
|
||||||
bool selected = false;
|
|
||||||
ServerPrivateInfo? spi;
|
|
||||||
List<SftpName>? files;
|
List<SftpName>? files;
|
||||||
AbsolutePath? path;
|
AbsolutePath? path;
|
||||||
SftpClient? client;
|
SftpClient? client;
|
||||||
|
|||||||
@@ -1,176 +0,0 @@
|
|||||||
import 'dart:async';
|
|
||||||
import 'dart:convert';
|
|
||||||
import 'dart:typed_data';
|
|
||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
|
||||||
import 'package:logging/logging.dart';
|
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
|
||||||
import 'package:toolbox/core/extension/uint8list.dart';
|
|
||||||
import 'package:toolbox/core/provider_base.dart';
|
|
||||||
import 'package:toolbox/data/model/apt/upgrade_pkg_info.dart';
|
|
||||||
import 'package:toolbox/data/model/distribution.dart';
|
|
||||||
|
|
||||||
typedef PwdRequestFunc = Future<String> Function(
|
|
||||||
int triedTimes, String? userName);
|
|
||||||
final pwdRequestWithUserReg = RegExp(r'\[sudo\] password for (.+):');
|
|
||||||
|
|
||||||
class AptProvider extends BusyProvider {
|
|
||||||
final logger = Logger('AptProvider');
|
|
||||||
|
|
||||||
SSHClient? client;
|
|
||||||
Distribution? dist;
|
|
||||||
Function()? onUpgrade;
|
|
||||||
Function()? onUpdate;
|
|
||||||
PwdRequestFunc? onPasswordRequest;
|
|
||||||
|
|
||||||
String? whoami;
|
|
||||||
List<UpgradePkgInfo>? upgradeable;
|
|
||||||
String? error;
|
|
||||||
String? upgradeLog;
|
|
||||||
String? updateLog;
|
|
||||||
String lastLog = '';
|
|
||||||
int triedTimes = 0;
|
|
||||||
bool isRequestingPwd = false;
|
|
||||||
|
|
||||||
AptProvider();
|
|
||||||
|
|
||||||
Future<void> init(SSHClient client, Distribution dist, Function() onUpgrade,
|
|
||||||
Function() onUpdate, PwdRequestFunc onPasswordRequest) async {
|
|
||||||
this.client = client;
|
|
||||||
this.dist = dist;
|
|
||||||
this.onUpgrade = onUpgrade;
|
|
||||||
this.onPasswordRequest = onPasswordRequest;
|
|
||||||
whoami = (await client.run('whoami').string).trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool get isSU => whoami == 'root';
|
|
||||||
|
|
||||||
void clear() {
|
|
||||||
client = null;
|
|
||||||
dist = null;
|
|
||||||
upgradeable = null;
|
|
||||||
error = null;
|
|
||||||
upgradeLog = null;
|
|
||||||
updateLog = whoami = null;
|
|
||||||
onUpgrade = null;
|
|
||||||
onUpdate = null;
|
|
||||||
onPasswordRequest = null;
|
|
||||||
triedTimes = 0;
|
|
||||||
isRequestingPwd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> refreshInstalled() async {
|
|
||||||
if (client == null) {
|
|
||||||
error = 'No client';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final result = await _update();
|
|
||||||
getUpgradeableList(result);
|
|
||||||
try {} catch (e) {
|
|
||||||
error = '[Server Raw]:\n$result\n[App Error]:\n$e';
|
|
||||||
} finally {
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void getUpgradeableList(String? raw) {
|
|
||||||
if (raw == null) return;
|
|
||||||
var list = raw.split('\n');
|
|
||||||
switch (dist) {
|
|
||||||
case Distribution.rehl:
|
|
||||||
list = list.sublist(2);
|
|
||||||
list.removeWhere((element) => element.isEmpty);
|
|
||||||
final endLine = list.lastIndexWhere(
|
|
||||||
(element) => element.contains('Obsoleting Packages'));
|
|
||||||
list = list.sublist(0, endLine);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
// avoid other outputs
|
|
||||||
// such as: [Could not chdir to home directory /home/test: No such file or directory, , WARNING: apt does not have a stable CLI interface. Use with caution in scripts., , Listing...]
|
|
||||||
final idx =
|
|
||||||
list.indexWhere((element) => element.contains('[upgradable from:'));
|
|
||||||
if (idx == -1) {
|
|
||||||
upgradeable = [];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
list = list.sublist(idx);
|
|
||||||
list.removeWhere((element) => element.isEmpty);
|
|
||||||
}
|
|
||||||
upgradeable = list.map((e) => UpgradePkgInfo(e, dist!)).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<String> _update() async {
|
|
||||||
switch (dist) {
|
|
||||||
case Distribution.rehl:
|
|
||||||
return await client?.run(_wrap('yum check-update')).string ?? '';
|
|
||||||
default:
|
|
||||||
final session = await client!.execute(_wrap('apt update'));
|
|
||||||
session.stderr.listen((event) => _onPwd(event, session.stdin));
|
|
||||||
session.stdout.listen((event) {
|
|
||||||
updateLog = (updateLog ?? '') + event.string;
|
|
||||||
notifyListeners();
|
|
||||||
onUpdate ?? () {}();
|
|
||||||
});
|
|
||||||
await session.done;
|
|
||||||
return await client
|
|
||||||
?.run('apt list --upgradeable'.withLangExport)
|
|
||||||
.string ??
|
|
||||||
'';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> upgrade() async {
|
|
||||||
if (client == null) {
|
|
||||||
error = 'No client';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final upgradeCmd = () {
|
|
||||||
switch (dist) {
|
|
||||||
case Distribution.rehl:
|
|
||||||
return 'yum upgrade -y';
|
|
||||||
default:
|
|
||||||
return 'apt upgrade -y';
|
|
||||||
}
|
|
||||||
}();
|
|
||||||
|
|
||||||
final session = await client!.execute(_wrap(upgradeCmd));
|
|
||||||
session.stderr.listen((e) => _onPwd(e, session.stdin));
|
|
||||||
|
|
||||||
session.stdout.listen((data) async {
|
|
||||||
final log = data.string;
|
|
||||||
if (lastLog == log.trim()) return;
|
|
||||||
upgradeLog = (upgradeLog ?? '') + log;
|
|
||||||
lastLog = log.trim();
|
|
||||||
notifyListeners();
|
|
||||||
onUpgrade!();
|
|
||||||
});
|
|
||||||
|
|
||||||
upgradeLog = null;
|
|
||||||
await session.done;
|
|
||||||
refreshInstalled();
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> _onPwd(Uint8List e, StreamSink<Uint8List> stdin) async {
|
|
||||||
if (isRequestingPwd) return;
|
|
||||||
isRequestingPwd = true;
|
|
||||||
final event = e.string;
|
|
||||||
if (event.contains('[sudo] password for ')) {
|
|
||||||
final user = pwdRequestWithUserReg.firstMatch(event)?.group(1);
|
|
||||||
logger.info('sudo password request for $user');
|
|
||||||
triedTimes++;
|
|
||||||
final pwd =
|
|
||||||
await (onPasswordRequest ?? (_, __) async => '')(triedTimes, user);
|
|
||||||
if (pwd.isEmpty) {
|
|
||||||
logger.info('sudo password request cancelled');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
stdin.add(Uint8List.fromList(utf8.encode('$pwd\n')));
|
|
||||||
}
|
|
||||||
isRequestingPwd = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String _wrap(String cmd) =>
|
|
||||||
'export LANG=en_US.utf-8 && ${isSU ? "" : "sudo -S "}$cmd';
|
|
||||||
}
|
|
||||||
@@ -1,10 +1,38 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
/// format: [NAME][LEVEL]: MESSAGE
|
||||||
|
final _headReg = RegExp(r'(\[[A-Za-z]+\])(\[[A-Z]+\]): (.*)');
|
||||||
|
const _level2Color = {
|
||||||
|
'[INFO]': Colors.blue,
|
||||||
|
'[WARNING]': Colors.yellow,
|
||||||
|
};
|
||||||
|
|
||||||
class DebugProvider extends ChangeNotifier {
|
class DebugProvider extends ChangeNotifier {
|
||||||
final widgets = <Widget>[];
|
final widgets = <Widget>[];
|
||||||
|
|
||||||
void addText(String text) {
|
void addText(String text) {
|
||||||
_addText(text);
|
final match = _headReg.allMatches(text);
|
||||||
|
|
||||||
|
if (match.isNotEmpty) {
|
||||||
|
addWidget(Text.rich(TextSpan(
|
||||||
|
children: [
|
||||||
|
TextSpan(
|
||||||
|
text: match.first.group(1),
|
||||||
|
style: const TextStyle(color: Colors.cyan),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: match.first.group(2),
|
||||||
|
style: TextStyle(color: _level2Color[match.first.group(2)]),
|
||||||
|
),
|
||||||
|
TextSpan(
|
||||||
|
text: '\n${match.first.group(3)}',
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)));
|
||||||
|
} else {
|
||||||
|
_addText(text);
|
||||||
|
}
|
||||||
|
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,17 +73,8 @@ class DebugProvider extends ChangeNotifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _addWidget(Widget widget) {
|
void _addWidget(Widget widget) {
|
||||||
final outlined = Container(
|
widgets.add(widget);
|
||||||
margin: const EdgeInsets.symmetric(vertical: 2),
|
widgets.add(const SizedBox(height: 13));
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.all(
|
|
||||||
color: Colors.green,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: widget,
|
|
||||||
);
|
|
||||||
|
|
||||||
widgets.add(outlined);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
|
|||||||
@@ -1,96 +1,168 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
import 'package:toolbox/core/extension/uint8list.dart';
|
import 'package:toolbox/core/extension/uint8list.dart';
|
||||||
import 'package:toolbox/core/provider_base.dart';
|
import 'package:toolbox/core/provider_base.dart';
|
||||||
|
import 'package:toolbox/data/model/docker/image.dart';
|
||||||
import 'package:toolbox/data/model/docker/ps.dart';
|
import 'package:toolbox/data/model/docker/ps.dart';
|
||||||
|
import 'package:toolbox/data/res/error.dart';
|
||||||
|
import 'package:toolbox/data/store/docker.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
|
|
||||||
final _dockerNotFound = RegExp(r'command not found|Unknown command');
|
final _dockerNotFound = RegExp(r'command not found|Unknown command');
|
||||||
final _versionReg = RegExp(r'(Version:)\s+([0-9]+\.[0-9]+\.[0-9]+)');
|
final _versionReg = RegExp(r'(Version:)\s+([0-9]+\.[0-9]+\.[0-9]+)');
|
||||||
final _editionReg = RegExp(r'(Client:)\s+(.+-.+)');
|
final _editionReg = RegExp(r'(Client:)\s+(.+-.+)');
|
||||||
final _userIdReg = RegExp(r'.+:(\d+:\d+):.+');
|
final _dockerPrefixReg = RegExp(r'(sudo )?docker ');
|
||||||
|
|
||||||
|
const _dockerPS = 'docker ps -a';
|
||||||
|
const _dockerImgs = 'docker images';
|
||||||
|
|
||||||
|
final _logger = Logger('DOCKER');
|
||||||
|
|
||||||
class DockerProvider extends BusyProvider {
|
class DockerProvider extends BusyProvider {
|
||||||
|
final dockerStore = locator<DockerStore>();
|
||||||
|
|
||||||
SSHClient? client;
|
SSHClient? client;
|
||||||
String? userName;
|
String? userName;
|
||||||
List<DockerPsItem>? items;
|
List<DockerPsItem>? items;
|
||||||
|
List<DockerImage>? images;
|
||||||
String? version;
|
String? version;
|
||||||
String? edition;
|
String? edition;
|
||||||
String? error;
|
DockerErr? error;
|
||||||
|
PwdRequestFunc? onPwdReq;
|
||||||
|
String? hostId;
|
||||||
|
String? runLog;
|
||||||
|
bool isRequestingPwd = false;
|
||||||
|
|
||||||
void init(SSHClient client, String userName) {
|
void init(SSHClient client, String userName, PwdRequestFunc onPwdReq,
|
||||||
|
String hostId) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.userName = userName;
|
this.userName = userName;
|
||||||
|
this.onPwdReq = onPwdReq;
|
||||||
|
this.hostId = hostId;
|
||||||
}
|
}
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
client = null;
|
client = userName = error = items = version = edition = onPwdReq = null;
|
||||||
userName = null;
|
isRequestingPwd = false;
|
||||||
error = null;
|
hostId = runLog = images = null;
|
||||||
items = null;
|
|
||||||
version = null;
|
|
||||||
edition = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> refresh() async {
|
Future<void> refresh() async {
|
||||||
if (client == null) {
|
|
||||||
error = 'no client';
|
|
||||||
notifyListeners();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final verRaw = await client!.run('docker version'.withLangExport).string;
|
final verRaw = await client!.run('docker version'.withLangExport).string;
|
||||||
if (verRaw.contains(_dockerNotFound)) {
|
if (verRaw.contains(_dockerNotFound)) {
|
||||||
error = 'docker not found';
|
error = DockerErr(type: DockerErrType.notInstalled);
|
||||||
notifyListeners();
|
setBusyState(false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
version = _versionReg.firstMatch(verRaw)?.group(2);
|
try {
|
||||||
edition = _editionReg.firstMatch(verRaw)?.group(2);
|
version = _versionReg.firstMatch(verRaw)?.group(2);
|
||||||
|
edition = _editionReg.firstMatch(verRaw)?.group(2);
|
||||||
final passwd = await client!.run('cat /etc/passwd | grep $userName').string;
|
} catch (e) {
|
||||||
final userId = _userIdReg.firstMatch(passwd)?.group(1)?.split(':').first;
|
rethrow;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final cmd = 'docker ps -a'.withLangExport;
|
setBusyState();
|
||||||
final raw = await () async {
|
final cmd = _wrap(_dockerPS);
|
||||||
final raw = await client!.run(cmd).string;
|
|
||||||
if (raw.contains('permission denied')) {
|
// run docker ps
|
||||||
return await client!
|
var raw = '';
|
||||||
.run(
|
await client!.exec(
|
||||||
'export DOCKER_HOST=unix:///run/user/${userId ?? 1000}/docker.sock && $cmd')
|
cmd,
|
||||||
.string;
|
onStderr: _onPwd,
|
||||||
}
|
onStdout: (data, _) => raw = '$raw$data',
|
||||||
return raw;
|
);
|
||||||
}();
|
|
||||||
|
// parse result
|
||||||
final lines = raw.split('\n');
|
final lines = raw.split('\n');
|
||||||
lines.removeAt(0);
|
lines.removeAt(0);
|
||||||
lines.removeWhere((element) => element.isEmpty);
|
lines.removeWhere((element) => element.isEmpty);
|
||||||
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
items = lines.map((e) => DockerPsItem.fromRawString(e)).toList();
|
||||||
|
|
||||||
|
final imageCmd = _wrap(_dockerImgs);
|
||||||
|
raw = '';
|
||||||
|
await client!.exec(
|
||||||
|
imageCmd,
|
||||||
|
onStderr: _onPwd,
|
||||||
|
onStdout: (data, _) => raw = '$raw$data',
|
||||||
|
);
|
||||||
|
|
||||||
|
final imageLines = raw.split('\n');
|
||||||
|
imageLines.removeAt(0);
|
||||||
|
imageLines.removeWhere((element) => element.isEmpty);
|
||||||
|
images = imageLines.map((e) => DockerImage.fromRawStr(e)).toList();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
error = e.toString();
|
error = DockerErr(type: DockerErrType.unknown, message: e.toString());
|
||||||
rethrow;
|
rethrow;
|
||||||
} finally {
|
} finally {
|
||||||
notifyListeners();
|
setBusyState(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _do(String id, String cmd) async {
|
Future<void> _onPwd(String event, StreamSink<Uint8List> stdin) async {
|
||||||
setBusyState();
|
if (isRequestingPwd) return;
|
||||||
if (client == null) {
|
isRequestingPwd = true;
|
||||||
error = 'no client';
|
if (event.contains('[sudo] password for ')) {
|
||||||
setBusyState(false);
|
_logger.info('sudo password request for $userName');
|
||||||
return false;
|
final pwd = await onPwdReq!();
|
||||||
|
if (pwd.isEmpty) {
|
||||||
|
_logger.info('sudo password request cancelled');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stdin.add('$pwd\n'.uint8List);
|
||||||
|
}
|
||||||
|
isRequestingPwd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<DockerErr?> stop(String id) async => await run('docker stop $id');
|
||||||
|
|
||||||
|
Future<DockerErr?> start(String id) async => await run('docker start $id');
|
||||||
|
|
||||||
|
Future<DockerErr?> delete(String id) async => await run('docker rm $id');
|
||||||
|
|
||||||
|
Future<DockerErr?> run(String cmd) async {
|
||||||
|
if (!cmd.startsWith(_dockerPrefixReg)) {
|
||||||
|
return DockerErr(type: DockerErrType.cmdNoPrefix);
|
||||||
|
}
|
||||||
|
setBusyState();
|
||||||
|
|
||||||
|
runLog = '';
|
||||||
|
final errs = <String>[];
|
||||||
|
final code = await client!.exec(
|
||||||
|
_wrap(cmd),
|
||||||
|
onStderr: (data, sink) {
|
||||||
|
_onPwd(data, sink);
|
||||||
|
errs.add(data);
|
||||||
|
},
|
||||||
|
onStdout: (data, _) {
|
||||||
|
runLog = '$runLog$data';
|
||||||
|
notifyListeners();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
runLog = null;
|
||||||
|
|
||||||
|
if (code != 0) {
|
||||||
|
setBusyState(false);
|
||||||
|
return DockerErr(
|
||||||
|
type: DockerErrType.unknown, message: errs.join('\n').trim());
|
||||||
}
|
}
|
||||||
final result = await client!.run(cmd).string;
|
|
||||||
await refresh();
|
await refresh();
|
||||||
setBusyState(false);
|
setBusyState(false);
|
||||||
return result.contains(id);
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> stop(String id) async => await _do(id, 'docker stop $id');
|
// judge whether to use DOCKER_HOST / sudo
|
||||||
|
String _wrap(String cmd) {
|
||||||
Future<bool> start(String id) async => await _do(id, 'docker start $id');
|
final dockerHost = dockerStore.getDockerHost(hostId!);
|
||||||
|
if (dockerHost == null || dockerHost.isEmpty) {
|
||||||
Future<bool> delete(String id) async => await _do(id, 'docker rm $id');
|
return 'sudo $cmd'.withLangExport;
|
||||||
|
}
|
||||||
|
return 'export DOCKER_HOST=$dockerHost && $cmd'.withLangExport;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
216
lib/data/provider/pkg.dart
Normal file
216
lib/data/provider/pkg.dart
Normal file
@@ -0,0 +1,216 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
import 'dart:typed_data';
|
||||||
|
|
||||||
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:toolbox/core/extension/ssh_client.dart';
|
||||||
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
|
import 'package:toolbox/core/extension/uint8list.dart';
|
||||||
|
import 'package:toolbox/core/provider_base.dart';
|
||||||
|
import 'package:toolbox/data/model/pkg/manager.dart';
|
||||||
|
import 'package:toolbox/data/model/pkg/upgrade_info.dart';
|
||||||
|
import 'package:toolbox/data/model/server/dist.dart';
|
||||||
|
|
||||||
|
class PkgProvider extends BusyProvider {
|
||||||
|
final logger = Logger('PKG');
|
||||||
|
|
||||||
|
SSHClient? client;
|
||||||
|
Dist? dist;
|
||||||
|
PkgManager? type;
|
||||||
|
Function()? onUpgrade;
|
||||||
|
Function()? onUpdate;
|
||||||
|
PwdRequestFunc? onPasswordRequest;
|
||||||
|
|
||||||
|
String? whoami;
|
||||||
|
List<UpgradePkgInfo>? upgradeable;
|
||||||
|
String? error;
|
||||||
|
String? upgradeLog;
|
||||||
|
String? updateLog;
|
||||||
|
String lastLog = '';
|
||||||
|
bool isRequestingPwd = false;
|
||||||
|
|
||||||
|
PkgProvider();
|
||||||
|
|
||||||
|
Future<void> init(
|
||||||
|
SSHClient client,
|
||||||
|
Dist? dist,
|
||||||
|
Function() onUpgrade,
|
||||||
|
Function() onUpdate,
|
||||||
|
PwdRequestFunc onPasswordRequest,
|
||||||
|
String user) async {
|
||||||
|
this.client = client;
|
||||||
|
this.dist = dist;
|
||||||
|
this.onUpgrade = onUpgrade;
|
||||||
|
this.onPasswordRequest = onPasswordRequest;
|
||||||
|
whoami = user;
|
||||||
|
|
||||||
|
switch (dist) {
|
||||||
|
case Dist.centos:
|
||||||
|
case Dist.rocky:
|
||||||
|
case Dist.fedora:
|
||||||
|
type = PkgManager.yum;
|
||||||
|
break;
|
||||||
|
case Dist.debian:
|
||||||
|
case Dist.ubuntu:
|
||||||
|
case Dist.kali:
|
||||||
|
case Dist.armbian:
|
||||||
|
type = PkgManager.apt;
|
||||||
|
break;
|
||||||
|
case Dist.opensuse:
|
||||||
|
type = PkgManager.zypper;
|
||||||
|
break;
|
||||||
|
case Dist.wrt:
|
||||||
|
type = PkgManager.opkg;
|
||||||
|
break;
|
||||||
|
case Dist.arch:
|
||||||
|
type = PkgManager.pacman;
|
||||||
|
break;
|
||||||
|
case null:
|
||||||
|
error = 'Unsupported dist: $dist';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool get isSU => whoami == 'root';
|
||||||
|
|
||||||
|
void clear() {
|
||||||
|
client = dist = updateLog = upgradeLog = upgradeable =
|
||||||
|
error = whoami = onUpdate = onUpgrade = onPasswordRequest = null;
|
||||||
|
isRequestingPwd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> refresh() async {
|
||||||
|
final result = await _update();
|
||||||
|
try {
|
||||||
|
_parse(result);
|
||||||
|
} catch (e) {
|
||||||
|
error = '[Server Raw]:\n$result\n[App Error]:\n$e';
|
||||||
|
} finally {
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void _parse(String? raw) {
|
||||||
|
if (raw == null) return;
|
||||||
|
var list = raw.split('\n');
|
||||||
|
switch (type) {
|
||||||
|
case PkgManager.yum:
|
||||||
|
list = list.sublist(2);
|
||||||
|
list.removeWhere((element) => element.isEmpty);
|
||||||
|
final endLine = list.lastIndexWhere(
|
||||||
|
(element) => element.contains('Obsoleting Packages'));
|
||||||
|
list = list.sublist(0, endLine);
|
||||||
|
break;
|
||||||
|
case PkgManager.apt:
|
||||||
|
// avoid other outputs
|
||||||
|
// such as: [Could not chdir to home directory /home/test: No such file or directory, , WARNING: apt does not have a stable CLI interface. Use with caution in scripts., , Listing...]
|
||||||
|
final idx =
|
||||||
|
list.indexWhere((element) => element.contains('[upgradable from:'));
|
||||||
|
if (idx == -1) {
|
||||||
|
upgradeable = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
list = list.sublist(idx);
|
||||||
|
list.removeWhere((element) => element.isEmpty);
|
||||||
|
break;
|
||||||
|
case PkgManager.zypper:
|
||||||
|
list = list.sublist(4);
|
||||||
|
break;
|
||||||
|
case PkgManager.pacman:
|
||||||
|
case PkgManager.opkg:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
upgradeable = list.map((e) => UpgradePkgInfo(e, type)).toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String?> _update() async {
|
||||||
|
switch (type) {
|
||||||
|
case PkgManager.yum:
|
||||||
|
return await client?.run(_wrap('yum check-update')).string;
|
||||||
|
case PkgManager.apt:
|
||||||
|
await client!.exec(
|
||||||
|
_wrap('apt update'),
|
||||||
|
onStderr: _onPwd,
|
||||||
|
onStdout: (data, sink) {
|
||||||
|
updateLog = (updateLog ?? '') + data;
|
||||||
|
notifyListeners();
|
||||||
|
if (onUpdate != null) onUpdate!();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
return await client
|
||||||
|
?.run('apt list --upgradeable'.withLangExport)
|
||||||
|
.string;
|
||||||
|
case PkgManager.zypper:
|
||||||
|
return await client?.run(_wrap('zypper lu')).string;
|
||||||
|
case PkgManager.pacman:
|
||||||
|
await client?.run('pacman -Sy');
|
||||||
|
return await client?.run(_wrap('pacman -Qu')).string;
|
||||||
|
case PkgManager.opkg:
|
||||||
|
await client?.run('opkg update');
|
||||||
|
return await client?.run(_wrap('opkg list-upgradable')).string;
|
||||||
|
default:
|
||||||
|
error = 'Unsupported dist: $dist';
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> upgrade() async {
|
||||||
|
final upgradeCmd = () {
|
||||||
|
switch (type) {
|
||||||
|
case PkgManager.yum:
|
||||||
|
return 'yum upgrade -y';
|
||||||
|
case PkgManager.apt:
|
||||||
|
return 'apt upgrade -y';
|
||||||
|
case PkgManager.zypper:
|
||||||
|
return 'zypper up -y';
|
||||||
|
case PkgManager.pacman:
|
||||||
|
return 'pacman -Syu --noconfirm';
|
||||||
|
case PkgManager.opkg:
|
||||||
|
return 'opkg upgrade ${upgradeable?.map((e) => e.package).join(" ")}';
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}();
|
||||||
|
|
||||||
|
if (upgradeCmd == null) {
|
||||||
|
error = 'Unsupported dist: $dist';
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await client!.exec(
|
||||||
|
_wrap(upgradeCmd),
|
||||||
|
onStderr: _onPwd,
|
||||||
|
onStdout: (log, sink) {
|
||||||
|
if (lastLog == log.trim()) return;
|
||||||
|
upgradeLog = (upgradeLog ?? '') + log;
|
||||||
|
lastLog = log.trim();
|
||||||
|
notifyListeners();
|
||||||
|
if (onUpgrade != null) onUpgrade!();
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
|
upgradeLog = null;
|
||||||
|
refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _onPwd(String event, StreamSink<Uint8List> stdin) async {
|
||||||
|
if (isRequestingPwd) return;
|
||||||
|
isRequestingPwd = true;
|
||||||
|
if (event.contains('[sudo] password for ')) {
|
||||||
|
final user = pwdRequestWithUserReg.firstMatch(event)?.group(1);
|
||||||
|
logger.info('sudo password request for $user');
|
||||||
|
final pwd = await onPasswordRequest!();
|
||||||
|
if (pwd.isEmpty) {
|
||||||
|
logger.info('sudo password request cancelled');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
stdin.add('$pwd\n'.uint8List);
|
||||||
|
}
|
||||||
|
isRequestingPwd = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
String _wrap(String cmd) =>
|
||||||
|
'export LANG=en_US.utf-8 && ${isSU ? "" : "sudo -S "}$cmd';
|
||||||
|
}
|
||||||
@@ -26,7 +26,7 @@ class PrivateKeyProvider extends BusyProvider {
|
|||||||
void updateInfo(PrivateKeyInfo old, PrivateKeyInfo newInfo) {
|
void updateInfo(PrivateKeyInfo old, PrivateKeyInfo newInfo) {
|
||||||
final idx = _infos.indexWhere((e) => e.id == old.id);
|
final idx = _infos.indexWhere((e) => e.id == old.id);
|
||||||
_infos[idx] = newInfo;
|
_infos[idx] = newInfo;
|
||||||
locator<PrivateKeyStore>().update(old, newInfo);
|
locator<PrivateKeyStore>().put(newInfo);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ class ServerProvider extends BusyProvider {
|
|||||||
|
|
||||||
Timer? _timer;
|
Timer? _timer;
|
||||||
|
|
||||||
final logger = Logger('ServerProvider');
|
final logger = Logger('SERVER');
|
||||||
|
|
||||||
Memory get emptyMemory =>
|
Memory get emptyMemory =>
|
||||||
Memory(total: 1, used: 0, free: 1, cache: 0, avail: 1);
|
Memory(total: 1, used: 0, free: 1, cache: 0, avail: 1);
|
||||||
@@ -132,6 +132,21 @@ class ServerProvider extends BusyProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void closeServer({ServerPrivateInfo? spi}) {
|
||||||
|
if (spi == null) {
|
||||||
|
for (var i = 0; i < _servers.length; i++) {
|
||||||
|
_servers[i].client?.close();
|
||||||
|
_servers[i].client = null;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final idx = _servers.indexWhere((e) => e.info == spi);
|
||||||
|
if (idx < 0) {
|
||||||
|
throw RangeError.index(idx, _servers);
|
||||||
|
}
|
||||||
|
_servers[idx].client?.close();
|
||||||
|
}
|
||||||
|
|
||||||
void addServer(ServerPrivateInfo spi) {
|
void addServer(ServerPrivateInfo spi) {
|
||||||
_servers.add(genInfo(spi));
|
_servers.add(genInfo(spi));
|
||||||
locator<ServerStore>().put(spi);
|
locator<ServerStore>().put(spi);
|
||||||
@@ -286,12 +301,13 @@ class ServerProvider extends BusyProvider {
|
|||||||
info.status.memory = mem;
|
info.status.memory = mem;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String?> runSnippet(ServerPrivateInfo spi, Snippet snippet) async {
|
Future<String?> runSnippet(String id, Snippet snippet) async {
|
||||||
return await _servers
|
final client =
|
||||||
.firstWhere((element) => element.info == spi)
|
_servers.firstWhere((element) => element.info.id == id).client;
|
||||||
.client!
|
if (client == null) {
|
||||||
.run(snippet.script)
|
return null;
|
||||||
.string;
|
}
|
||||||
|
return await client.run(snippet.script).string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ class SnippetProvider extends BusyProvider {
|
|||||||
void update(Snippet old, Snippet newOne) {
|
void update(Snippet old, Snippet newOne) {
|
||||||
if (!have(old)) return;
|
if (!have(old)) return;
|
||||||
_snippets[index(old)] = newOne;
|
_snippets[index(old)] = newOne;
|
||||||
locator<SnippetStore>().update(old, newOne);
|
locator<SnippetStore>().put(newOne);
|
||||||
notifyListeners();
|
notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
class BuildData {
|
class BuildData {
|
||||||
static const String name = "ServerBox";
|
static const String name = "ServerBox";
|
||||||
static const int build = 154;
|
static const int build = 187;
|
||||||
static const String engine =
|
static const String engine =
|
||||||
"Flutter 3.3.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision eb6d86ee27 (2 weeks ago) • 2022-10-04 22:31:45 -0700\nEngine • revision c08d7d5efc\nTools • Dart 2.18.2 • DevTools 2.15.0\n";
|
"Flutter 3.7.0 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision b06b8b2710 (4 days ago) • 2023-01-23 16:55:55 -0800\nEngine • revision b24591ed32\nTools • Dart 2.19.0 • DevTools 2.20.1\n";
|
||||||
static const String buildAt = "2022-10-21 17:29:42.809139";
|
static const String buildAt = "2023-01-28 13:54:17.985459";
|
||||||
static const int modifications = 9;
|
static const int modifications = 13;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,4 +18,4 @@ class DynamicColor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final mainColor = DynamicColor(Colors.black87, Colors.white70);
|
final mainColor = DynamicColor(Colors.black87, Colors.white70);
|
||||||
final progressColor = DynamicColor(Colors.grey.shade100, Colors.grey);
|
final progressColor = DynamicColor(Colors.grey.shade100, Colors.white10);
|
||||||
|
|||||||
28
lib/data/res/error.dart
Normal file
28
lib/data/res/error.dart
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
enum ErrFrom {
|
||||||
|
unknown,
|
||||||
|
apt,
|
||||||
|
docker,
|
||||||
|
sftp,
|
||||||
|
ssh,
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract class Err<T> {
|
||||||
|
final ErrFrom from;
|
||||||
|
final T type;
|
||||||
|
final String? message;
|
||||||
|
|
||||||
|
Err({required this.from, required this.type, this.message});
|
||||||
|
}
|
||||||
|
|
||||||
|
enum DockerErrType {
|
||||||
|
unknown,
|
||||||
|
noClient,
|
||||||
|
notInstalled,
|
||||||
|
invalidVersion,
|
||||||
|
cmdNoPrefix
|
||||||
|
}
|
||||||
|
|
||||||
|
class DockerErr extends Err<DockerErrType> {
|
||||||
|
DockerErr({required DockerErrType type, String? message})
|
||||||
|
: super(from: ErrFrom.docker, type: type, message: message);
|
||||||
|
}
|
||||||
@@ -1,4 +1,9 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
const TextStyle size18 = TextStyle(fontSize: 18);
|
const textSize18 = TextStyle(fontSize: 18);
|
||||||
const TextStyle grey = TextStyle(color: Colors.grey);
|
const textSize11 = TextStyle(fontSize: 11);
|
||||||
|
const textSize13 = TextStyle(fontSize: 13);
|
||||||
|
const textSize13Grey = TextStyle(color: Colors.grey, fontSize: 13);
|
||||||
|
const textSize27 = TextStyle(fontSize: 27);
|
||||||
|
|
||||||
|
const grey = TextStyle(color: Colors.grey);
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
import 'package:toolbox/data/model/server/linux_icon.dart';
|
|
||||||
|
|
||||||
final linuxIcons = LinuxIcons([
|
|
||||||
'ubuntu',
|
|
||||||
'arch',
|
|
||||||
'centos',
|
|
||||||
'debian',
|
|
||||||
'fedora',
|
|
||||||
'opensuse',
|
|
||||||
'kali',
|
|
||||||
'wrt'
|
|
||||||
]);
|
|
||||||
54
lib/data/res/terminal_theme.dart
Normal file
54
lib/data/res/terminal_theme.dart
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:xterm/ui.dart';
|
||||||
|
|
||||||
|
const termDarkTheme = TerminalTheme(
|
||||||
|
cursor: Color(0XAAAEAFAD),
|
||||||
|
selection: Color(0XAAAEAFAD),
|
||||||
|
foreground: Color(0XFFCCCCCC),
|
||||||
|
background: Colors.black,
|
||||||
|
black: Color(0XFF000000),
|
||||||
|
red: Color(0XFFCD3131),
|
||||||
|
green: Color(0XFF0DBC79),
|
||||||
|
yellow: Color(0XFFE5E510),
|
||||||
|
blue: Color(0XFF2472C8),
|
||||||
|
magenta: Color(0XFFBC3FBC),
|
||||||
|
cyan: Color(0XFF11A8CD),
|
||||||
|
white: Color(0XFFE5E5E5),
|
||||||
|
brightBlack: Color(0XFF666666),
|
||||||
|
brightRed: Color(0XFFF14C4C),
|
||||||
|
brightGreen: Color(0XFF23D18B),
|
||||||
|
brightYellow: Color(0XFFF5F543),
|
||||||
|
brightBlue: Color(0XFF3B8EEA),
|
||||||
|
brightMagenta: Color(0XFFD670D6),
|
||||||
|
brightCyan: Color(0XFF29B8DB),
|
||||||
|
brightWhite: Color(0XFFFFFFFF),
|
||||||
|
searchHitBackground: Color(0XFFFFFF2B),
|
||||||
|
searchHitBackgroundCurrent: Color(0XFF31FF26),
|
||||||
|
searchHitForeground: Color(0XFF000000),
|
||||||
|
);
|
||||||
|
|
||||||
|
const termLightTheme = TerminalTheme(
|
||||||
|
cursor: Color(0XFFAEAFAD),
|
||||||
|
selection: Color(0XFFAEAFAD),
|
||||||
|
foreground: Color(0XFF000000),
|
||||||
|
background: Color(0XFFFFFFFF),
|
||||||
|
black: Color(0XFF000000),
|
||||||
|
red: Color(0XFFCD3131),
|
||||||
|
green: Color(0XFF0DBC79),
|
||||||
|
yellow: Color(0XFFE5E510),
|
||||||
|
blue: Color(0XFF2472C8),
|
||||||
|
magenta: Color(0XFFBC3FBC),
|
||||||
|
cyan: Color(0XFF11A8CD),
|
||||||
|
white: Color(0XFFE5E5E5),
|
||||||
|
brightBlack: Color(0XFF666666),
|
||||||
|
brightRed: Color(0XFFF14C4C),
|
||||||
|
brightGreen: Color(0XFF23D18B),
|
||||||
|
brightYellow: Color(0XFFF5F543),
|
||||||
|
brightBlue: Color(0XFF3B8EEA),
|
||||||
|
brightMagenta: Color(0XFFD670D6),
|
||||||
|
brightCyan: Color(0XFF29B8DB),
|
||||||
|
brightWhite: Color(0XFFFFFFFF),
|
||||||
|
searchHitBackground: Color(0XFFFFFF2B),
|
||||||
|
searchHitBackgroundCurrent: Color(0XFF31FF26),
|
||||||
|
searchHitForeground: Color(0XFF000000),
|
||||||
|
);
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
const backendUrl = 'https://res.lolli.tech';
|
const backendUrl = 'https://res.lolli.tech';
|
||||||
const baseUrl = '$backendUrl/toolbox';
|
const baseUrl = '$backendUrl/toolbox';
|
||||||
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
const joinQQGroupUrl = 'https://jq.qq.com/?_wv=1027&k=G0hUmPAq';
|
||||||
const myGithub = 'https://github.com/LollipopKit';
|
const myGithub = 'https://github.com/lollipopkit';
|
||||||
const rainSunMeGithub = 'https://github.com/RainSunMe';
|
const rainSunMeGithub = 'https://github.com/RainSunMe';
|
||||||
const fectureGithub = 'https://github.com/fecture';
|
const fectureGithub = 'https://github.com/fecture';
|
||||||
const issueUrl = 'https://github.com/LollipopKit/flutter_server_box/issues';
|
const issueUrl = '$myGithub/flutter_server_box/issues';
|
||||||
|
|||||||
11
lib/data/store/docker.dart
Normal file
11
lib/data/store/docker.dart
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
|
|
||||||
|
class DockerStore extends PersistentStore {
|
||||||
|
String? getDockerHost(String id) {
|
||||||
|
return box.get(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setDockerHost(String id, String host) {
|
||||||
|
box.put(id, host);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,38 +1,28 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:toolbox/core/persistant_store.dart';
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
import 'package:toolbox/data/model/server/private_key_info.dart';
|
import 'package:toolbox/data/model/server/private_key_info.dart';
|
||||||
|
|
||||||
class PrivateKeyStore extends PersistentStore {
|
class PrivateKeyStore extends PersistentStore {
|
||||||
void put(PrivateKeyInfo info) {
|
void put(PrivateKeyInfo info) {
|
||||||
final ss = fetch();
|
box.put(info.id, info);
|
||||||
if (!have(info)) ss.add(info);
|
|
||||||
box.put('key', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<PrivateKeyInfo> fetch() {
|
List<PrivateKeyInfo> fetch() {
|
||||||
return getPrivateKeyInfoList(
|
final keys = box.keys;
|
||||||
json.decode(box.get('key', defaultValue: '[]')!));
|
final ps = <PrivateKeyInfo>[];
|
||||||
|
for (final key in keys) {
|
||||||
|
final s = box.get(key);
|
||||||
|
if (s != null) {
|
||||||
|
ps.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ps;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrivateKeyInfo get(String id) {
|
PrivateKeyInfo get(String id) {
|
||||||
final ss = fetch();
|
return box.get(id);
|
||||||
return ss.firstWhere((e) => e.id == id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete(PrivateKeyInfo s) {
|
void delete(PrivateKeyInfo s) {
|
||||||
final ss = fetch();
|
box.delete(s.id);
|
||||||
ss.removeAt(index(s));
|
|
||||||
box.put('key', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(PrivateKeyInfo old, PrivateKeyInfo newInfo) {
|
|
||||||
final ss = fetch();
|
|
||||||
ss[index(old)] = newInfo;
|
|
||||||
box.put('key', json.encode(ss));
|
|
||||||
}
|
|
||||||
|
|
||||||
int index(PrivateKeyInfo s) => fetch().indexWhere((e) => e.id == s.id);
|
|
||||||
|
|
||||||
bool have(PrivateKeyInfo s) => index(s) != -1;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,33 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:toolbox/core/persistant_store.dart';
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
|
|
||||||
class ServerStore extends PersistentStore {
|
class ServerStore extends PersistentStore {
|
||||||
void put(ServerPrivateInfo info) {
|
void put(ServerPrivateInfo info) {
|
||||||
final ss = fetch();
|
box.put(info.id, info);
|
||||||
if (!have(info)) ss.add(info);
|
|
||||||
box.put('servers', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ServerPrivateInfo> fetch() {
|
List<ServerPrivateInfo> fetch() {
|
||||||
return getServerInfoList(
|
final ids = box.keys;
|
||||||
json.decode(box.get('servers', defaultValue: '[]')!));
|
final List<ServerPrivateInfo> ss = [];
|
||||||
|
for (final id in ids) {
|
||||||
|
final s = box.get(id);
|
||||||
|
if (s != null) {
|
||||||
|
ss.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete(ServerPrivateInfo s) {
|
void delete(ServerPrivateInfo s) {
|
||||||
final ss = fetch();
|
box.delete(s.id);
|
||||||
ss.removeAt(index(s));
|
|
||||||
box.put('servers', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
void update(ServerPrivateInfo old, ServerPrivateInfo newInfo) {
|
||||||
final ss = fetch();
|
if (!have(old)) {
|
||||||
final idx = index(old);
|
throw Exception('Old ServerPrivateInfo not found');
|
||||||
if (idx < 0) {
|
|
||||||
throw RangeError.index(idx, ss);
|
|
||||||
}
|
}
|
||||||
ss[idx] = newInfo;
|
put(newInfo);
|
||||||
box.put('servers', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int index(ServerPrivateInfo s) => fetch()
|
bool have(ServerPrivateInfo s) => box.get(s.id) != null;
|
||||||
.indexWhere((e) => e.ip == s.ip && e.port == s.port && e.user == e.user);
|
|
||||||
|
|
||||||
bool have(ServerPrivateInfo s) => index(s) != -1;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,18 @@ import 'package:toolbox/core/persistant_store.dart';
|
|||||||
class SettingStore extends PersistentStore {
|
class SettingStore extends PersistentStore {
|
||||||
StoreProperty<int> get primaryColor =>
|
StoreProperty<int> get primaryColor =>
|
||||||
property('primaryColor', defaultValue: Colors.deepPurpleAccent.value);
|
property('primaryColor', defaultValue: Colors.deepPurpleAccent.value);
|
||||||
|
|
||||||
StoreProperty<int> get serverStatusUpdateInterval =>
|
StoreProperty<int> get serverStatusUpdateInterval =>
|
||||||
property('serverStatusUpdateInterval', defaultValue: 2);
|
property('serverStatusUpdateInterval', defaultValue: 5);
|
||||||
|
|
||||||
|
/// Lanch page idx
|
||||||
StoreProperty<int> get launchPage => property('launchPage', defaultValue: 0);
|
StoreProperty<int> get launchPage => property('launchPage', defaultValue: 0);
|
||||||
|
|
||||||
|
/// Version of store db
|
||||||
|
StoreProperty<int> get storeVersion =>
|
||||||
|
property('storeVersion', defaultValue: 0);
|
||||||
|
|
||||||
|
/// Show logo on server detail page
|
||||||
|
StoreProperty<bool> get showDistLogo =>
|
||||||
|
property('showDistLogo', defaultValue: true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,32 +1,24 @@
|
|||||||
import 'dart:convert';
|
|
||||||
|
|
||||||
import 'package:toolbox/core/persistant_store.dart';
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
import 'package:toolbox/data/model/server/snippet.dart';
|
import 'package:toolbox/data/model/server/snippet.dart';
|
||||||
|
|
||||||
class SnippetStore extends PersistentStore {
|
class SnippetStore extends PersistentStore {
|
||||||
void put(Snippet snippet) {
|
void put(Snippet snippet) {
|
||||||
final ss = fetch();
|
box.put(snippet.name, snippet);
|
||||||
if (!have(snippet)) ss.add(snippet);
|
|
||||||
box.put('snippet', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Snippet> fetch() {
|
List<Snippet> fetch() {
|
||||||
return getSnippetList(json.decode(box.get('snippet', defaultValue: '[]')!));
|
final keys = box.keys;
|
||||||
|
final ss = <Snippet>[];
|
||||||
|
for (final key in keys) {
|
||||||
|
final s = box.get(key);
|
||||||
|
if (s != null) {
|
||||||
|
ss.add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ss;
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete(Snippet s) {
|
void delete(Snippet s) {
|
||||||
final ss = fetch();
|
box.delete(s.name);
|
||||||
ss.removeAt(index(s));
|
|
||||||
box.put('snippet', json.encode(ss));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(Snippet old, Snippet newInfo) {
|
|
||||||
final ss = fetch();
|
|
||||||
ss[index(old)] = newInfo;
|
|
||||||
box.put('snippet', json.encode(ss));
|
|
||||||
}
|
|
||||||
|
|
||||||
int index(Snippet s) => fetch().indexWhere((e) => e.name == s.name);
|
|
||||||
|
|
||||||
bool have(Snippet s) => index(s) != -1;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:intl/message_lookup_by_library.dart';
|
import 'package:intl/message_lookup_by_library.dart';
|
||||||
import 'package:intl/src/intl_helpers.dart';
|
import 'package:intl/src/intl_helpers.dart';
|
||||||
@@ -20,8 +21,8 @@ import 'messages_zh.dart' as messages_zh;
|
|||||||
|
|
||||||
typedef Future<dynamic> LibraryLoader();
|
typedef Future<dynamic> LibraryLoader();
|
||||||
Map<String, LibraryLoader> _deferredLibraries = {
|
Map<String, LibraryLoader> _deferredLibraries = {
|
||||||
'en': () => new Future.value(null),
|
'en': () => new SynchronousFuture(null),
|
||||||
'zh': () => new Future.value(null),
|
'zh': () => new SynchronousFuture(null),
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageLookupByLibrary? _findExact(String localeName) {
|
MessageLookupByLibrary? _findExact(String localeName) {
|
||||||
@@ -36,18 +37,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// User programs should call this before using [localeName] for messages.
|
/// User programs should call this before using [localeName] for messages.
|
||||||
Future<bool> initializeMessages(String localeName) async {
|
Future<bool> initializeMessages(String localeName) {
|
||||||
var availableLocale = Intl.verifiedLocale(
|
var availableLocale = Intl.verifiedLocale(
|
||||||
localeName, (locale) => _deferredLibraries[locale] != null,
|
localeName, (locale) => _deferredLibraries[locale] != null,
|
||||||
onFailure: (_) => null);
|
onFailure: (_) => null);
|
||||||
if (availableLocale == null) {
|
if (availableLocale == null) {
|
||||||
return new Future.value(false);
|
return new SynchronousFuture(false);
|
||||||
}
|
}
|
||||||
var lib = _deferredLibraries[availableLocale];
|
var lib = _deferredLibraries[availableLocale];
|
||||||
await (lib == null ? new Future.value(false) : lib());
|
lib == null ? new SynchronousFuture(false) : lib();
|
||||||
initializeInternalMessageLookup(() => new CompositeMessageLookup());
|
initializeInternalMessageLookup(() => new CompositeMessageLookup());
|
||||||
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
|
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
|
||||||
return new Future.value(true);
|
return new SynchronousFuture(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool _messagesExistFor(String locale) {
|
bool _messagesExistFor(String locale) {
|
||||||
|
|||||||
@@ -22,43 +22,49 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
|
|
||||||
static String m0(fileName) => "Download [${fileName}] to local?";
|
static String m0(fileName) => "Download [${fileName}] to local?";
|
||||||
|
|
||||||
static String m1(runningCount, stoppedCount) =>
|
static String m1(count) => "${count} images";
|
||||||
|
|
||||||
|
static String m2(runningCount, stoppedCount) =>
|
||||||
"${runningCount} running, ${stoppedCount} container stopped.";
|
"${runningCount} running, ${stoppedCount} container stopped.";
|
||||||
|
|
||||||
static String m2(count) => "${count} container running.";
|
static String m3(count) => "${count} container running.";
|
||||||
|
|
||||||
static String m3(percent, size) => "${percent}% of ${size}";
|
static String m4(percent, size) => "${percent}% of ${size}";
|
||||||
|
|
||||||
static String m4(count) => "Found ${count} update";
|
static String m5(count) => "Found ${count} update";
|
||||||
|
|
||||||
static String m5(code) => "request failed, status code: ${code}";
|
static String m6(code) => "request failed, status code: ${code}";
|
||||||
|
|
||||||
static String m6(url) =>
|
static String m7(url) =>
|
||||||
"Please make sure that docker is installed correctly, or that you are using a non-self-compiled version. If you don\'t have the above issues, please submit an issue on ${url}.";
|
"Please make sure that docker is installed correctly, or that you are using a non-self-compiled version. If you don\'t have the above issues, please submit an issue on ${url}.";
|
||||||
|
|
||||||
static String m7(myGithub) => "\nMade with ❤️ by ${myGithub}";
|
static String m8(myGithub) => "\nMade with ❤️ by ${myGithub}";
|
||||||
|
|
||||||
static String m8(url) => "Please report bugs on ${url}";
|
static String m9(url) => "Please report bugs on ${url}";
|
||||||
|
|
||||||
static String m9(date) => "Are you sure to restore from ${date} ?";
|
static String m10(date) => "Are you sure to restore from ${date} ?";
|
||||||
|
|
||||||
static String m10(time) => "Spent time: ${time}";
|
static String m11(time) => "Spent time: ${time}";
|
||||||
|
|
||||||
static String m11(name) => "Are you sure to delete [${name}]?";
|
static String m12(url) =>
|
||||||
|
"This function is now in the experimental stage. \nPlease report bugs on ${url} or join our development.";
|
||||||
|
|
||||||
static String m12(server) => "Are you sure to delete server [${server}]?";
|
static String m13(name) => "Are you sure to delete [${name}]?";
|
||||||
|
|
||||||
static String m13(build) => "Found: v1.0.${build}, click to update";
|
static String m14(server) => "Are you sure to delete server [${server}]?";
|
||||||
|
|
||||||
static String m14(build) => "Current: v1.0.${build}";
|
static String m15(build) => "Found: v1.0.${build}, click to update";
|
||||||
|
|
||||||
static String m15(build) => "Current: v1.0.${build}, is up to date";
|
static String m16(build) => "Current: v1.0.${build}";
|
||||||
|
|
||||||
|
static String m17(build) => "Current: v1.0.${build}, is up to date";
|
||||||
|
|
||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||||
"aboutThanks": MessageLookupByLibrary.simpleMessage(
|
"aboutThanks": MessageLookupByLibrary.simpleMessage(
|
||||||
"\nAll rights reserved.\n\nThanks to the following people who participated in the test."),
|
"\nAll rights reserved.\n\nThanks to the following people who participated in the test."),
|
||||||
"addAServer": MessageLookupByLibrary.simpleMessage("add a server"),
|
"addAServer": MessageLookupByLibrary.simpleMessage("add a server"),
|
||||||
|
"addOne": MessageLookupByLibrary.simpleMessage("Add one"),
|
||||||
"addPrivateKey":
|
"addPrivateKey":
|
||||||
MessageLookupByLibrary.simpleMessage("Add private key"),
|
MessageLookupByLibrary.simpleMessage("Add private key"),
|
||||||
"alreadyLastDir":
|
"alreadyLastDir":
|
||||||
@@ -81,6 +87,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"clear": MessageLookupByLibrary.simpleMessage("Clear"),
|
"clear": MessageLookupByLibrary.simpleMessage("Clear"),
|
||||||
"clickSee": MessageLookupByLibrary.simpleMessage("Click here"),
|
"clickSee": MessageLookupByLibrary.simpleMessage("Click here"),
|
||||||
"close": MessageLookupByLibrary.simpleMessage("Close"),
|
"close": MessageLookupByLibrary.simpleMessage("Close"),
|
||||||
|
"cmd": MessageLookupByLibrary.simpleMessage("Command"),
|
||||||
"containerStatus":
|
"containerStatus":
|
||||||
MessageLookupByLibrary.simpleMessage("Container status"),
|
MessageLookupByLibrary.simpleMessage("Container status"),
|
||||||
"convert": MessageLookupByLibrary.simpleMessage("Convert"),
|
"convert": MessageLookupByLibrary.simpleMessage("Convert"),
|
||||||
@@ -94,12 +101,22 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"delete": MessageLookupByLibrary.simpleMessage("Delete"),
|
"delete": MessageLookupByLibrary.simpleMessage("Delete"),
|
||||||
"disconnected": MessageLookupByLibrary.simpleMessage("Disconnected"),
|
"disconnected": MessageLookupByLibrary.simpleMessage("Disconnected"),
|
||||||
"dl2Local": m0,
|
"dl2Local": m0,
|
||||||
"dockerStatusRunningAndStoppedFmt": m1,
|
"dockerContainerName":
|
||||||
"dockerStatusRunningFmt": m2,
|
MessageLookupByLibrary.simpleMessage("Container name"),
|
||||||
|
"dockerEditHost":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Edit DOCKER_HOST"),
|
||||||
|
"dockerEmptyRunningItems": MessageLookupByLibrary.simpleMessage(
|
||||||
|
"No running container. \nIt may be that the env DOCKER_HOST is not read correctly. You can found it by running `echo \$DOCKER_HOST` in terminal."),
|
||||||
|
"dockerImage": MessageLookupByLibrary.simpleMessage("Image"),
|
||||||
|
"dockerImagesFmt": m1,
|
||||||
|
"dockerNotInstalled":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Docker not installed"),
|
||||||
|
"dockerStatusRunningAndStoppedFmt": m2,
|
||||||
|
"dockerStatusRunningFmt": m3,
|
||||||
"download": MessageLookupByLibrary.simpleMessage("Download"),
|
"download": MessageLookupByLibrary.simpleMessage("Download"),
|
||||||
"downloadFinished":
|
"downloadFinished":
|
||||||
MessageLookupByLibrary.simpleMessage("Download finished"),
|
MessageLookupByLibrary.simpleMessage("Download finished"),
|
||||||
"downloadStatus": m3,
|
"downloadStatus": m4,
|
||||||
"edit": MessageLookupByLibrary.simpleMessage("Edit"),
|
"edit": MessageLookupByLibrary.simpleMessage("Edit"),
|
||||||
"encode": MessageLookupByLibrary.simpleMessage("Encode"),
|
"encode": MessageLookupByLibrary.simpleMessage("Encode"),
|
||||||
"error": MessageLookupByLibrary.simpleMessage("Error"),
|
"error": MessageLookupByLibrary.simpleMessage("Error"),
|
||||||
@@ -107,26 +124,34 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"experimentalFeature":
|
"experimentalFeature":
|
||||||
MessageLookupByLibrary.simpleMessage("Experimental feature"),
|
MessageLookupByLibrary.simpleMessage("Experimental feature"),
|
||||||
"export": MessageLookupByLibrary.simpleMessage("Export"),
|
"export": MessageLookupByLibrary.simpleMessage("Export"),
|
||||||
|
"extraArgs": MessageLookupByLibrary.simpleMessage("Extra args"),
|
||||||
"feedback": MessageLookupByLibrary.simpleMessage("Feedback"),
|
"feedback": MessageLookupByLibrary.simpleMessage("Feedback"),
|
||||||
"feedbackOnGithub": MessageLookupByLibrary.simpleMessage(
|
"feedbackOnGithub": MessageLookupByLibrary.simpleMessage(
|
||||||
"If you have any questions, please feedback on Github."),
|
"If you have any questions, please feedback on Github."),
|
||||||
"fieldMustNotEmpty": MessageLookupByLibrary.simpleMessage(
|
"fieldMustNotEmpty": MessageLookupByLibrary.simpleMessage(
|
||||||
"These fields must not be empty."),
|
"These fields must not be empty."),
|
||||||
"files": MessageLookupByLibrary.simpleMessage("Files"),
|
"files": MessageLookupByLibrary.simpleMessage("Files"),
|
||||||
"foundNUpdate": m4,
|
"foundNUpdate": m5,
|
||||||
"go": MessageLookupByLibrary.simpleMessage("Go"),
|
"go": MessageLookupByLibrary.simpleMessage("Go"),
|
||||||
"goSftpDlPage":
|
"goSftpDlPage":
|
||||||
MessageLookupByLibrary.simpleMessage("Go to SFTP download page?"),
|
MessageLookupByLibrary.simpleMessage("Go to SFTP download page?"),
|
||||||
|
"goto": MessageLookupByLibrary.simpleMessage("Go to"),
|
||||||
"host": MessageLookupByLibrary.simpleMessage("Host"),
|
"host": MessageLookupByLibrary.simpleMessage("Host"),
|
||||||
"httpFailedWithCode": m5,
|
"httpFailedWithCode": m6,
|
||||||
|
"imagesList": MessageLookupByLibrary.simpleMessage("Images list"),
|
||||||
"import": MessageLookupByLibrary.simpleMessage("Import"),
|
"import": MessageLookupByLibrary.simpleMessage("Import"),
|
||||||
"importAndExport":
|
"importAndExport":
|
||||||
MessageLookupByLibrary.simpleMessage("Import and Export"),
|
MessageLookupByLibrary.simpleMessage("Import and Export"),
|
||||||
|
"inputDomainHere":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Input Domain here"),
|
||||||
"install": MessageLookupByLibrary.simpleMessage("install"),
|
"install": MessageLookupByLibrary.simpleMessage("install"),
|
||||||
"installDockerWithUrl": MessageLookupByLibrary.simpleMessage(
|
"installDockerWithUrl": MessageLookupByLibrary.simpleMessage(
|
||||||
"Please https://docs.docker.com/engine/install docker first."),
|
"Please https://docs.docker.com/engine/install docker first."),
|
||||||
"invalidJson": MessageLookupByLibrary.simpleMessage("Invalid JSON"),
|
"invalidJson": MessageLookupByLibrary.simpleMessage("Invalid JSON"),
|
||||||
"invalidVersionHelp": m6,
|
"invalidVersion":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Invalid version"),
|
||||||
|
"invalidVersionHelp": m7,
|
||||||
|
"isBusy": MessageLookupByLibrary.simpleMessage("Is busy now"),
|
||||||
"keepForeground":
|
"keepForeground":
|
||||||
MessageLookupByLibrary.simpleMessage("Keep app foreground!"),
|
MessageLookupByLibrary.simpleMessage("Keep app foreground!"),
|
||||||
"keyAuth": MessageLookupByLibrary.simpleMessage("Key Auth"),
|
"keyAuth": MessageLookupByLibrary.simpleMessage("Key Auth"),
|
||||||
@@ -136,11 +161,12 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"loadingFiles":
|
"loadingFiles":
|
||||||
MessageLookupByLibrary.simpleMessage("Loading files..."),
|
MessageLookupByLibrary.simpleMessage("Loading files..."),
|
||||||
"loss": MessageLookupByLibrary.simpleMessage("loss"),
|
"loss": MessageLookupByLibrary.simpleMessage("loss"),
|
||||||
"madeWithLove": m7,
|
"madeWithLove": m8,
|
||||||
"max": MessageLookupByLibrary.simpleMessage("max"),
|
"max": MessageLookupByLibrary.simpleMessage("max"),
|
||||||
"min": MessageLookupByLibrary.simpleMessage("min"),
|
"min": MessageLookupByLibrary.simpleMessage("min"),
|
||||||
"ms": MessageLookupByLibrary.simpleMessage("ms"),
|
"ms": MessageLookupByLibrary.simpleMessage("ms"),
|
||||||
"name": MessageLookupByLibrary.simpleMessage("Name"),
|
"name": MessageLookupByLibrary.simpleMessage("Name"),
|
||||||
|
"newContainer": MessageLookupByLibrary.simpleMessage("New container"),
|
||||||
"noClient": MessageLookupByLibrary.simpleMessage("No client"),
|
"noClient": MessageLookupByLibrary.simpleMessage("No client"),
|
||||||
"noInterface": MessageLookupByLibrary.simpleMessage("No interface"),
|
"noInterface": MessageLookupByLibrary.simpleMessage("No interface"),
|
||||||
"noResult": MessageLookupByLibrary.simpleMessage("No result"),
|
"noResult": MessageLookupByLibrary.simpleMessage("No result"),
|
||||||
@@ -153,7 +179,10 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"noUpdateAvailable":
|
"noUpdateAvailable":
|
||||||
MessageLookupByLibrary.simpleMessage("No update available"),
|
MessageLookupByLibrary.simpleMessage("No update available"),
|
||||||
"ok": MessageLookupByLibrary.simpleMessage("OK"),
|
"ok": MessageLookupByLibrary.simpleMessage("OK"),
|
||||||
|
"onServerDetailPage":
|
||||||
|
MessageLookupByLibrary.simpleMessage("On server detail page"),
|
||||||
"open": MessageLookupByLibrary.simpleMessage("Open"),
|
"open": MessageLookupByLibrary.simpleMessage("Open"),
|
||||||
|
"path": MessageLookupByLibrary.simpleMessage("Path"),
|
||||||
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
||||||
"pingAvg": MessageLookupByLibrary.simpleMessage("Avg:"),
|
"pingAvg": MessageLookupByLibrary.simpleMessage("Avg:"),
|
||||||
"pingInputIP": MessageLookupByLibrary.simpleMessage(
|
"pingInputIP": MessageLookupByLibrary.simpleMessage(
|
||||||
@@ -167,14 +196,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"plzSelectKey":
|
"plzSelectKey":
|
||||||
MessageLookupByLibrary.simpleMessage("Please select a key."),
|
MessageLookupByLibrary.simpleMessage("Please select a key."),
|
||||||
"port": MessageLookupByLibrary.simpleMessage("Port"),
|
"port": MessageLookupByLibrary.simpleMessage("Port"),
|
||||||
|
"preview": MessageLookupByLibrary.simpleMessage("Preview"),
|
||||||
"privateKey": MessageLookupByLibrary.simpleMessage("Private Key"),
|
"privateKey": MessageLookupByLibrary.simpleMessage("Private Key"),
|
||||||
"pwd": MessageLookupByLibrary.simpleMessage("Password"),
|
"pwd": MessageLookupByLibrary.simpleMessage("Password"),
|
||||||
"rename": MessageLookupByLibrary.simpleMessage("Rename"),
|
"rename": MessageLookupByLibrary.simpleMessage("Rename"),
|
||||||
"reportBugsOnGithubIssue": m8,
|
"reportBugsOnGithubIssue": m9,
|
||||||
"restore": MessageLookupByLibrary.simpleMessage("Restore"),
|
"restore": MessageLookupByLibrary.simpleMessage("Restore"),
|
||||||
"restoreSuccess": MessageLookupByLibrary.simpleMessage(
|
"restoreSuccess": MessageLookupByLibrary.simpleMessage(
|
||||||
"Restore success. Restart app to apply."),
|
"Restore success. Restart app to apply."),
|
||||||
"restoreSureWithDate": m9,
|
"restoreSureWithDate": m10,
|
||||||
"result": MessageLookupByLibrary.simpleMessage("Result"),
|
"result": MessageLookupByLibrary.simpleMessage("Result"),
|
||||||
"run": MessageLookupByLibrary.simpleMessage("Run"),
|
"run": MessageLookupByLibrary.simpleMessage("Run"),
|
||||||
"save": MessageLookupByLibrary.simpleMessage("Save"),
|
"save": MessageLookupByLibrary.simpleMessage("Save"),
|
||||||
@@ -197,14 +227,17 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
MessageLookupByLibrary.simpleMessage("No download task."),
|
MessageLookupByLibrary.simpleMessage("No download task."),
|
||||||
"sftpSSHConnected":
|
"sftpSSHConnected":
|
||||||
MessageLookupByLibrary.simpleMessage("SFTP Connected"),
|
MessageLookupByLibrary.simpleMessage("SFTP Connected"),
|
||||||
|
"showDistLogo":
|
||||||
|
MessageLookupByLibrary.simpleMessage("Show distribution logo"),
|
||||||
"snippet": MessageLookupByLibrary.simpleMessage("Snippet"),
|
"snippet": MessageLookupByLibrary.simpleMessage("Snippet"),
|
||||||
"spentTime": m10,
|
"spentTime": m11,
|
||||||
|
"sshTip": m12,
|
||||||
"start": MessageLookupByLibrary.simpleMessage("Start"),
|
"start": MessageLookupByLibrary.simpleMessage("Start"),
|
||||||
"stop": MessageLookupByLibrary.simpleMessage("Stop"),
|
"stop": MessageLookupByLibrary.simpleMessage("Stop"),
|
||||||
"sureDelete": m11,
|
"sureDelete": m13,
|
||||||
"sureNoPwd": MessageLookupByLibrary.simpleMessage(
|
"sureNoPwd": MessageLookupByLibrary.simpleMessage(
|
||||||
"Are you sure to use no password?"),
|
"Are you sure to use no password?"),
|
||||||
"sureToDeleteServer": m12,
|
"sureToDeleteServer": m14,
|
||||||
"ttl": MessageLookupByLibrary.simpleMessage("ttl"),
|
"ttl": MessageLookupByLibrary.simpleMessage("ttl"),
|
||||||
"unknown": MessageLookupByLibrary.simpleMessage("unknown"),
|
"unknown": MessageLookupByLibrary.simpleMessage("unknown"),
|
||||||
"unknownError": MessageLookupByLibrary.simpleMessage("Unknown error"),
|
"unknownError": MessageLookupByLibrary.simpleMessage("Unknown error"),
|
||||||
@@ -213,15 +246,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"update": MessageLookupByLibrary.simpleMessage("Update"),
|
"update": MessageLookupByLibrary.simpleMessage("Update"),
|
||||||
"updateAll": MessageLookupByLibrary.simpleMessage("Update all"),
|
"updateAll": MessageLookupByLibrary.simpleMessage("Update all"),
|
||||||
"updateIntervalEqual0": MessageLookupByLibrary.simpleMessage(
|
"updateIntervalEqual0": MessageLookupByLibrary.simpleMessage(
|
||||||
"You set to 0, will not update automatically.\nYou can pull to refresh manually."),
|
"You set to 0, will not update automatically.\nCan\'t calculate CPU status."),
|
||||||
"updateServerStatusInterval": MessageLookupByLibrary.simpleMessage(
|
"updateServerStatusInterval": MessageLookupByLibrary.simpleMessage(
|
||||||
"Server status update interval"),
|
"Server status update interval"),
|
||||||
"upsideDown": MessageLookupByLibrary.simpleMessage("Upside Down"),
|
"upsideDown": MessageLookupByLibrary.simpleMessage("Upside Down"),
|
||||||
"urlOrJson": MessageLookupByLibrary.simpleMessage("URL or JSON"),
|
"urlOrJson": MessageLookupByLibrary.simpleMessage("URL or JSON"),
|
||||||
"user": MessageLookupByLibrary.simpleMessage("User"),
|
"user": MessageLookupByLibrary.simpleMessage("User"),
|
||||||
"versionHaveUpdate": m13,
|
"versionHaveUpdate": m15,
|
||||||
"versionUnknownUpdate": m14,
|
"versionUnknownUpdate": m16,
|
||||||
"versionUpdated": m15,
|
"versionUpdated": m17,
|
||||||
"waitConnection": MessageLookupByLibrary.simpleMessage(
|
"waitConnection": MessageLookupByLibrary.simpleMessage(
|
||||||
"Please wait for the connection to be established."),
|
"Please wait for the connection to be established."),
|
||||||
"willTakEeffectImmediately":
|
"willTakEeffectImmediately":
|
||||||
|
|||||||
@@ -22,43 +22,48 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
|
|
||||||
static String m0(fileName) => "下载 [${fileName}] 到本地?";
|
static String m0(fileName) => "下载 [${fileName}] 到本地?";
|
||||||
|
|
||||||
static String m1(runningCount, stoppedCount) =>
|
static String m1(count) => "共 ${count} 个镜像";
|
||||||
|
|
||||||
|
static String m2(runningCount, stoppedCount) =>
|
||||||
"${runningCount}个正在运行, ${stoppedCount}个已停止";
|
"${runningCount}个正在运行, ${stoppedCount}个已停止";
|
||||||
|
|
||||||
static String m2(count) => "${count}个容器正在运行";
|
static String m3(count) => "${count}个容器正在运行";
|
||||||
|
|
||||||
static String m3(percent, size) => "${size} 的 ${percent}%";
|
static String m4(percent, size) => "${size} 的 ${percent}%";
|
||||||
|
|
||||||
static String m4(count) => "找到 ${count} 个更新";
|
static String m5(count) => "找到 ${count} 个更新";
|
||||||
|
|
||||||
static String m5(code) => "请求失败, 状态码: ${code}";
|
static String m6(code) => "请求失败, 状态码: ${code}";
|
||||||
|
|
||||||
static String m6(url) =>
|
static String m7(url) =>
|
||||||
"请确保正确安装了docker,或者使用的非自编译版本。如果没有以上问题,请在 ${url} 提交问题。";
|
"请确保正确安装了docker,或者使用的非自编译版本。如果没有以上问题,请在 ${url} 提交问题。";
|
||||||
|
|
||||||
static String m7(myGithub) => "\n用❤️制作 by ${myGithub}";
|
static String m8(myGithub) => "\n用❤️制作 by ${myGithub}";
|
||||||
|
|
||||||
static String m8(url) => "请到 ${url} 提交问题";
|
static String m9(url) => "请到 ${url} 提交问题";
|
||||||
|
|
||||||
static String m9(date) => "确定恢复 ${date} 的备份吗?";
|
static String m10(date) => "确定恢复 ${date} 的备份吗?";
|
||||||
|
|
||||||
static String m10(time) => "耗时: ${time}";
|
static String m11(time) => "耗时: ${time}";
|
||||||
|
|
||||||
static String m11(name) => "确定删除[${name}]?";
|
static String m12(url) => "该功能目前处于测试阶段,请在 ${url} 反馈问题,或者加入我们开发。";
|
||||||
|
|
||||||
static String m12(server) => "你确定要删除服务器 [${server}] 吗?";
|
static String m13(name) => "确定删除[${name}]?";
|
||||||
|
|
||||||
static String m13(build) => "找到新版本:v1.0.${build}, 点击更新";
|
static String m14(server) => "你确定要删除服务器 [${server}] 吗?";
|
||||||
|
|
||||||
static String m14(build) => "当前:v1.0.${build}";
|
static String m15(build) => "找到新版本:v1.0.${build}, 点击更新";
|
||||||
|
|
||||||
static String m15(build) => "当前:v1.0.${build}, 已是最新版本";
|
static String m16(build) => "当前:v1.0.${build}";
|
||||||
|
|
||||||
|
static String m17(build) => "当前:v1.0.${build}, 已是最新版本";
|
||||||
|
|
||||||
final messages = _notInlinedMessages(_notInlinedMessages);
|
final messages = _notInlinedMessages(_notInlinedMessages);
|
||||||
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
|
||||||
"aboutThanks":
|
"aboutThanks":
|
||||||
MessageLookupByLibrary.simpleMessage("\n保留所有权利。\n\n感谢以下参与软件测试的各位。"),
|
MessageLookupByLibrary.simpleMessage("\n保留所有权利。\n\n感谢以下参与软件测试的各位。"),
|
||||||
"addAServer": MessageLookupByLibrary.simpleMessage("添加服务器"),
|
"addAServer": MessageLookupByLibrary.simpleMessage("添加服务器"),
|
||||||
|
"addOne": MessageLookupByLibrary.simpleMessage("前去新增"),
|
||||||
"addPrivateKey": MessageLookupByLibrary.simpleMessage("添加一个私钥"),
|
"addPrivateKey": MessageLookupByLibrary.simpleMessage("添加一个私钥"),
|
||||||
"alreadyLastDir": MessageLookupByLibrary.simpleMessage("已经是最上层目录了"),
|
"alreadyLastDir": MessageLookupByLibrary.simpleMessage("已经是最上层目录了"),
|
||||||
"appPrimaryColor": MessageLookupByLibrary.simpleMessage("App主要色"),
|
"appPrimaryColor": MessageLookupByLibrary.simpleMessage("App主要色"),
|
||||||
@@ -76,6 +81,7 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"clear": MessageLookupByLibrary.simpleMessage("清除"),
|
"clear": MessageLookupByLibrary.simpleMessage("清除"),
|
||||||
"clickSee": MessageLookupByLibrary.simpleMessage("点击查看"),
|
"clickSee": MessageLookupByLibrary.simpleMessage("点击查看"),
|
||||||
"close": MessageLookupByLibrary.simpleMessage("关闭"),
|
"close": MessageLookupByLibrary.simpleMessage("关闭"),
|
||||||
|
"cmd": MessageLookupByLibrary.simpleMessage("命令"),
|
||||||
"containerStatus": MessageLookupByLibrary.simpleMessage("容器状态"),
|
"containerStatus": MessageLookupByLibrary.simpleMessage("容器状态"),
|
||||||
"convert": MessageLookupByLibrary.simpleMessage("转换"),
|
"convert": MessageLookupByLibrary.simpleMessage("转换"),
|
||||||
"copy": MessageLookupByLibrary.simpleMessage("复制到剪切板"),
|
"copy": MessageLookupByLibrary.simpleMessage("复制到剪切板"),
|
||||||
@@ -88,34 +94,48 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"delete": MessageLookupByLibrary.simpleMessage("删除"),
|
"delete": MessageLookupByLibrary.simpleMessage("删除"),
|
||||||
"disconnected": MessageLookupByLibrary.simpleMessage("连接断开"),
|
"disconnected": MessageLookupByLibrary.simpleMessage("连接断开"),
|
||||||
"dl2Local": m0,
|
"dl2Local": m0,
|
||||||
"dockerStatusRunningAndStoppedFmt": m1,
|
"dockerContainerName": MessageLookupByLibrary.simpleMessage("容器名"),
|
||||||
"dockerStatusRunningFmt": m2,
|
"dockerEditHost":
|
||||||
|
MessageLookupByLibrary.simpleMessage("编辑 DOCKER_HOST"),
|
||||||
|
"dockerEmptyRunningItems": MessageLookupByLibrary.simpleMessage(
|
||||||
|
"没有正在运行的容器。\n这可能是因为环境变量 DOCKER_HOST 没有被正确读取。你可以通过在终端内运行 `echo \$DOCKER_HOST` 来获取。"),
|
||||||
|
"dockerImage": MessageLookupByLibrary.simpleMessage("镜像"),
|
||||||
|
"dockerImagesFmt": m1,
|
||||||
|
"dockerNotInstalled": MessageLookupByLibrary.simpleMessage("Docker未安装"),
|
||||||
|
"dockerStatusRunningAndStoppedFmt": m2,
|
||||||
|
"dockerStatusRunningFmt": m3,
|
||||||
"download": MessageLookupByLibrary.simpleMessage("下载"),
|
"download": MessageLookupByLibrary.simpleMessage("下载"),
|
||||||
"downloadFinished": MessageLookupByLibrary.simpleMessage("下载完成!"),
|
"downloadFinished": MessageLookupByLibrary.simpleMessage("下载完成!"),
|
||||||
"downloadStatus": m3,
|
"downloadStatus": m4,
|
||||||
"edit": MessageLookupByLibrary.simpleMessage("编辑"),
|
"edit": MessageLookupByLibrary.simpleMessage("编辑"),
|
||||||
"encode": MessageLookupByLibrary.simpleMessage("编码"),
|
"encode": MessageLookupByLibrary.simpleMessage("编码"),
|
||||||
"error": MessageLookupByLibrary.simpleMessage("出错了"),
|
"error": MessageLookupByLibrary.simpleMessage("出错了"),
|
||||||
"exampleName": MessageLookupByLibrary.simpleMessage("名称示例"),
|
"exampleName": MessageLookupByLibrary.simpleMessage("名称示例"),
|
||||||
"experimentalFeature": MessageLookupByLibrary.simpleMessage("实验性功能"),
|
"experimentalFeature": MessageLookupByLibrary.simpleMessage("实验性功能"),
|
||||||
"export": MessageLookupByLibrary.simpleMessage("导出"),
|
"export": MessageLookupByLibrary.simpleMessage("导出"),
|
||||||
|
"extraArgs": MessageLookupByLibrary.simpleMessage("额外参数"),
|
||||||
"feedback": MessageLookupByLibrary.simpleMessage("反馈"),
|
"feedback": MessageLookupByLibrary.simpleMessage("反馈"),
|
||||||
"feedbackOnGithub":
|
"feedbackOnGithub":
|
||||||
MessageLookupByLibrary.simpleMessage("如果你有任何问题,请在GitHub反馈"),
|
MessageLookupByLibrary.simpleMessage("如果你有任何问题,请在GitHub反馈"),
|
||||||
"fieldMustNotEmpty": MessageLookupByLibrary.simpleMessage("这些输入框不能为空。"),
|
"fieldMustNotEmpty": MessageLookupByLibrary.simpleMessage("这些输入框不能为空。"),
|
||||||
"files": MessageLookupByLibrary.simpleMessage("文件"),
|
"files": MessageLookupByLibrary.simpleMessage("文件"),
|
||||||
"foundNUpdate": m4,
|
"foundNUpdate": m5,
|
||||||
"go": MessageLookupByLibrary.simpleMessage("开始"),
|
"go": MessageLookupByLibrary.simpleMessage("开始"),
|
||||||
"goSftpDlPage": MessageLookupByLibrary.simpleMessage("前往下载页?"),
|
"goSftpDlPage": MessageLookupByLibrary.simpleMessage("前往下载页?"),
|
||||||
|
"goto": MessageLookupByLibrary.simpleMessage("前往"),
|
||||||
"host": MessageLookupByLibrary.simpleMessage("主机"),
|
"host": MessageLookupByLibrary.simpleMessage("主机"),
|
||||||
"httpFailedWithCode": m5,
|
"httpFailedWithCode": m6,
|
||||||
|
"imagesList": MessageLookupByLibrary.simpleMessage("镜像列表"),
|
||||||
"import": MessageLookupByLibrary.simpleMessage("导入"),
|
"import": MessageLookupByLibrary.simpleMessage("导入"),
|
||||||
"importAndExport": MessageLookupByLibrary.simpleMessage("导入或导出"),
|
"importAndExport": MessageLookupByLibrary.simpleMessage("导入或导出"),
|
||||||
|
"inputDomainHere": MessageLookupByLibrary.simpleMessage("在这里输入域名"),
|
||||||
"install": MessageLookupByLibrary.simpleMessage("安装"),
|
"install": MessageLookupByLibrary.simpleMessage("安装"),
|
||||||
"installDockerWithUrl": MessageLookupByLibrary.simpleMessage(
|
"installDockerWithUrl": MessageLookupByLibrary.simpleMessage(
|
||||||
"请先 https://docs.docker.com/engine/install docker"),
|
"请先 https://docs.docker.com/engine/install docker"),
|
||||||
"invalidJson": MessageLookupByLibrary.simpleMessage("无效的json,存在格式问题"),
|
"invalidJson": MessageLookupByLibrary.simpleMessage("无效的json,存在格式问题"),
|
||||||
"invalidVersionHelp": m6,
|
"invalidVersion": MessageLookupByLibrary.simpleMessage("不支持的版本"),
|
||||||
|
"invalidVersionHelp": m7,
|
||||||
|
"isBusy": MessageLookupByLibrary.simpleMessage("当前正忙"),
|
||||||
"keepForeground": MessageLookupByLibrary.simpleMessage("请保持应用处于前台!"),
|
"keepForeground": MessageLookupByLibrary.simpleMessage("请保持应用处于前台!"),
|
||||||
"keyAuth": MessageLookupByLibrary.simpleMessage("公钥认证"),
|
"keyAuth": MessageLookupByLibrary.simpleMessage("公钥认证"),
|
||||||
"lastTry": MessageLookupByLibrary.simpleMessage("最后尝试"),
|
"lastTry": MessageLookupByLibrary.simpleMessage("最后尝试"),
|
||||||
@@ -123,11 +143,12 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"license": MessageLookupByLibrary.simpleMessage("开源证书"),
|
"license": MessageLookupByLibrary.simpleMessage("开源证书"),
|
||||||
"loadingFiles": MessageLookupByLibrary.simpleMessage("正在加载目录。。。"),
|
"loadingFiles": MessageLookupByLibrary.simpleMessage("正在加载目录。。。"),
|
||||||
"loss": MessageLookupByLibrary.simpleMessage("丢包率"),
|
"loss": MessageLookupByLibrary.simpleMessage("丢包率"),
|
||||||
"madeWithLove": m7,
|
"madeWithLove": m8,
|
||||||
"max": MessageLookupByLibrary.simpleMessage("最大"),
|
"max": MessageLookupByLibrary.simpleMessage("最大"),
|
||||||
"min": MessageLookupByLibrary.simpleMessage("最小"),
|
"min": MessageLookupByLibrary.simpleMessage("最小"),
|
||||||
"ms": MessageLookupByLibrary.simpleMessage("毫秒"),
|
"ms": MessageLookupByLibrary.simpleMessage("毫秒"),
|
||||||
"name": MessageLookupByLibrary.simpleMessage("名称"),
|
"name": MessageLookupByLibrary.simpleMessage("名称"),
|
||||||
|
"newContainer": MessageLookupByLibrary.simpleMessage("新建容器"),
|
||||||
"noClient": MessageLookupByLibrary.simpleMessage("没有SSH连接"),
|
"noClient": MessageLookupByLibrary.simpleMessage("没有SSH连接"),
|
||||||
"noInterface": MessageLookupByLibrary.simpleMessage("没有可用的接口"),
|
"noInterface": MessageLookupByLibrary.simpleMessage("没有可用的接口"),
|
||||||
"noResult": MessageLookupByLibrary.simpleMessage("无结果"),
|
"noResult": MessageLookupByLibrary.simpleMessage("无结果"),
|
||||||
@@ -136,7 +157,9 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"noServerAvailable": MessageLookupByLibrary.simpleMessage("没有可用的服务器。"),
|
"noServerAvailable": MessageLookupByLibrary.simpleMessage("没有可用的服务器。"),
|
||||||
"noUpdateAvailable": MessageLookupByLibrary.simpleMessage("没有可用更新"),
|
"noUpdateAvailable": MessageLookupByLibrary.simpleMessage("没有可用更新"),
|
||||||
"ok": MessageLookupByLibrary.simpleMessage("好"),
|
"ok": MessageLookupByLibrary.simpleMessage("好"),
|
||||||
|
"onServerDetailPage": MessageLookupByLibrary.simpleMessage("在服务器详情页"),
|
||||||
"open": MessageLookupByLibrary.simpleMessage("打开"),
|
"open": MessageLookupByLibrary.simpleMessage("打开"),
|
||||||
|
"path": MessageLookupByLibrary.simpleMessage("路径"),
|
||||||
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
"ping": MessageLookupByLibrary.simpleMessage("Ping"),
|
||||||
"pingAvg": MessageLookupByLibrary.simpleMessage("平均:"),
|
"pingAvg": MessageLookupByLibrary.simpleMessage("平均:"),
|
||||||
"pingInputIP": MessageLookupByLibrary.simpleMessage("请输入目标IP或域名"),
|
"pingInputIP": MessageLookupByLibrary.simpleMessage("请输入目标IP或域名"),
|
||||||
@@ -147,14 +170,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"plzEnterHost": MessageLookupByLibrary.simpleMessage("请输入主机"),
|
"plzEnterHost": MessageLookupByLibrary.simpleMessage("请输入主机"),
|
||||||
"plzSelectKey": MessageLookupByLibrary.simpleMessage("请选择私钥"),
|
"plzSelectKey": MessageLookupByLibrary.simpleMessage("请选择私钥"),
|
||||||
"port": MessageLookupByLibrary.simpleMessage("端口"),
|
"port": MessageLookupByLibrary.simpleMessage("端口"),
|
||||||
|
"preview": MessageLookupByLibrary.simpleMessage("预览"),
|
||||||
"privateKey": MessageLookupByLibrary.simpleMessage("私钥"),
|
"privateKey": MessageLookupByLibrary.simpleMessage("私钥"),
|
||||||
"pwd": MessageLookupByLibrary.simpleMessage("密码"),
|
"pwd": MessageLookupByLibrary.simpleMessage("密码"),
|
||||||
"rename": MessageLookupByLibrary.simpleMessage("重命名"),
|
"rename": MessageLookupByLibrary.simpleMessage("重命名"),
|
||||||
"reportBugsOnGithubIssue": m8,
|
"reportBugsOnGithubIssue": m9,
|
||||||
"restore": MessageLookupByLibrary.simpleMessage("恢复"),
|
"restore": MessageLookupByLibrary.simpleMessage("恢复"),
|
||||||
"restoreSuccess":
|
"restoreSuccess":
|
||||||
MessageLookupByLibrary.simpleMessage("恢复成功,需要重启App来应用更改"),
|
MessageLookupByLibrary.simpleMessage("恢复成功,需要重启App来应用更改"),
|
||||||
"restoreSureWithDate": m9,
|
"restoreSureWithDate": m10,
|
||||||
"result": MessageLookupByLibrary.simpleMessage("结果"),
|
"result": MessageLookupByLibrary.simpleMessage("结果"),
|
||||||
"run": MessageLookupByLibrary.simpleMessage("运行"),
|
"run": MessageLookupByLibrary.simpleMessage("运行"),
|
||||||
"save": MessageLookupByLibrary.simpleMessage("保存"),
|
"save": MessageLookupByLibrary.simpleMessage("保存"),
|
||||||
@@ -172,13 +196,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"sftpNoDownloadTask": MessageLookupByLibrary.simpleMessage("没有下载任务"),
|
"sftpNoDownloadTask": MessageLookupByLibrary.simpleMessage("没有下载任务"),
|
||||||
"sftpSSHConnected":
|
"sftpSSHConnected":
|
||||||
MessageLookupByLibrary.simpleMessage("SFTP 已连接,即将开始下载..."),
|
MessageLookupByLibrary.simpleMessage("SFTP 已连接,即将开始下载..."),
|
||||||
|
"showDistLogo": MessageLookupByLibrary.simpleMessage("显示发行版 Logo"),
|
||||||
"snippet": MessageLookupByLibrary.simpleMessage("代码片段"),
|
"snippet": MessageLookupByLibrary.simpleMessage("代码片段"),
|
||||||
"spentTime": m10,
|
"spentTime": m11,
|
||||||
|
"sshTip": m12,
|
||||||
"start": MessageLookupByLibrary.simpleMessage("开始"),
|
"start": MessageLookupByLibrary.simpleMessage("开始"),
|
||||||
"stop": MessageLookupByLibrary.simpleMessage("停止"),
|
"stop": MessageLookupByLibrary.simpleMessage("停止"),
|
||||||
"sureDelete": m11,
|
"sureDelete": m13,
|
||||||
"sureNoPwd": MessageLookupByLibrary.simpleMessage("确认使用无密码?"),
|
"sureNoPwd": MessageLookupByLibrary.simpleMessage("确认使用无密码?"),
|
||||||
"sureToDeleteServer": m12,
|
"sureToDeleteServer": m14,
|
||||||
"ttl": MessageLookupByLibrary.simpleMessage("缓存时间"),
|
"ttl": MessageLookupByLibrary.simpleMessage("缓存时间"),
|
||||||
"unknown": MessageLookupByLibrary.simpleMessage("未知"),
|
"unknown": MessageLookupByLibrary.simpleMessage("未知"),
|
||||||
"unknownError": MessageLookupByLibrary.simpleMessage("未知错误"),
|
"unknownError": MessageLookupByLibrary.simpleMessage("未知错误"),
|
||||||
@@ -186,15 +212,15 @@ class MessageLookup extends MessageLookupByLibrary {
|
|||||||
"update": MessageLookupByLibrary.simpleMessage("更新"),
|
"update": MessageLookupByLibrary.simpleMessage("更新"),
|
||||||
"updateAll": MessageLookupByLibrary.simpleMessage("更新全部"),
|
"updateAll": MessageLookupByLibrary.simpleMessage("更新全部"),
|
||||||
"updateIntervalEqual0": MessageLookupByLibrary.simpleMessage(
|
"updateIntervalEqual0": MessageLookupByLibrary.simpleMessage(
|
||||||
"你设置为0,服务器状态不会自动刷新。\n你可以手动下拉刷新。"),
|
"你设置为0,服务器状态不会自动刷新。\n且不能计算CPU使用情况。"),
|
||||||
"updateServerStatusInterval":
|
"updateServerStatusInterval":
|
||||||
MessageLookupByLibrary.simpleMessage("服务器状态刷新间隔"),
|
MessageLookupByLibrary.simpleMessage("服务器状态刷新间隔"),
|
||||||
"upsideDown": MessageLookupByLibrary.simpleMessage("上下交换"),
|
"upsideDown": MessageLookupByLibrary.simpleMessage("上下交换"),
|
||||||
"urlOrJson": MessageLookupByLibrary.simpleMessage("链接或JSON"),
|
"urlOrJson": MessageLookupByLibrary.simpleMessage("链接或JSON"),
|
||||||
"user": MessageLookupByLibrary.simpleMessage("用户"),
|
"user": MessageLookupByLibrary.simpleMessage("用户"),
|
||||||
"versionHaveUpdate": m13,
|
"versionHaveUpdate": m15,
|
||||||
"versionUnknownUpdate": m14,
|
"versionUnknownUpdate": m16,
|
||||||
"versionUpdated": m15,
|
"versionUpdated": m17,
|
||||||
"waitConnection": MessageLookupByLibrary.simpleMessage("请等待连接建立"),
|
"waitConnection": MessageLookupByLibrary.simpleMessage("请等待连接建立"),
|
||||||
"willTakEeffectImmediately":
|
"willTakEeffectImmediately":
|
||||||
MessageLookupByLibrary.simpleMessage("更改将会立即生效")
|
MessageLookupByLibrary.simpleMessage("更改将会立即生效")
|
||||||
|
|||||||
@@ -470,10 +470,10 @@ class S {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `You set to 0, will not update automatically.\nYou can pull to refresh manually.`
|
/// `You set to 0, will not update automatically.\nCan't calculate CPU status.`
|
||||||
String get updateIntervalEqual0 {
|
String get updateIntervalEqual0 {
|
||||||
return Intl.message(
|
return Intl.message(
|
||||||
'You set to 0, will not update automatically.\nYou can pull to refresh manually.',
|
'You set to 0, will not update automatically.\nCan\'t calculate CPU status.',
|
||||||
name: 'updateIntervalEqual0',
|
name: 'updateIntervalEqual0',
|
||||||
desc: '',
|
desc: '',
|
||||||
args: [],
|
args: [],
|
||||||
@@ -1340,6 +1340,206 @@ class S {
|
|||||||
args: [],
|
args: [],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// `Input Domain here`
|
||||||
|
String get inputDomainHere {
|
||||||
|
return Intl.message(
|
||||||
|
'Input Domain here',
|
||||||
|
name: 'inputDomainHere',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Docker not installed`
|
||||||
|
String get dockerNotInstalled {
|
||||||
|
return Intl.message(
|
||||||
|
'Docker not installed',
|
||||||
|
name: 'dockerNotInstalled',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Invalid version`
|
||||||
|
String get invalidVersion {
|
||||||
|
return Intl.message(
|
||||||
|
'Invalid version',
|
||||||
|
name: 'invalidVersion',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Command`
|
||||||
|
String get cmd {
|
||||||
|
return Intl.message(
|
||||||
|
'Command',
|
||||||
|
name: 'cmd',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `No running container. \nIt may be that the env DOCKER_HOST is not read correctly. You can found it by running 'echo $DOCKER_HOST' in terminal.`
|
||||||
|
String get dockerEmptyRunningItems {
|
||||||
|
return Intl.message(
|
||||||
|
'No running container. \nIt may be that the env DOCKER_HOST is not read correctly. You can found it by running `echo \$DOCKER_HOST` in terminal.',
|
||||||
|
name: 'dockerEmptyRunningItems',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Edit DOCKER_HOST`
|
||||||
|
String get dockerEditHost {
|
||||||
|
return Intl.message(
|
||||||
|
'Edit DOCKER_HOST',
|
||||||
|
name: 'dockerEditHost',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `New container`
|
||||||
|
String get newContainer {
|
||||||
|
return Intl.message(
|
||||||
|
'New container',
|
||||||
|
name: 'newContainer',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Image`
|
||||||
|
String get dockerImage {
|
||||||
|
return Intl.message(
|
||||||
|
'Image',
|
||||||
|
name: 'dockerImage',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Container name`
|
||||||
|
String get dockerContainerName {
|
||||||
|
return Intl.message(
|
||||||
|
'Container name',
|
||||||
|
name: 'dockerContainerName',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Extra args`
|
||||||
|
String get extraArgs {
|
||||||
|
return Intl.message(
|
||||||
|
'Extra args',
|
||||||
|
name: 'extraArgs',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Preview`
|
||||||
|
String get preview {
|
||||||
|
return Intl.message(
|
||||||
|
'Preview',
|
||||||
|
name: 'preview',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Is busy now`
|
||||||
|
String get isBusy {
|
||||||
|
return Intl.message(
|
||||||
|
'Is busy now',
|
||||||
|
name: 'isBusy',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Images list`
|
||||||
|
String get imagesList {
|
||||||
|
return Intl.message(
|
||||||
|
'Images list',
|
||||||
|
name: 'imagesList',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `{count} images`
|
||||||
|
String dockerImagesFmt(Object count) {
|
||||||
|
return Intl.message(
|
||||||
|
'$count images',
|
||||||
|
name: 'dockerImagesFmt',
|
||||||
|
desc: '',
|
||||||
|
args: [count],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Path`
|
||||||
|
String get path {
|
||||||
|
return Intl.message(
|
||||||
|
'Path',
|
||||||
|
name: 'path',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Go to`
|
||||||
|
String get goto {
|
||||||
|
return Intl.message(
|
||||||
|
'Go to',
|
||||||
|
name: 'goto',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Show distribution logo`
|
||||||
|
String get showDistLogo {
|
||||||
|
return Intl.message(
|
||||||
|
'Show distribution logo',
|
||||||
|
name: 'showDistLogo',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `On server detail page`
|
||||||
|
String get onServerDetailPage {
|
||||||
|
return Intl.message(
|
||||||
|
'On server detail page',
|
||||||
|
name: 'onServerDetailPage',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `Add one`
|
||||||
|
String get addOne {
|
||||||
|
return Intl.message(
|
||||||
|
'Add one',
|
||||||
|
name: 'addOne',
|
||||||
|
desc: '',
|
||||||
|
args: [],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// `This function is now in the experimental stage. \nPlease report bugs on {url} or join our development.`
|
||||||
|
String sshTip(Object url) {
|
||||||
|
return Intl.message(
|
||||||
|
'This function is now in the experimental stage. \nPlease report bugs on $url or join our development.',
|
||||||
|
name: 'sshTip',
|
||||||
|
desc: '',
|
||||||
|
args: [url],
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
"versionUnknownUpdate": "Current: v1.0.{build}",
|
"versionUnknownUpdate": "Current: v1.0.{build}",
|
||||||
"versionHaveUpdate": "Found: v1.0.{build}, click to update",
|
"versionHaveUpdate": "Found: v1.0.{build}, click to update",
|
||||||
"second": "s",
|
"second": "s",
|
||||||
"updateIntervalEqual0": "You set to 0, will not update automatically.\nYou can pull to refresh manually.",
|
"updateIntervalEqual0": "You set to 0, will not update automatically.\nCan't calculate CPU status.",
|
||||||
"edit": "Edit",
|
"edit": "Edit",
|
||||||
"noSavedPrivateKey": "No saved private keys.",
|
"noSavedPrivateKey": "No saved private keys.",
|
||||||
"name": "Name",
|
"name": "Name",
|
||||||
@@ -127,5 +127,25 @@
|
|||||||
"clickSee": "Click here",
|
"clickSee": "Click here",
|
||||||
"feedback": "Feedback",
|
"feedback": "Feedback",
|
||||||
"feedbackOnGithub": "If you have any questions, please feedback on Github.",
|
"feedbackOnGithub": "If you have any questions, please feedback on Github.",
|
||||||
"update": "Update"
|
"update": "Update",
|
||||||
|
"inputDomainHere": "Input Domain here",
|
||||||
|
"dockerNotInstalled": "Docker not installed",
|
||||||
|
"invalidVersion": "Invalid version",
|
||||||
|
"cmd": "Command",
|
||||||
|
"dockerEmptyRunningItems": "No running container. \nIt may be that the env DOCKER_HOST is not read correctly. You can found it by running `echo $DOCKER_HOST` in terminal.",
|
||||||
|
"dockerEditHost": "Edit DOCKER_HOST",
|
||||||
|
"newContainer": "New container",
|
||||||
|
"dockerImage": "Image",
|
||||||
|
"dockerContainerName": "Container name",
|
||||||
|
"extraArgs": "Extra args",
|
||||||
|
"preview": "Preview",
|
||||||
|
"isBusy": "Is busy now",
|
||||||
|
"imagesList": "Images list",
|
||||||
|
"dockerImagesFmt": "{count} images",
|
||||||
|
"path": "Path",
|
||||||
|
"goto": "Go to",
|
||||||
|
"showDistLogo": "Show distribution logo",
|
||||||
|
"onServerDetailPage": "On server detail page",
|
||||||
|
"addOne": "Add one",
|
||||||
|
"sshTip": "This function is now in the experimental stage. \nPlease report bugs on {url} or join our development."
|
||||||
}
|
}
|
||||||
@@ -41,7 +41,7 @@
|
|||||||
"versionUnknownUpdate": "当前:v1.0.{build}",
|
"versionUnknownUpdate": "当前:v1.0.{build}",
|
||||||
"versionHaveUpdate": "找到新版本:v1.0.{build}, 点击更新",
|
"versionHaveUpdate": "找到新版本:v1.0.{build}, 点击更新",
|
||||||
"second": "秒",
|
"second": "秒",
|
||||||
"updateIntervalEqual0": "你设置为0,服务器状态不会自动刷新。\n你可以手动下拉刷新。",
|
"updateIntervalEqual0": "你设置为0,服务器状态不会自动刷新。\n且不能计算CPU使用情况。",
|
||||||
"edit": "编辑",
|
"edit": "编辑",
|
||||||
"noSavedPrivateKey": "没有已保存的私钥。",
|
"noSavedPrivateKey": "没有已保存的私钥。",
|
||||||
"name": "名称",
|
"name": "名称",
|
||||||
@@ -127,5 +127,25 @@
|
|||||||
"clickSee": "点击查看",
|
"clickSee": "点击查看",
|
||||||
"feedback": "反馈",
|
"feedback": "反馈",
|
||||||
"feedbackOnGithub": "如果你有任何问题,请在GitHub反馈",
|
"feedbackOnGithub": "如果你有任何问题,请在GitHub反馈",
|
||||||
"update": "更新"
|
"update": "更新",
|
||||||
|
"inputDomainHere": "在这里输入域名",
|
||||||
|
"dockerNotInstalled": "Docker未安装",
|
||||||
|
"invalidVersion": "不支持的版本",
|
||||||
|
"cmd": "命令",
|
||||||
|
"dockerEmptyRunningItems": "没有正在运行的容器。\n这可能是因为环境变量 DOCKER_HOST 没有被正确读取。你可以通过在终端内运行 `echo $DOCKER_HOST` 来获取。",
|
||||||
|
"dockerEditHost": "编辑 DOCKER_HOST",
|
||||||
|
"newContainer": "新建容器",
|
||||||
|
"dockerImage": "镜像",
|
||||||
|
"dockerContainerName": "容器名",
|
||||||
|
"extraArgs": "额外参数",
|
||||||
|
"preview": "预览",
|
||||||
|
"isBusy": "当前正忙",
|
||||||
|
"imagesList": "镜像列表",
|
||||||
|
"dockerImagesFmt": "共 {count} 个镜像",
|
||||||
|
"path": "路径",
|
||||||
|
"goto": "前往",
|
||||||
|
"showDistLogo": "显示发行版 Logo",
|
||||||
|
"onServerDetailPage": "在服务器详情页",
|
||||||
|
"addOne": "前去新增",
|
||||||
|
"sshTip": "该功能目前处于测试阶段,请在 {url} 反馈问题,或者加入我们开发。"
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:toolbox/data/provider/app.dart';
|
import 'package:toolbox/data/provider/app.dart';
|
||||||
import 'package:toolbox/data/provider/apt.dart';
|
import 'package:toolbox/data/provider/pkg.dart';
|
||||||
import 'package:toolbox/data/provider/debug.dart';
|
import 'package:toolbox/data/provider/debug.dart';
|
||||||
import 'package:toolbox/data/provider/docker.dart';
|
import 'package:toolbox/data/provider/docker.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
@@ -8,6 +8,7 @@ import 'package:toolbox/data/provider/server.dart';
|
|||||||
import 'package:toolbox/data/provider/sftp_download.dart';
|
import 'package:toolbox/data/provider/sftp_download.dart';
|
||||||
import 'package:toolbox/data/provider/snippet.dart';
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
import 'package:toolbox/data/service/app.dart';
|
import 'package:toolbox/data/service/app.dart';
|
||||||
|
import 'package:toolbox/data/store/docker.dart';
|
||||||
import 'package:toolbox/data/store/private_key.dart';
|
import 'package:toolbox/data/store/private_key.dart';
|
||||||
import 'package:toolbox/data/store/server.dart';
|
import 'package:toolbox/data/store/server.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
@@ -21,7 +22,7 @@ void setupLocatorForServices() {
|
|||||||
|
|
||||||
void setupLocatorForProviders() {
|
void setupLocatorForProviders() {
|
||||||
locator.registerSingleton(AppProvider());
|
locator.registerSingleton(AppProvider());
|
||||||
locator.registerSingleton(AptProvider());
|
locator.registerSingleton(PkgProvider());
|
||||||
locator.registerSingleton(DebugProvider());
|
locator.registerSingleton(DebugProvider());
|
||||||
locator.registerSingleton(DockerProvider());
|
locator.registerSingleton(DockerProvider());
|
||||||
locator.registerSingleton(ServerProvider());
|
locator.registerSingleton(ServerProvider());
|
||||||
@@ -46,6 +47,10 @@ Future<void> setupLocatorForStores() async {
|
|||||||
final snippet = SnippetStore();
|
final snippet = SnippetStore();
|
||||||
await snippet.init(boxName: 'snippet');
|
await snippet.init(boxName: 'snippet');
|
||||||
locator.registerSingleton(snippet);
|
locator.registerSingleton(snippet);
|
||||||
|
|
||||||
|
final docker = DockerStore();
|
||||||
|
await docker.init(boxName: 'docker');
|
||||||
|
locator.registerSingleton(docker);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> setupLocator() async {
|
Future<void> setupLocator() async {
|
||||||
|
|||||||
@@ -6,19 +6,29 @@ import 'package:logging/logging.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/app.dart';
|
import 'package:toolbox/app.dart';
|
||||||
import 'package:toolbox/core/analysis.dart';
|
import 'package:toolbox/core/analysis.dart';
|
||||||
|
import 'package:toolbox/core/persistant_store.dart';
|
||||||
|
import 'package:toolbox/data/model/server/private_key_info.dart';
|
||||||
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
|
import 'package:toolbox/data/model/server/snippet.dart';
|
||||||
import 'package:toolbox/data/provider/app.dart';
|
import 'package:toolbox/data/provider/app.dart';
|
||||||
import 'package:toolbox/data/provider/apt.dart';
|
import 'package:toolbox/data/provider/pkg.dart';
|
||||||
import 'package:toolbox/data/provider/debug.dart';
|
import 'package:toolbox/data/provider/debug.dart';
|
||||||
import 'package:toolbox/data/provider/docker.dart';
|
import 'package:toolbox/data/provider/docker.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/provider/sftp_download.dart';
|
import 'package:toolbox/data/provider/sftp_download.dart';
|
||||||
import 'package:toolbox/data/provider/snippet.dart';
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
|
import 'package:toolbox/data/store/private_key.dart';
|
||||||
|
import 'package:toolbox/data/store/server.dart';
|
||||||
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
|
import 'package:toolbox/data/store/snippet.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
|
|
||||||
Future<void> initApp() async {
|
Future<void> initApp() async {
|
||||||
await Hive.initFlutter();
|
await initHive();
|
||||||
await setupLocator();
|
await setupLocator();
|
||||||
|
await upgradeStore();
|
||||||
|
|
||||||
locator<SnippetProvider>().loadData();
|
locator<SnippetProvider>().loadData();
|
||||||
locator<PrivateKeyProvider>().loadData();
|
locator<PrivateKeyProvider>().loadData();
|
||||||
|
|
||||||
@@ -30,6 +40,27 @@ Future<void> initApp() async {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<void> initHive() async {
|
||||||
|
await Hive.initFlutter();
|
||||||
|
Hive.registerAdapter(SnippetAdapter());
|
||||||
|
Hive.registerAdapter(PrivateKeyInfoAdapter());
|
||||||
|
Hive.registerAdapter(ServerPrivateInfoAdapter());
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> upgradeStore() async {
|
||||||
|
final setting = locator<SettingStore>();
|
||||||
|
final version = setting.storeVersion.fetch();
|
||||||
|
if (version == 0) {
|
||||||
|
final snippet = locator<SnippetStore>();
|
||||||
|
final key = locator<PrivateKeyStore>();
|
||||||
|
final spi = locator<ServerStore>();
|
||||||
|
for (final s in <PersistentStore>[snippet, key, spi]) {
|
||||||
|
await s.box.deleteAll(s.box.keys);
|
||||||
|
}
|
||||||
|
setting.storeVersion.put(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void runInZone(dynamic Function() body) {
|
void runInZone(dynamic Function() body) {
|
||||||
final zoneSpec = ZoneSpecification(
|
final zoneSpec = ZoneSpecification(
|
||||||
print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
|
print: (Zone self, ZoneDelegate parent, Zone zone, String line) {
|
||||||
@@ -65,7 +96,7 @@ Future<void> main() async {
|
|||||||
MultiProvider(
|
MultiProvider(
|
||||||
providers: [
|
providers: [
|
||||||
ChangeNotifierProvider(create: (_) => locator<AppProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<AppProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<AptProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<PkgProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<DebugProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<DebugProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<DockerProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<DockerProvider>()),
|
||||||
ChangeNotifierProvider(create: (_) => locator<ServerProvider>()),
|
ChangeNotifierProvider(create: (_) => locator<ServerProvider>()),
|
||||||
|
|||||||
@@ -1,252 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:provider/provider.dart';
|
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
|
||||||
import 'package:toolbox/core/utils.dart';
|
|
||||||
import 'package:toolbox/data/model/apt/upgrade_pkg_info.dart';
|
|
||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
|
||||||
import 'package:toolbox/data/provider/apt.dart';
|
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
|
||||||
import 'package:toolbox/data/res/url.dart';
|
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
|
||||||
import 'package:toolbox/locator.dart';
|
|
||||||
import 'package:toolbox/view/widget/center_loading.dart';
|
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
|
||||||
import 'package:toolbox/view/widget/two_line_text.dart';
|
|
||||||
import 'package:toolbox/view/widget/url_text.dart';
|
|
||||||
|
|
||||||
class AptManagePage extends StatefulWidget {
|
|
||||||
const AptManagePage(this.spi, {Key? key}) : super(key: key);
|
|
||||||
|
|
||||||
final ServerPrivateInfo spi;
|
|
||||||
|
|
||||||
@override
|
|
||||||
_AptManagePageState createState() => _AptManagePageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _AptManagePageState extends State<AptManagePage>
|
|
||||||
with SingleTickerProviderStateMixin {
|
|
||||||
late MediaQueryData _media;
|
|
||||||
final greyStyle = const TextStyle(color: Colors.grey);
|
|
||||||
final scrollController = ScrollController();
|
|
||||||
final scrollControllerUpdate = ScrollController();
|
|
||||||
final textController = TextEditingController();
|
|
||||||
final _aptProvider = locator<AptProvider>();
|
|
||||||
late S s;
|
|
||||||
|
|
||||||
@override
|
|
||||||
void didChangeDependencies() {
|
|
||||||
super.didChangeDependencies();
|
|
||||||
_media = MediaQuery.of(context);
|
|
||||||
s = S.of(context);
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void dispose() {
|
|
||||||
super.dispose();
|
|
||||||
locator<AptProvider>().clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
void initState() {
|
|
||||||
super.initState();
|
|
||||||
final si = locator<ServerProvider>()
|
|
||||||
.servers
|
|
||||||
.firstWhere((e) => e.info == widget.spi);
|
|
||||||
if (si.client == null) {
|
|
||||||
showSnackBar(context, Text(s.waitConnection));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ignore: prefer_function_declarations_over_variables
|
|
||||||
Function onSubmitted = () {
|
|
||||||
if (textController.text == '') {
|
|
||||||
showRoundDialog(context, s.attention, Text(s.fieldMustNotEmpty), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.ok)),
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
};
|
|
||||||
|
|
||||||
// ignore: prefer_function_declarations_over_variables
|
|
||||||
PwdRequestFunc onPwdRequest = (triedTimes, user) async {
|
|
||||||
if (!mounted) return '';
|
|
||||||
await showRoundDialog(
|
|
||||||
context,
|
|
||||||
triedTimes == 3 ? s.lastTry : (user ?? s.unknown),
|
|
||||||
TextField(
|
|
||||||
controller: textController,
|
|
||||||
keyboardType: TextInputType.visiblePassword,
|
|
||||||
obscureText: true,
|
|
||||||
onSubmitted: (_) => onSubmitted(),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
labelText: s.pwd,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
[
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
},
|
|
||||||
child: Text(s.cancel)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => onSubmitted(),
|
|
||||||
child: Text(
|
|
||||||
s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
)),
|
|
||||||
]);
|
|
||||||
return textController.text.trim();
|
|
||||||
};
|
|
||||||
|
|
||||||
_aptProvider.init(
|
|
||||||
si.client!,
|
|
||||||
si.status.sysVer.dist,
|
|
||||||
() =>
|
|
||||||
scrollController.jumpTo(scrollController.position.maxScrollExtent),
|
|
||||||
() => scrollControllerUpdate
|
|
||||||
.jumpTo(scrollControllerUpdate.positions.last.maxScrollExtent),
|
|
||||||
onPwdRequest);
|
|
||||||
_aptProvider.refreshInstalled();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
centerTitle: true,
|
|
||||||
title: TwoLineText(up: 'Apt', down: widget.spi.name),
|
|
||||||
),
|
|
||||||
body: Consumer<AptProvider>(builder: (_, apt, __) {
|
|
||||||
if (apt.error != null) {
|
|
||||||
return Column(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const Icon(
|
|
||||||
Icons.error,
|
|
||||||
color: Colors.redAccent,
|
|
||||||
size: 37,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 37,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: _media.size.height * 0.4,
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.all(17),
|
|
||||||
child: RoundRectCard(
|
|
||||||
SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.all(17),
|
|
||||||
child: Text(
|
|
||||||
apt.error!,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (apt.updateLog == null && apt.upgradeable == null) {
|
|
||||||
return centerLoading;
|
|
||||||
}
|
|
||||||
if (apt.updateLog != null && apt.upgradeable == null) {
|
|
||||||
return SizedBox(
|
|
||||||
height: _media.size.height -
|
|
||||||
_media.padding.top -
|
|
||||||
_media.padding.bottom,
|
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: const BoxConstraints.expand(),
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.all(18),
|
|
||||||
controller: scrollControllerUpdate,
|
|
||||||
child: Text(apt.updateLog!),
|
|
||||||
),
|
|
||||||
));
|
|
||||||
}
|
|
||||||
return ListView(
|
|
||||||
padding: const EdgeInsets.all(13),
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(17),
|
|
||||||
child: UrlText(
|
|
||||||
text:
|
|
||||||
'${s.experimentalFeature}\n${s.reportBugsOnGithubIssue(issueUrl)}',
|
|
||||||
replace: 'Github Issue',
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
_buildUpdatePanel(apt)
|
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildUpdatePanel(AptProvider apt) {
|
|
||||||
if (apt.upgradeable!.isEmpty) {
|
|
||||||
return ListTile(
|
|
||||||
title: Text(
|
|
||||||
s.noUpdateAvailable,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
subtitle: const Text('>_<', textAlign: TextAlign.center),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
ExpansionTile(
|
|
||||||
title: Text(s.foundNUpdate(apt.upgradeable!.length)),
|
|
||||||
subtitle: Text(
|
|
||||||
apt.upgradeable!.map((e) => e.package).join(', '),
|
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
style: greyStyle,
|
|
||||||
),
|
|
||||||
children: apt.upgradeLog == null
|
|
||||||
? [
|
|
||||||
TextButton(
|
|
||||||
child: Text(s.updateAll),
|
|
||||||
onPressed: () {
|
|
||||||
apt.upgrade();
|
|
||||||
}),
|
|
||||||
SizedBox(
|
|
||||||
height: _media.size.height * 0.73,
|
|
||||||
child: ListView(
|
|
||||||
controller: scrollController,
|
|
||||||
children: apt.upgradeable!
|
|
||||||
.map((e) => _buildUpdateItem(e, apt))
|
|
||||||
.toList()),
|
|
||||||
)
|
|
||||||
]
|
|
||||||
: [
|
|
||||||
SizedBox(
|
|
||||||
height: _media.size.height * 0.7,
|
|
||||||
child: ConstrainedBox(
|
|
||||||
constraints: const BoxConstraints.expand(),
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
padding: const EdgeInsets.all(18),
|
|
||||||
controller: scrollController,
|
|
||||||
child: Text(apt.upgradeLog!),
|
|
||||||
),
|
|
||||||
))
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildUpdateItem(UpgradePkgInfo info, AptProvider apt) {
|
|
||||||
return ListTile(
|
|
||||||
title: Text(info.package),
|
|
||||||
subtitle: Text(
|
|
||||||
'${info.nowVersion} -> ${info.newVersion}',
|
|
||||||
style: greyStyle,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,10 +21,10 @@ const backupFormatVersion = 1;
|
|||||||
class BackupPage extends StatelessWidget {
|
class BackupPage extends StatelessWidget {
|
||||||
BackupPage({Key? key}) : super(key: key);
|
BackupPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
final setting = locator<SettingStore>();
|
final _setting = locator<SettingStore>();
|
||||||
final server = locator<ServerStore>();
|
final _server = locator<ServerStore>();
|
||||||
final snippet = locator<SnippetStore>();
|
final _snippet = locator<SnippetStore>();
|
||||||
final privateKey = locator<PrivateKeyStore>();
|
final _privateKey = locator<PrivateKeyStore>();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -32,7 +32,7 @@ class BackupPage extends StatelessWidget {
|
|||||||
final s = S.of(context);
|
final s = S.of(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(s.importAndExport, style: size18),
|
title: Text(s.importAndExport, style: textSize18),
|
||||||
),
|
),
|
||||||
body: Center(
|
body: Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -54,8 +54,12 @@ class BackupPage extends StatelessWidget {
|
|||||||
const SizedBox(height: 7),
|
const SizedBox(height: 7),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 7),
|
const SizedBox(height: 7),
|
||||||
_buildCard(s.backup, Icons.file_upload, media,
|
_buildCard(
|
||||||
() => _showExportDialog(context, s))
|
s.backup,
|
||||||
|
Icons.file_upload,
|
||||||
|
media,
|
||||||
|
() => _showExportDialog(context, s),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
@@ -91,60 +95,66 @@ class BackupPage extends StatelessWidget {
|
|||||||
|
|
||||||
Future<void> _showExportDialog(BuildContext context, S s) async {
|
Future<void> _showExportDialog(BuildContext context, S s) async {
|
||||||
final exportFieldController = TextEditingController()
|
final exportFieldController = TextEditingController()
|
||||||
..text = _diyEncrtpt(json.encode(Backup(
|
..text = _diyEncrtpt(
|
||||||
backupFormatVersion,
|
json.encode(
|
||||||
DateTime.now().toString().split('.').first,
|
Backup(
|
||||||
server.fetch(),
|
backupFormatVersion,
|
||||||
snippet.fetch(),
|
DateTime.now().toString().split('.').first,
|
||||||
privateKey.fetch(),
|
_server.fetch(),
|
||||||
setting.primaryColor.fetch() ?? Colors.pinkAccent.value,
|
_snippet.fetch(),
|
||||||
setting.serverStatusUpdateInterval.fetch() ?? 2,
|
_privateKey.fetch(),
|
||||||
setting.launchPage.fetch() ?? 0,
|
_setting.primaryColor.fetch() ?? Colors.pinkAccent.value,
|
||||||
)));
|
_setting.serverStatusUpdateInterval.fetch() ?? 2,
|
||||||
await showRoundDialog(
|
_setting.launchPage.fetch() ?? 0,
|
||||||
context,
|
|
||||||
s.export,
|
|
||||||
TextField(
|
|
||||||
decoration: const InputDecoration(
|
|
||||||
labelText: 'JSON',
|
|
||||||
),
|
),
|
||||||
maxLines: 7,
|
|
||||||
controller: exportFieldController,
|
|
||||||
),
|
),
|
||||||
[
|
);
|
||||||
TextButton(
|
await showRoundDialog(
|
||||||
child: Text(s.copy),
|
context,
|
||||||
onPressed: () {
|
s.export,
|
||||||
Clipboard.setData(
|
TextField(
|
||||||
ClipboardData(text: exportFieldController.text));
|
decoration: const InputDecoration(
|
||||||
Navigator.pop(context);
|
labelText: 'JSON',
|
||||||
},
|
),
|
||||||
),
|
maxLines: 7,
|
||||||
]);
|
controller: exportFieldController,
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
child: Text(s.copy),
|
||||||
|
onPressed: () {
|
||||||
|
Clipboard.setData(ClipboardData(text: exportFieldController.text));
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _showImportDialog(BuildContext context, S s) async {
|
Future<void> _showImportDialog(BuildContext context, S s) async {
|
||||||
final importFieldController = TextEditingController();
|
final importFieldController = TextEditingController();
|
||||||
await showRoundDialog(
|
await showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.import,
|
s.import,
|
||||||
TextField(
|
TextField(
|
||||||
decoration: const InputDecoration(
|
decoration: const InputDecoration(
|
||||||
labelText: 'JSON',
|
labelText: 'JSON',
|
||||||
),
|
|
||||||
maxLines: 3,
|
|
||||||
controller: importFieldController,
|
|
||||||
),
|
),
|
||||||
[
|
maxLines: 3,
|
||||||
TextButton(
|
controller: importFieldController,
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
),
|
||||||
child: Text(s.cancel)),
|
[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () async =>
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
await _import(importFieldController.text.trim(), context, s),
|
child: Text(s.cancel),
|
||||||
child: const Text('GO'),
|
),
|
||||||
)
|
TextButton(
|
||||||
]);
|
onPressed: () async =>
|
||||||
|
await _import(importFieldController.text.trim(), context, s),
|
||||||
|
child: const Text('GO'),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _import(String text, BuildContext context, S s) async {
|
Future<void> _import(String text, BuildContext context, S s) async {
|
||||||
@@ -165,32 +175,36 @@ class BackupPage extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
await showRoundDialog(
|
await showRoundDialog(
|
||||||
context, s.attention, Text(s.restoreSureWithDate(backup.date)), [
|
context,
|
||||||
TextButton(
|
s.attention,
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
Text(s.restoreSureWithDate(backup.date)),
|
||||||
child: Text(s.cancel),
|
[
|
||||||
),
|
TextButton(
|
||||||
TextButton(
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
onPressed: () async {
|
child: Text(s.cancel),
|
||||||
for (final s in backup.snippets) {
|
),
|
||||||
snippet.put(s);
|
TextButton(
|
||||||
}
|
onPressed: () async {
|
||||||
for (final s in backup.spis) {
|
for (final s in backup.snippets) {
|
||||||
server.put(s);
|
_snippet.put(s);
|
||||||
}
|
}
|
||||||
for (final s in backup.keys) {
|
for (final s in backup.spis) {
|
||||||
privateKey.put(s);
|
_server.put(s);
|
||||||
}
|
}
|
||||||
setting.primaryColor.put(backup.primaryColor);
|
for (final s in backup.keys) {
|
||||||
setting.serverStatusUpdateInterval
|
_privateKey.put(s);
|
||||||
.put(backup.serverStatusUpdateInterval);
|
}
|
||||||
setting.launchPage.put(backup.launchPage);
|
_setting.primaryColor.put(backup.primaryColor);
|
||||||
Navigator.of(context).pop();
|
_setting.serverStatusUpdateInterval
|
||||||
showSnackBar(context, Text(s.restoreSuccess));
|
.put(backup.serverStatusUpdateInterval);
|
||||||
},
|
_setting.launchPage.put(backup.launchPage);
|
||||||
child: Text(s.ok),
|
Navigator.of(context).pop();
|
||||||
),
|
showSnackBar(context, Text(s.restoreSuccess));
|
||||||
]);
|
},
|
||||||
|
child: Text(s.ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showSnackBar(context, Text(s.invalidJson));
|
showSnackBar(context, Text(s.invalidJson));
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
|
||||||
import 'package:clipboard/clipboard.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
@@ -21,7 +21,7 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
late TextEditingController _textEditingControllerResult;
|
late TextEditingController _textEditingControllerResult;
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
late ThemeData _theme;
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
int _typeOptionIndex = 0;
|
int _typeOptionIndex = 0;
|
||||||
|
|
||||||
@@ -37,34 +37,36 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_theme = Theme.of(context);
|
_theme = Theme.of(context);
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: GestureDetector(
|
body: SingleChildScrollView(
|
||||||
child: SingleChildScrollView(
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
controller: ScrollController(),
|
||||||
controller: ScrollController(),
|
child: Column(
|
||||||
child: Column(children: [
|
children: [
|
||||||
const SizedBox(height: 13),
|
const SizedBox(height: 13),
|
||||||
_buildInputTop(),
|
_buildInputTop(),
|
||||||
_buildTypeOption(),
|
_buildTypeOption(),
|
||||||
_buildResult(),
|
_buildResult(),
|
||||||
])),
|
],
|
||||||
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
try {
|
try {
|
||||||
_textEditingControllerResult.text = doConvert();
|
_textEditingControllerResult.text = doConvert();
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
showSnackBar(context, Text('Error: \n$e'));
|
showSnackBar(context, Text('Error: \n$e'));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
tooltip: s.convert,
|
tooltip: _s.convert,
|
||||||
|
heroTag: 'convert fab',
|
||||||
child: const Icon(Icons.send),
|
child: const Icon(Icons.send),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -82,21 +84,20 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
case 3:
|
case 3:
|
||||||
return Uri.decodeFull(text);
|
return Uri.decodeFull(text);
|
||||||
default:
|
default:
|
||||||
return s.unkownConvertMode;
|
return _s.unkownConvertMode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildInputTop() {
|
Widget _buildInputTop() {
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: _media.size.height * 0.33,
|
height: _media.size.height * 0.33,
|
||||||
child: buildInput(context, _textEditingController,
|
child: buildInput(context, _textEditingController),
|
||||||
onSubmitted: (_) => _textEditingControllerResult.text = doConvert()),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildTypeOption() {
|
Widget _buildTypeOption() {
|
||||||
final decode = s.decode;
|
final decode = _s.decode;
|
||||||
final encode = s.encode;
|
final encode = _s.encode;
|
||||||
final List<String> typeOption = [
|
final List<String> typeOption = [
|
||||||
'Base64 $decode',
|
'Base64 $decode',
|
||||||
'Base64 $encode',
|
'Base64 $encode',
|
||||||
@@ -112,7 +113,7 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
TextButton(
|
TextButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
||||||
child: Icon(Icons.change_circle, semanticLabel: s.upsideDown),
|
child: Icon(Icons.change_circle, semanticLabel: _s.upsideDown),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final temp = _textEditingController.text;
|
final temp = _textEditingController.text;
|
||||||
_textEditingController.text = _textEditingControllerResult.text;
|
_textEditingController.text = _textEditingControllerResult.text;
|
||||||
@@ -121,12 +122,15 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
foregroundColor: MaterialStateProperty.all(primaryColor),
|
||||||
child: Icon(Icons.copy, semanticLabel: s.copy),
|
),
|
||||||
onPressed: () => FlutterClipboard.copy(
|
child: Icon(Icons.copy, semanticLabel: _s.copy),
|
||||||
_textEditingControllerResult.text == ''
|
onPressed: () => Clipboard.setData(
|
||||||
? ' '
|
ClipboardData(
|
||||||
: _textEditingControllerResult.text),
|
text: _textEditingControllerResult.text == ''
|
||||||
|
? ' '
|
||||||
|
: _textEditingControllerResult.text),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -136,15 +140,17 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Text(typeOption[_typeOptionIndex],
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
fontWeight: FontWeight.w500,
|
|
||||||
color: primaryColor)),
|
|
||||||
Text(
|
Text(
|
||||||
s.currentMode,
|
typeOption[_typeOptionIndex],
|
||||||
|
textScaleFactor: 1.0,
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 16.0,
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
color: primaryColor),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
_s.currentMode,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
style: const TextStyle(fontSize: 9.0, color: Colors.grey),
|
style: const TextStyle(fontSize: 9.0, color: Colors.grey),
|
||||||
@@ -153,15 +159,17 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
children: typeOption
|
children: typeOption
|
||||||
.map((e) => ListTile(
|
.map(
|
||||||
title: Text(
|
(e) => ListTile(
|
||||||
e,
|
title: Text(
|
||||||
style: TextStyle(
|
e,
|
||||||
color:
|
style: TextStyle(
|
||||||
_theme.textTheme.bodyText2!.color!.withAlpha(177)),
|
color: _theme.textTheme.bodyMedium?.color?.withAlpha(177),
|
||||||
),
|
),
|
||||||
trailing: _buildRadio(typeOption.indexOf(e)),
|
),
|
||||||
))
|
trailing: _buildRadio(typeOption.indexOf(e)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -180,7 +188,7 @@ class _ConvertPageState extends State<ConvertPage>
|
|||||||
groupValue: _typeOptionIndex,
|
groupValue: _typeOptionIndex,
|
||||||
onChanged: (int? value) {
|
onChanged: (int? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_typeOptionIndex = value!;
|
_typeOptionIndex = value ?? 0;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -13,8 +13,10 @@ class _DebugPageState extends State<DebugPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar:
|
appBar: AppBar(
|
||||||
AppBar(title: const Text('App log'), backgroundColor: Colors.black),
|
title: const Text('Logs'),
|
||||||
|
backgroundColor: Colors.black,
|
||||||
|
),
|
||||||
body: _buildTerminal(context),
|
body: _buildTerminal(context),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
);
|
);
|
||||||
@@ -31,12 +33,15 @@ class _DebugPageState extends State<DebugPage> {
|
|||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
child: Consumer<DebugProvider>(builder: (_, debug, __) {
|
child: Consumer<DebugProvider>(
|
||||||
return Column(
|
builder: (_, debug, __) {
|
||||||
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: debug.widgets);
|
children: debug.widgets,
|
||||||
}),
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
@@ -7,7 +6,10 @@ import 'package:toolbox/data/model/docker/ps.dart';
|
|||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/data/provider/docker.dart';
|
import 'package:toolbox/data/provider/docker.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/res/error.dart';
|
||||||
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/data/res/url.dart';
|
import 'package:toolbox/data/res/url.dart';
|
||||||
|
import 'package:toolbox/data/store/docker.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/widget/center_loading.dart';
|
import 'package:toolbox/view/widget/center_loading.dart';
|
||||||
@@ -25,8 +27,8 @@ class DockerManagePage extends StatefulWidget {
|
|||||||
|
|
||||||
class _DockerManagePageState extends State<DockerManagePage> {
|
class _DockerManagePageState extends State<DockerManagePage> {
|
||||||
final _docker = locator<DockerProvider>();
|
final _docker = locator<DockerProvider>();
|
||||||
final greyTextStyle = const TextStyle(color: Colors.grey);
|
final _textController = TextEditingController();
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
@@ -37,7 +39,7 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -48,79 +50,350 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
.firstWhere((element) => element.info == widget.spi)
|
.firstWhere((element) => element.info == widget.spi)
|
||||||
.client;
|
.client;
|
||||||
if (client == null) {
|
if (client == null) {
|
||||||
showSnackBar(context, Text(s.noClient));
|
showSnackBar(context, Text(_s.noClient));
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_docker.init(client, widget.spi.user);
|
_docker.init(client, widget.spi.user, onPwdRequest, widget.spi.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
centerTitle: true,
|
|
||||||
title: TwoLineText(up: 'Docker', down: widget.spi.name),
|
|
||||||
),
|
|
||||||
body: _buildMain(),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildMain() {
|
|
||||||
return Consumer<DockerProvider>(builder: (_, docker, __) {
|
return Consumer<DockerProvider>(builder: (_, docker, __) {
|
||||||
final running = docker.items;
|
return Scaffold(
|
||||||
if (docker.error != null && running == null) {
|
appBar: AppBar(
|
||||||
return SizedBox.expand(
|
centerTitle: true,
|
||||||
child: Column(
|
title: TwoLineText(up: 'Docker', down: widget.spi.name),
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
actions: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
IconButton(
|
||||||
children: [
|
onPressed: () => docker.refresh(),
|
||||||
const Icon(
|
icon: const Icon(Icons.refresh),
|
||||||
Icons.error,
|
)
|
||||||
size: 37,
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(height: 27),
|
body: _buildMain(docker),
|
||||||
Text(docker.error!),
|
floatingActionButton: _buildFAB(docker),
|
||||||
const SizedBox(height: 27),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.all(17),
|
|
||||||
child: _buildSolution(docker.error!),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (running == null) {
|
|
||||||
_docker.refresh();
|
|
||||||
return centerLoading;
|
|
||||||
}
|
|
||||||
return ListView(
|
|
||||||
padding: const EdgeInsets.all(7),
|
|
||||||
children: [
|
|
||||||
_buildVersion(
|
|
||||||
docker.edition ?? s.unknown, docker.version ?? s.unknown),
|
|
||||||
_buildPsItems(running, docker)
|
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSolution(String err) {
|
Widget _buildFAB(DockerProvider docker) {
|
||||||
switch (err) {
|
return FloatingActionButton(
|
||||||
case 'docker not found':
|
onPressed: () async => await _showAddFAB(docker),
|
||||||
|
child: const Icon(Icons.add),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showAddFAB(DockerProvider docker) async {
|
||||||
|
final imageCtrl = TextEditingController();
|
||||||
|
final nameCtrl = TextEditingController();
|
||||||
|
final argsCtrl = TextEditingController();
|
||||||
|
await showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.newContainer,
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: _s.dockerImage, hintText: 'ubuntu:22.10'),
|
||||||
|
controller: imageCtrl,
|
||||||
|
autocorrect: false,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
controller: nameCtrl,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: _s.dockerContainerName, hintText: 'ubuntu22'),
|
||||||
|
autocorrect: false,
|
||||||
|
),
|
||||||
|
TextField(
|
||||||
|
keyboardType: TextInputType.text,
|
||||||
|
controller: argsCtrl,
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: _s.extraArgs,
|
||||||
|
hintText: '-p 2222:22 -v ~/.xxx/:/xxx'),
|
||||||
|
autocorrect: false,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
await _showAddCmdPreview(
|
||||||
|
_buildAddCmd(
|
||||||
|
imageCtrl.text.trim(),
|
||||||
|
nameCtrl.text.trim(),
|
||||||
|
argsCtrl.text.trim(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(_s.ok),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showAddCmdPreview(String cmd) async {
|
||||||
|
await showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.preview,
|
||||||
|
Text(cmd),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
final result = await _docker.run(cmd);
|
||||||
|
if (result != null) {
|
||||||
|
showSnackBar(context, Text(getErrMsg(result) ?? _s.unknownError));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: Text(_s.run),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
String _buildAddCmd(String image, String name, String args) {
|
||||||
|
var suffix = '';
|
||||||
|
if (args.isEmpty) {
|
||||||
|
suffix = image;
|
||||||
|
} else {
|
||||||
|
suffix = '$args $image';
|
||||||
|
}
|
||||||
|
if (name.isEmpty) {
|
||||||
|
return 'docker run -itd $suffix';
|
||||||
|
}
|
||||||
|
return 'docker run -itd --name $name $suffix';
|
||||||
|
}
|
||||||
|
|
||||||
|
String? getErrMsg(DockerErr err) {
|
||||||
|
switch (err.type) {
|
||||||
|
default:
|
||||||
|
return err.message;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSubmitted() {
|
||||||
|
if (_textController.text == '') {
|
||||||
|
showRoundDialog(context, _s.attention, Text(_s.fieldMustNotEmpty), [
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(), child: Text(_s.ok)),
|
||||||
|
]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> onPwdRequest() async {
|
||||||
|
if (!mounted) return '';
|
||||||
|
await showRoundDialog(
|
||||||
|
context,
|
||||||
|
widget.spi.user,
|
||||||
|
TextField(
|
||||||
|
controller: _textController,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
obscureText: true,
|
||||||
|
onSubmitted: (_) => onSubmitted(),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: _s.pwd,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => onSubmitted(),
|
||||||
|
child: Text(
|
||||||
|
_s.ok,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return _textController.text.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMain(DockerProvider docker) {
|
||||||
|
final running = docker.items;
|
||||||
|
if (docker.error != null && running == null) {
|
||||||
|
return SizedBox.expand(
|
||||||
|
child: Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.error,
|
||||||
|
size: 37,
|
||||||
|
),
|
||||||
|
const SizedBox(height: 27),
|
||||||
|
_buildErr(docker.error!),
|
||||||
|
const SizedBox(height: 27),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(17),
|
||||||
|
child: _buildSolution(docker.error!),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (running == null) {
|
||||||
|
_docker.refresh();
|
||||||
|
return centerLoading;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ListView(
|
||||||
|
padding: const EdgeInsets.all(7),
|
||||||
|
children: [
|
||||||
|
_buildLoading(docker),
|
||||||
|
_buildVersion(
|
||||||
|
docker.edition ?? _s.unknown, docker.version ?? _s.unknown),
|
||||||
|
_buildPsItems(running, docker),
|
||||||
|
_buildImages(docker),
|
||||||
|
_buildEditHost(running, docker),
|
||||||
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildImages(DockerProvider docker) {
|
||||||
|
if (docker.images == null) {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
|
return ExpansionTile(
|
||||||
|
title: Text(_s.imagesList),
|
||||||
|
subtitle: Text(
|
||||||
|
_s.dockerImagesFmt(docker.images!.length),
|
||||||
|
style: grey,
|
||||||
|
),
|
||||||
|
children: docker.images!
|
||||||
|
.map(
|
||||||
|
(e) => ListTile(
|
||||||
|
title: Text(e.repo),
|
||||||
|
subtitle: Text('${e.tag} - ${e.size}'),
|
||||||
|
trailing: IconButton(
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
onPressed: () async {
|
||||||
|
final result = await _docker.run('docker rmi ${e.id} -f');
|
||||||
|
if (result != null) {
|
||||||
|
showSnackBar(
|
||||||
|
context, Text(getErrMsg(result) ?? _s.unknownError));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildLoading(DockerProvider docker) {
|
||||||
|
if (!docker.isBusy) return const SizedBox();
|
||||||
|
final haveLog = docker.runLog != null;
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.all(17),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const Center(
|
||||||
|
child: CircularProgressIndicator(),
|
||||||
|
),
|
||||||
|
haveLog ? const SizedBox(height: 17) : const SizedBox(),
|
||||||
|
haveLog ? Text(docker.runLog!) : const SizedBox()
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildEditHost(List<DockerPsItem> running, DockerProvider docker) {
|
||||||
|
if (running.isNotEmpty) return const SizedBox();
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(17, 17, 17, 0),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
|
_s.dockerEmptyRunningItems,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => _showEditHostDialog(docker),
|
||||||
|
child: Text(_s.dockerEditHost),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _showEditHostDialog(DockerProvider docker) async {
|
||||||
|
await showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.dockerEditHost,
|
||||||
|
TextField(
|
||||||
|
maxLines: 1,
|
||||||
|
autocorrect: false,
|
||||||
|
controller:
|
||||||
|
TextEditingController(text: 'unix:///run/user/1000/docker.sock'),
|
||||||
|
onSubmitted: (value) {
|
||||||
|
locator<DockerStore>().setDockerHost(widget.spi.id, value.trim());
|
||||||
|
docker.refresh();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildErr(DockerErr err) {
|
||||||
|
var errStr = '';
|
||||||
|
switch (err.type) {
|
||||||
|
case DockerErrType.noClient:
|
||||||
|
errStr = _s.noClient;
|
||||||
|
break;
|
||||||
|
case DockerErrType.notInstalled:
|
||||||
|
errStr = _s.dockerNotInstalled;
|
||||||
|
break;
|
||||||
|
case DockerErrType.invalidVersion:
|
||||||
|
errStr = _s.invalidVersion;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errStr = err.message ?? _s.unknown;
|
||||||
|
}
|
||||||
|
return Text(errStr);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildSolution(DockerErr err) {
|
||||||
|
switch (err.type) {
|
||||||
|
case DockerErrType.notInstalled:
|
||||||
return UrlText(
|
return UrlText(
|
||||||
text: s.installDockerWithUrl,
|
text: _s.installDockerWithUrl,
|
||||||
replace: s.install,
|
replace: _s.install,
|
||||||
);
|
);
|
||||||
case 'no client':
|
case DockerErrType.noClient:
|
||||||
return Text(s.waitConnection);
|
return Text(_s.waitConnection);
|
||||||
case 'invalid version':
|
case DockerErrType.invalidVersion:
|
||||||
return UrlText(
|
return UrlText(
|
||||||
text: s.invalidVersionHelp(issueUrl),
|
text: _s.invalidVersionHelp(issueUrl),
|
||||||
replace: 'Github',
|
replace: 'Github',
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return Text(s.unknownError);
|
return Text(_s.unknownError);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -136,65 +409,52 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
|
|
||||||
Widget _buildPsItems(List<DockerPsItem> running, DockerProvider docker) {
|
Widget _buildPsItems(List<DockerPsItem> running, DockerProvider docker) {
|
||||||
return ExpansionTile(
|
return ExpansionTile(
|
||||||
title: Text(s.containerStatus),
|
title: Text(_s.containerStatus),
|
||||||
subtitle: Text(_buildSubtitle(running), style: greyTextStyle),
|
subtitle: Text(_buildSubtitle(running), style: grey),
|
||||||
children: running.map((item) {
|
children: running.map(
|
||||||
return ListTile(
|
(item) {
|
||||||
title: Text(item.image),
|
return ListTile(
|
||||||
subtitle: Text(item.status),
|
title: Text(item.image),
|
||||||
trailing: docker.isBusy
|
subtitle: Text(item.status),
|
||||||
? const CircularProgressIndicator()
|
trailing:
|
||||||
: _buildMoreBtn(item.running, item.containerId),
|
_buildMoreBtn(item.running, item.containerId, docker.isBusy),
|
||||||
);
|
);
|
||||||
}).toList(),
|
},
|
||||||
|
).toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMoreBtn(bool running, String containerId) {
|
Widget _buildMoreBtn(bool running, String containerId, bool busy) {
|
||||||
final item = running ? DockerMenuItems.stop : DockerMenuItems.start;
|
final item = running ? DockerMenuItems.stop : DockerMenuItems.start;
|
||||||
return DropdownButtonHideUnderline(
|
return buildPopuopMenu(
|
||||||
child: DropdownButton2(
|
items: [
|
||||||
customButton: const Padding(
|
PopupMenuItem<DropdownBtnItem>(
|
||||||
padding: EdgeInsets.only(left: 7),
|
value: item,
|
||||||
child: Icon(
|
child: item.build,
|
||||||
Icons.more_vert,
|
|
||||||
size: 17,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
customItemsHeight: 8,
|
PopupMenuItem<DropdownBtnItem>(
|
||||||
items: [
|
value: DockerMenuItems.rm,
|
||||||
DropdownMenuItem<DropdownBtnItem>(
|
child: DockerMenuItems.rm.build,
|
||||||
value: item,
|
|
||||||
child: item.build,
|
|
||||||
),
|
|
||||||
DropdownMenuItem<DropdownBtnItem>(
|
|
||||||
value: DockerMenuItems.rm,
|
|
||||||
child: DockerMenuItems.rm.build,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
final item = value as DropdownBtnItem;
|
|
||||||
switch (item) {
|
|
||||||
case DockerMenuItems.rm:
|
|
||||||
_docker.delete(containerId);
|
|
||||||
break;
|
|
||||||
case DockerMenuItems.start:
|
|
||||||
_docker.start(containerId);
|
|
||||||
break;
|
|
||||||
case DockerMenuItems.stop:
|
|
||||||
_docker.stop(containerId);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
itemHeight: 37,
|
|
||||||
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
|
||||||
dropdownWidth: 133,
|
|
||||||
dropdownDecoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(7),
|
|
||||||
),
|
),
|
||||||
dropdownElevation: 8,
|
],
|
||||||
offset: const Offset(0, 8),
|
onSelected: (value) {
|
||||||
),
|
if (busy) {
|
||||||
|
showSnackBar(context, Text(_s.isBusy));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final item = value as DropdownBtnItem;
|
||||||
|
switch (item) {
|
||||||
|
case DockerMenuItems.rm:
|
||||||
|
_docker.delete(containerId);
|
||||||
|
break;
|
||||||
|
case DockerMenuItems.start:
|
||||||
|
_docker.start(containerId);
|
||||||
|
break;
|
||||||
|
case DockerMenuItems.stop:
|
||||||
|
_docker.stop(containerId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,8 +462,8 @@ class _DockerManagePageState extends State<DockerManagePage> {
|
|||||||
final runningCount = running.where((element) => element.running).length;
|
final runningCount = running.where((element) => element.running).length;
|
||||||
final stoped = running.length - runningCount;
|
final stoped = running.length - runningCount;
|
||||||
if (stoped == 0) {
|
if (stoped == 0) {
|
||||||
return s.dockerStatusRunningFmt(runningCount);
|
return _s.dockerStatusRunningFmt(runningCount);
|
||||||
}
|
}
|
||||||
return s.dockerStatusRunningAndStoppedFmt(runningCount, stoped);
|
return _s.dockerStatusRunningAndStoppedFmt(runningCount, stoped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import 'package:after_layout/after_layout.dart';
|
import 'package:after_layout/after_layout.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_advanced_drawer/flutter_advanced_drawer.dart';
|
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:toolbox/core/analysis.dart';
|
import 'package:toolbox/core/analysis.dart';
|
||||||
import 'package:toolbox/core/build_mode.dart';
|
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/core/update.dart';
|
import 'package:toolbox/core/update.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
@@ -13,7 +11,7 @@ import 'package:toolbox/data/provider/server.dart';
|
|||||||
import 'package:toolbox/data/res/build_data.dart';
|
import 'package:toolbox/data/res/build_data.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/font_style.dart';
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/data/res/icon/common.dart';
|
import 'package:toolbox/data/res/icon.dart';
|
||||||
import 'package:toolbox/data/res/tab.dart';
|
import 'package:toolbox/data/res/tab.dart';
|
||||||
import 'package:toolbox/data/res/url.dart';
|
import 'package:toolbox/data/res/url.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
@@ -41,15 +39,13 @@ class MyHomePage extends StatefulWidget {
|
|||||||
class _MyHomePageState extends State<MyHomePage>
|
class _MyHomePageState extends State<MyHomePage>
|
||||||
with
|
with
|
||||||
AutomaticKeepAliveClientMixin,
|
AutomaticKeepAliveClientMixin,
|
||||||
SingleTickerProviderStateMixin,
|
|
||||||
AfterLayoutMixin,
|
AfterLayoutMixin,
|
||||||
WidgetsBindingObserver {
|
WidgetsBindingObserver {
|
||||||
late final ServerProvider _serverProvider;
|
late final ServerProvider _serverProvider;
|
||||||
late final PageController _pageController;
|
late final PageController _pageController;
|
||||||
late final AdvancedDrawerController _advancedDrawerController;
|
|
||||||
late int _selectIndex;
|
late int _selectIndex;
|
||||||
late double _width;
|
late double _width;
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -58,13 +54,12 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
_selectIndex = locator<SettingStore>().launchPage.fetch()!;
|
_selectIndex = locator<SettingStore>().launchPage.fetch()!;
|
||||||
_pageController = PageController(initialPage: _selectIndex);
|
_pageController = PageController(initialPage: _selectIndex);
|
||||||
_advancedDrawerController = AdvancedDrawerController();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
_width = MediaQuery.of(context).size.width;
|
_width = MediaQuery.of(context).size.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,6 +67,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
void dispose() {
|
void dispose() {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
|
_serverProvider.closeServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -89,79 +85,34 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return WillPopScope(
|
return Scaffold(
|
||||||
child: _buildMain(context),
|
drawer: _buildDrawer(),
|
||||||
onWillPop: () {
|
appBar: AppBar(
|
||||||
if (_advancedDrawerController.value.visible) {
|
title: Text(tabTitleName(context, _selectIndex), style: textSize18),
|
||||||
_advancedDrawerController.hideDrawer();
|
actions: [
|
||||||
return Future.value(false);
|
IconButton(
|
||||||
}
|
icon: const Icon(Icons.developer_mode, size: 23),
|
||||||
return Future.value(true);
|
tooltip: _s.debug,
|
||||||
});
|
onPressed: () =>
|
||||||
}
|
AppRoute(const DebugPage(), 'Debug Page').go(context),
|
||||||
|
|
||||||
Widget _buildMain(BuildContext context) {
|
|
||||||
return AdvancedDrawer(
|
|
||||||
controller: _advancedDrawerController,
|
|
||||||
animationCurve: Curves.easeInOut,
|
|
||||||
animationDuration: const Duration(milliseconds: 300),
|
|
||||||
animateChildDecoration: true,
|
|
||||||
rtlOpening: false,
|
|
||||||
childDecoration: const BoxDecoration(
|
|
||||||
// NOTICE: Uncomment if you want to add shadow behind the page.
|
|
||||||
// Keep in mind that it may cause animation jerks.
|
|
||||||
// boxShadow: <BoxShadow>[
|
|
||||||
// BoxShadow(
|
|
||||||
// color: Colors.black12,
|
|
||||||
// blurRadius: 0.0,
|
|
||||||
// ),
|
|
||||||
// ],
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
|
||||||
),
|
|
||||||
drawer: _buildDrawer(),
|
|
||||||
child: Scaffold(
|
|
||||||
appBar: AppBar(
|
|
||||||
title: Text(tabTitleName(context, _selectIndex), style: size18),
|
|
||||||
actions: [
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(Icons.developer_mode, size: 23),
|
|
||||||
tooltip: s.debug,
|
|
||||||
onPressed: () =>
|
|
||||||
AppRoute(const DebugPage(), 'Debug Page').go(context),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
leading: IconButton(
|
|
||||||
onPressed: () => _advancedDrawerController.showDrawer(),
|
|
||||||
icon: ValueListenableBuilder<AdvancedDrawerValue>(
|
|
||||||
valueListenable: _advancedDrawerController,
|
|
||||||
builder: (_, value, __) {
|
|
||||||
return AnimatedSwitcher(
|
|
||||||
duration: const Duration(milliseconds: 250),
|
|
||||||
child: Icon(
|
|
||||||
value.visible ? Icons.clear : Icons.menu,
|
|
||||||
key: ValueKey<bool>(value.visible),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
body: PageView(
|
],
|
||||||
physics: const ClampingScrollPhysics(),
|
),
|
||||||
controller: _pageController,
|
body: PageView(
|
||||||
onPageChanged: (i) {
|
physics: const ClampingScrollPhysics(),
|
||||||
FocusScope.of(context).unfocus();
|
controller: _pageController,
|
||||||
_selectIndex = i;
|
onPageChanged: (i) {
|
||||||
setState(() {});
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
},
|
_selectIndex = i;
|
||||||
children: const [ServerPage(), ConvertPage(), PingPage()],
|
setState(() {});
|
||||||
),
|
},
|
||||||
bottomNavigationBar: _buildBottom(context),
|
children: const [ServerPage(), ConvertPage(), PingPage()],
|
||||||
));
|
),
|
||||||
|
bottomNavigationBar: _buildBottom(context),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildItem(int idx, NavigationItem item, bool isSelected) {
|
Widget _buildItem(int idx, NavigationItem item, bool isSelected) {
|
||||||
bool isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
||||||
final width = _width / tabItems.length;
|
final width = _width / tabItems.length;
|
||||||
return AnimatedContainer(
|
return AnimatedContainer(
|
||||||
duration: const Duration(milliseconds: 377),
|
duration: const Duration(milliseconds: 377),
|
||||||
@@ -169,12 +120,15 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
height: 50,
|
height: 50,
|
||||||
width: isSelected ? width : width - 17,
|
width: isSelected ? width : width - 17,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? isDarkMode
|
? isDarkMode(context)
|
||||||
? Colors.white12
|
? Colors.white12
|
||||||
: Colors.black.withOpacity(0.07)
|
: Colors.black.withOpacity(0.07)
|
||||||
: Colors.transparent,
|
: Colors.transparent,
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(50))),
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(50),
|
||||||
|
),
|
||||||
|
),
|
||||||
child: IconButton(
|
child: IconButton(
|
||||||
icon: Icon(item.icon),
|
icon: Icon(item.icon),
|
||||||
tooltip: tabTitleName(context, idx),
|
tooltip: tabTitleName(context, idx),
|
||||||
@@ -193,28 +147,31 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
|
|
||||||
Widget _buildBottom(BuildContext context) {
|
Widget _buildBottom(BuildContext context) {
|
||||||
return SafeArea(
|
return SafeArea(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 56,
|
height: 56,
|
||||||
padding: const EdgeInsets.only(left: 8, top: 4, bottom: 4, right: 8),
|
padding: const EdgeInsets.only(left: 8, top: 4, bottom: 4, right: 8),
|
||||||
width: _width,
|
width: _width,
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: tabItems.map((item) {
|
children: tabItems.map(
|
||||||
int itemIndex = tabItems.indexOf(item);
|
(item) {
|
||||||
return _buildItem(itemIndex, item, _selectIndex == itemIndex);
|
int itemIndex = tabItems.indexOf(item);
|
||||||
}).toList(),
|
return _buildItem(itemIndex, item, _selectIndex == itemIndex);
|
||||||
|
},
|
||||||
|
).toList(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDrawer() {
|
Widget _buildDrawer() {
|
||||||
return SafeArea(
|
return Drawer(
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
_buildIcon(),
|
_buildIcon(),
|
||||||
const Text(BuildData.name),
|
const Text(BuildData.name),
|
||||||
Text(_buildVersionStr()),
|
Text(_versionStr),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: MediaQuery.of(context).size.height * 0.07,
|
height: MediaQuery.of(context).size.height * 0.07,
|
||||||
),
|
),
|
||||||
@@ -224,63 +181,71 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.settings),
|
leading: const Icon(Icons.settings),
|
||||||
title: Text(s.setting),
|
title: Text(_s.setting),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
AppRoute(const SettingPage(), 'Setting').go(context),
|
AppRoute(const SettingPage(), 'Setting').go(context),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.vpn_key),
|
leading: const Icon(Icons.vpn_key),
|
||||||
title: Text(s.privateKey),
|
title: Text(_s.privateKey),
|
||||||
onTap: () => AppRoute(
|
onTap: () => AppRoute(
|
||||||
const StoredPrivateKeysPage(), 'private key list')
|
const StoredPrivateKeysPage(), 'private key list')
|
||||||
.go(context),
|
.go(context),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.download),
|
leading: const Icon(Icons.download),
|
||||||
title: Text(s.download),
|
title: Text(_s.download),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
AppRoute(const SFTPDownloadedPage(), 'snippet list')
|
AppRoute(const SFTPDownloadedPage(), 'snippet list')
|
||||||
.go(context),
|
.go(context),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.import_export),
|
leading: const Icon(Icons.import_export),
|
||||||
title: Text(s.backup),
|
title: Text(_s.backup),
|
||||||
onTap: () =>
|
onTap: () =>
|
||||||
AppRoute(BackupPage(), 'backup page').go(context),
|
AppRoute(BackupPage(), 'backup page').go(context),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.info),
|
leading: const Icon(Icons.info),
|
||||||
title: Text(s.feedback),
|
title: Text(_s.feedback),
|
||||||
onTap: () => showRoundDialog(
|
onTap: () => showRoundDialog(
|
||||||
context, s.feedback, Text(s.feedbackOnGithub), [
|
context,
|
||||||
TextButton(
|
_s.feedback,
|
||||||
|
Text(_s.feedbackOnGithub),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
onPressed: () => Clipboard.setData(
|
onPressed: () => Clipboard.setData(
|
||||||
const ClipboardData(text: issueUrl)),
|
const ClipboardData(text: issueUrl)),
|
||||||
child: Text(s.copy)),
|
child: Text(_s.copy),
|
||||||
TextButton(
|
),
|
||||||
|
TextButton(
|
||||||
onPressed: () => openUrl(issueUrl),
|
onPressed: () => openUrl(issueUrl),
|
||||||
child: Text(s.feedback)),
|
child: Text(_s.feedback),
|
||||||
TextButton(
|
),
|
||||||
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: Text(s.close))
|
child: Text(_s.close),
|
||||||
]),
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.snippet_folder),
|
leading: const Icon(Icons.snippet_folder),
|
||||||
title: Text(s.snippet),
|
title: Text(_s.snippet),
|
||||||
onTap: () => AppRoute(const SnippetListPage(), 'snippet list')
|
onTap: () => AppRoute(const SnippetListPage(), 'snippet list')
|
||||||
.go(context),
|
.go(context),
|
||||||
),
|
),
|
||||||
AboutListTile(
|
AboutListTile(
|
||||||
icon: const Icon(Icons.text_snippet),
|
icon: const Icon(Icons.text_snippet),
|
||||||
applicationName: BuildData.name,
|
applicationName: BuildData.name,
|
||||||
applicationVersion: _buildVersionStr(),
|
applicationVersion: _versionStr,
|
||||||
applicationIcon: _buildIcon(),
|
applicationIcon: _buildIcon(),
|
||||||
aboutBoxChildren: [
|
aboutBoxChildren: [
|
||||||
UrlText(
|
UrlText(
|
||||||
text: s.madeWithLove(myGithub), replace: 'LollipopKit'),
|
text: _s.madeWithLove(myGithub),
|
||||||
|
replace: 'lollipopkit'),
|
||||||
UrlText(
|
UrlText(
|
||||||
text: s.aboutThanks,
|
text: _s.aboutThanks,
|
||||||
),
|
),
|
||||||
const UrlText(
|
const UrlText(
|
||||||
text: rainSunMeGithub,
|
text: rainSunMeGithub,
|
||||||
@@ -291,7 +256,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
replace: 'fecture',
|
replace: 'fecture',
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
child: Text(s.license),
|
child: Text(_s.license),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -306,10 +271,11 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: [
|
children: [
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxHeight: 53, maxWidth: 53),
|
constraints: const BoxConstraints(maxHeight: 53, maxWidth: 53),
|
||||||
child: Container(
|
child: Container(
|
||||||
color: primaryColor,
|
color: primaryColor,
|
||||||
)),
|
),
|
||||||
|
),
|
||||||
ConstrainedBox(
|
ConstrainedBox(
|
||||||
constraints: const BoxConstraints(maxHeight: 83, maxWidth: 83),
|
constraints: const BoxConstraints(maxHeight: 83, maxWidth: 83),
|
||||||
child: appIcon,
|
child: appIcon,
|
||||||
@@ -318,7 +284,7 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _buildVersionStr() {
|
String get _versionStr {
|
||||||
var mod = '';
|
var mod = '';
|
||||||
if (BuildData.modifications != 0) {
|
if (BuildData.modifications != 0) {
|
||||||
mod = '(+${BuildData.modifications})';
|
mod = '(+${BuildData.modifications})';
|
||||||
@@ -334,8 +300,6 @@ class _MyHomePageState extends State<MyHomePage>
|
|||||||
await GetIt.I.allReady();
|
await GetIt.I.allReady();
|
||||||
await locator<ServerProvider>().loadLocalData();
|
await locator<ServerProvider>().loadLocalData();
|
||||||
await doUpdate(context);
|
await doUpdate(context);
|
||||||
if (BuildMode.isRelease) {
|
await Analysis.init();
|
||||||
await Analysis.init(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,11 +4,18 @@ import 'package:toolbox/core/utils.dart';
|
|||||||
import 'package:toolbox/data/model/server/ping_result.dart';
|
import 'package:toolbox/data/model/server/ping_result.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/widget/input_field.dart';
|
import 'package:toolbox/view/widget/input_field.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
|
final doaminReg =
|
||||||
|
RegExp(r'^[a-zA-Z0-9][a-zA-Z0-9-]{1,61}[a-zA-Z0-9]\.[a-zA-Z]{2,}$');
|
||||||
|
final ipv4Reg =
|
||||||
|
RegExp(r'^((25[0-5]|(2[0-4]|1[0-9]|[1-9]|)[0-9])(\.(?!$)|$)){4}$');
|
||||||
|
final ipv6Reg = RegExp(r'^([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}$');
|
||||||
|
|
||||||
class PingPage extends StatefulWidget {
|
class PingPage extends StatefulWidget {
|
||||||
const PingPage({Key? key}) : super(key: key);
|
const PingPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@@ -23,9 +30,6 @@ class _PingPageState extends State<PingPage>
|
|||||||
final List<PingResult> _results = [];
|
final List<PingResult> _results = [];
|
||||||
final _serverProvider = locator<ServerProvider>();
|
final _serverProvider = locator<ServerProvider>();
|
||||||
late S s;
|
late S s;
|
||||||
static const summaryTextStyle = TextStyle(
|
|
||||||
fontSize: 12,
|
|
||||||
);
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -44,27 +48,39 @@ class _PingPageState extends State<PingPage>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: GestureDetector(
|
body: SingleChildScrollView(
|
||||||
child: SingleChildScrollView(
|
padding: const EdgeInsets.symmetric(horizontal: 7),
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 7),
|
child: Column(
|
||||||
child: Column(children: [
|
children: [
|
||||||
const SizedBox(height: 13),
|
const SizedBox(height: 13),
|
||||||
buildInput(context, _textEditingController,
|
buildInput(context, _textEditingController,
|
||||||
maxLines: 1, onSubmitted: (_) => doPing()),
|
hint: s.inputDomainHere,
|
||||||
_buildControl(),
|
maxLines: 1,
|
||||||
SizedBox(
|
onSubmitted: (_) => doPing()),
|
||||||
width: double.infinity,
|
SizedBox(
|
||||||
height: _media.size.height * 0.6,
|
width: double.infinity,
|
||||||
child: ListView.builder(
|
height: _media.size.height * 0.6,
|
||||||
controller: ScrollController(),
|
child: ListView.builder(
|
||||||
itemCount: _results.length,
|
controller: ScrollController(),
|
||||||
itemBuilder: (context, index) {
|
itemCount: _results.length,
|
||||||
final result = _results[index];
|
itemBuilder: (context, index) {
|
||||||
return _buildResultItem(result);
|
final result = _results[index];
|
||||||
}),
|
return _buildResultItem(result);
|
||||||
),
|
}),
|
||||||
])),
|
),
|
||||||
onTap: () => FocusScope.of(context).requestFocus(FocusNode()),
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
floatingActionButton: FloatingActionButton(
|
||||||
|
heroTag: 'ping fab',
|
||||||
|
onPressed: () {
|
||||||
|
try {
|
||||||
|
doPing();
|
||||||
|
} catch (e) {
|
||||||
|
showSnackBar(context, Text('Error: \n$e'));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: const Icon(Icons.play_arrow),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -72,19 +88,30 @@ class _PingPageState extends State<PingPage>
|
|||||||
Widget _buildResultItem(PingResult result) {
|
Widget _buildResultItem(PingResult result) {
|
||||||
final unknown = s.unknown;
|
final unknown = s.unknown;
|
||||||
final ms = s.ms;
|
final ms = s.ms;
|
||||||
return RoundRectCard(ListTile(
|
return RoundRectCard(
|
||||||
contentPadding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
ListTile(
|
||||||
title: Text(result.serverName,
|
contentPadding: const EdgeInsets.symmetric(vertical: 7, horizontal: 17),
|
||||||
|
title: Text(
|
||||||
|
result.serverName,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 18, fontWeight: FontWeight.bold, color: primaryColor)),
|
fontSize: 18,
|
||||||
subtitle: Text(
|
fontWeight: FontWeight.bold,
|
||||||
_buildPingSummary(result, unknown, ms),
|
color: primaryColor,
|
||||||
style: summaryTextStyle,
|
),
|
||||||
),
|
),
|
||||||
trailing: Text(
|
subtitle: Text(
|
||||||
|
_buildPingSummary(result, unknown, ms),
|
||||||
|
style: textSize11,
|
||||||
|
),
|
||||||
|
trailing: Text(
|
||||||
'${s.pingAvg}${result.statistic?.avg?.toStringAsFixed(2) ?? s.unknown} $ms',
|
'${s.pingAvg}${result.statistic?.avg?.toStringAsFixed(2) ?? s.unknown} $ms',
|
||||||
style: TextStyle(fontSize: 14, color: primaryColor)),
|
style: TextStyle(
|
||||||
));
|
fontSize: 14,
|
||||||
|
color: primaryColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
String _buildPingSummary(PingResult result, String unknown, String ms) {
|
String _buildPingSummary(PingResult result, String unknown, String ms) {
|
||||||
@@ -100,6 +127,7 @@ class _PingPageState extends State<PingPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> doPing() async {
|
Future<void> doPing() async {
|
||||||
|
FocusScope.of(context).requestFocus(FocusNode());
|
||||||
_results.clear();
|
_results.clear();
|
||||||
final target = _textEditingController.text.trim();
|
final target = _textEditingController.text.trim();
|
||||||
if (target.isEmpty) {
|
if (target.isEmpty) {
|
||||||
@@ -112,67 +140,25 @@ class _PingPageState extends State<PingPage>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await Future.wait(_serverProvider.servers.map((e) async {
|
if (!doaminReg.hasMatch(target) &&
|
||||||
if (e.client == null) {
|
!ipv4Reg.hasMatch(target) &&
|
||||||
return;
|
!ipv6Reg.hasMatch(target)) {
|
||||||
}
|
showSnackBar(context, Text(s.pingInputIP));
|
||||||
final result = await e.client!.run('ping -c 3 $target').string;
|
return;
|
||||||
_results.add(PingResult.parse(e.info.name, result));
|
}
|
||||||
setState(() {});
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildControl() {
|
try {
|
||||||
return SizedBox(
|
await Future.wait(_serverProvider.servers.map((e) async {
|
||||||
height: 57,
|
if (e.client == null) {
|
||||||
child: RoundRectCard(
|
return;
|
||||||
InkWell(
|
}
|
||||||
onTap: () => FocusScope.of(context).unfocus(),
|
final result = await e.client!.run('ping -c 3 $target').string;
|
||||||
child: Row(
|
_results.add(PingResult.parse(e.info.name, result));
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
setState(() {});
|
||||||
children: [
|
}));
|
||||||
TextButton(
|
} catch (e) {
|
||||||
style: ButtonStyle(
|
showSnackBar(context, Text(e.toString()));
|
||||||
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
}
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.delete),
|
|
||||||
const SizedBox(
|
|
||||||
width: 7,
|
|
||||||
),
|
|
||||||
Text(s.clear)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
_results.clear();
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
style: ButtonStyle(
|
|
||||||
foregroundColor: MaterialStateProperty.all(primaryColor)),
|
|
||||||
child: Row(
|
|
||||||
children: [
|
|
||||||
const Icon(Icons.play_arrow),
|
|
||||||
const SizedBox(
|
|
||||||
width: 7,
|
|
||||||
),
|
|
||||||
Text(s.start)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
onPressed: () {
|
|
||||||
try {
|
|
||||||
doPing();
|
|
||||||
} catch (e) {
|
|
||||||
showSnackBar(context, Text('Error: \n$e'));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
261
lib/view/page/pkg.dart
Normal file
261
lib/view/page/pkg.dart
Normal file
@@ -0,0 +1,261 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
import 'package:toolbox/core/utils.dart';
|
||||||
|
import 'package:toolbox/data/model/pkg/upgrade_info.dart';
|
||||||
|
import 'package:toolbox/data/model/server/dist.dart';
|
||||||
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
|
import 'package:toolbox/data/provider/pkg.dart';
|
||||||
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
|
import 'package:toolbox/data/res/url.dart';
|
||||||
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
|
import 'package:toolbox/view/widget/center_loading.dart';
|
||||||
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
import 'package:toolbox/view/widget/two_line_text.dart';
|
||||||
|
import 'package:toolbox/view/widget/url_text.dart';
|
||||||
|
|
||||||
|
class PkgManagePage extends StatefulWidget {
|
||||||
|
const PkgManagePage(this.spi, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
final ServerPrivateInfo spi;
|
||||||
|
|
||||||
|
@override
|
||||||
|
_PkgManagePageState createState() => _PkgManagePageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PkgManagePageState extends State<PkgManagePage>
|
||||||
|
with SingleTickerProviderStateMixin {
|
||||||
|
late MediaQueryData _media;
|
||||||
|
final _scrollController = ScrollController();
|
||||||
|
final _scrollControllerUpdate = ScrollController();
|
||||||
|
final _textController = TextEditingController();
|
||||||
|
final _aptProvider = locator<PkgProvider>();
|
||||||
|
late S _s;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
_media = MediaQuery.of(context);
|
||||||
|
_s = S.of(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
super.dispose();
|
||||||
|
locator<PkgProvider>().clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
final si = locator<ServerProvider>()
|
||||||
|
.servers
|
||||||
|
.firstWhere((e) => e.info == widget.spi);
|
||||||
|
if (si.client == null) {
|
||||||
|
showSnackBar(context, Text(_s.waitConnection));
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_aptProvider.init(
|
||||||
|
si.client!,
|
||||||
|
si.status.sysVer.dist,
|
||||||
|
() =>
|
||||||
|
_scrollController.jumpTo(_scrollController.position.maxScrollExtent),
|
||||||
|
() => _scrollControllerUpdate
|
||||||
|
.jumpTo(_scrollController.position.maxScrollExtent),
|
||||||
|
onPwdRequest,
|
||||||
|
widget.spi.user,
|
||||||
|
);
|
||||||
|
_aptProvider.refresh();
|
||||||
|
}
|
||||||
|
|
||||||
|
void onSubmitted() {
|
||||||
|
if (_textController.text == '') {
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.attention,
|
||||||
|
Text(_s.fieldMustNotEmpty),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(), child: Text(_s.ok)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<String> onPwdRequest() async {
|
||||||
|
if (!mounted) return '';
|
||||||
|
await showRoundDialog(
|
||||||
|
context,
|
||||||
|
widget.spi.user,
|
||||||
|
TextField(
|
||||||
|
controller: _textController,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
obscureText: true,
|
||||||
|
onSubmitted: (_) => onSubmitted(),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: _s.pwd,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
},
|
||||||
|
child: Text(_s.cancel)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => onSubmitted(),
|
||||||
|
child: Text(
|
||||||
|
_s.ok,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
|
)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return _textController.text.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
centerTitle: true,
|
||||||
|
title: TwoLineText(up: 'Apt', down: widget.spi.name),
|
||||||
|
),
|
||||||
|
body: Consumer<PkgProvider>(builder: (_, apt, __) {
|
||||||
|
if (apt.error != null) {
|
||||||
|
return Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.error,
|
||||||
|
color: Colors.redAccent,
|
||||||
|
size: 37,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 37,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: _media.size.height * 0.4,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(17),
|
||||||
|
child: RoundRectCard(
|
||||||
|
SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(17),
|
||||||
|
child: Text(
|
||||||
|
apt.error!,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (apt.updateLog == null && apt.upgradeable == null) {
|
||||||
|
return centerLoading;
|
||||||
|
}
|
||||||
|
if (apt.updateLog != null && apt.upgradeable == null) {
|
||||||
|
return SizedBox(
|
||||||
|
height:
|
||||||
|
_media.size.height - _media.padding.top - _media.padding.bottom,
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints.expand(),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(18),
|
||||||
|
controller: _scrollControllerUpdate,
|
||||||
|
child: Text(apt.updateLog!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ListView(
|
||||||
|
padding: const EdgeInsets.all(13),
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(17),
|
||||||
|
child: UrlText(
|
||||||
|
text:
|
||||||
|
'${_s.experimentalFeature}\n${_s.reportBugsOnGithubIssue(issueUrl)}',
|
||||||
|
replace: 'Github Issue',
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
_buildUpdatePanel(apt)
|
||||||
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
|
);
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildUpdatePanel(PkgProvider apt) {
|
||||||
|
if (apt.upgradeable!.isEmpty) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(
|
||||||
|
_s.noUpdateAvailable,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
subtitle: const Text('>_<', textAlign: TextAlign.center),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
ExpansionTile(
|
||||||
|
title: Text(_s.foundNUpdate(apt.upgradeable!.length)),
|
||||||
|
subtitle: Text(
|
||||||
|
apt.upgradeable!.map((e) => e.package).join(', '),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
style: grey,
|
||||||
|
),
|
||||||
|
children: apt.upgradeLog == null
|
||||||
|
? [
|
||||||
|
TextButton(
|
||||||
|
child: Text(_s.updateAll),
|
||||||
|
onPressed: () {
|
||||||
|
apt.upgrade();
|
||||||
|
}),
|
||||||
|
SizedBox(
|
||||||
|
height: _media.size.height * 0.73,
|
||||||
|
child: ListView(
|
||||||
|
controller: _scrollController,
|
||||||
|
children: apt.upgradeable!
|
||||||
|
.map((e) => _buildUpdateItem(e, apt))
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
]
|
||||||
|
: [
|
||||||
|
SizedBox(
|
||||||
|
height: _media.size.height * 0.7,
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints.expand(),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
padding: const EdgeInsets.all(18),
|
||||||
|
controller: _scrollController,
|
||||||
|
child: Text(apt.upgradeLog!),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildUpdateItem(UpgradePkgInfo info, PkgProvider apt) {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(info.package),
|
||||||
|
subtitle: Text(
|
||||||
|
'${info.nowVersion} -> ${info.newVersion}',
|
||||||
|
style: grey,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import 'package:after_layout/after_layout.dart';
|
|||||||
import 'package:dartssh2/dartssh2.dart';
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/model/server/private_key_info.dart';
|
import 'package:toolbox/data/model/server/private_key_info.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
@@ -10,6 +11,8 @@ import 'package:toolbox/generated/l10n.dart';
|
|||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/widget/input_decoration.dart';
|
import 'package:toolbox/view/widget/input_decoration.dart';
|
||||||
|
|
||||||
|
const _format = 'text/plain';
|
||||||
|
|
||||||
class PrivateKeyEditPage extends StatefulWidget {
|
class PrivateKeyEditPage extends StatefulWidget {
|
||||||
const PrivateKeyEditPage({Key? key, this.info}) : super(key: key);
|
const PrivateKeyEditPage({Key? key, this.info}) : super(key: key);
|
||||||
|
|
||||||
@@ -21,93 +24,96 @@ class PrivateKeyEditPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
||||||
with AfterLayoutMixin {
|
with AfterLayoutMixin {
|
||||||
final nameController = TextEditingController();
|
final _nameController = TextEditingController();
|
||||||
final keyController = TextEditingController();
|
final _keyController = TextEditingController();
|
||||||
final pwdController = TextEditingController();
|
final _pwdController = TextEditingController();
|
||||||
final nameNode = FocusNode();
|
final _nameNode = FocusNode();
|
||||||
final keyNode = FocusNode();
|
final _keyNode = FocusNode();
|
||||||
final pwdNode = FocusNode();
|
final _pwdNode = FocusNode();
|
||||||
|
|
||||||
late FocusScopeNode focusScope;
|
|
||||||
|
|
||||||
|
late FocusScopeNode _focusScope;
|
||||||
late PrivateKeyProvider _provider;
|
late PrivateKeyProvider _provider;
|
||||||
late Widget loading;
|
late S _s;
|
||||||
late S s;
|
|
||||||
|
Widget _loading = const SizedBox();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_provider = locator<PrivateKeyProvider>();
|
_provider = locator<PrivateKeyProvider>();
|
||||||
loading = const SizedBox();
|
_loading = const SizedBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
focusScope = FocusScope.of(context);
|
_focusScope = FocusScope.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text(s.edit, style: size18), actions: [
|
appBar: AppBar(
|
||||||
widget.info != null
|
title: Text(_s.edit, style: textSize18),
|
||||||
? IconButton(
|
actions: [
|
||||||
tooltip: s.delete,
|
widget.info != null
|
||||||
onPressed: () {
|
? IconButton(
|
||||||
_provider.delInfo(widget.info!);
|
tooltip: _s.delete,
|
||||||
Navigator.of(context).pop();
|
onPressed: () {
|
||||||
},
|
_provider.delInfo(widget.info!);
|
||||||
icon: const Icon(Icons.delete))
|
Navigator.of(context).pop();
|
||||||
: const SizedBox()
|
},
|
||||||
]),
|
icon: const Icon(Icons.delete))
|
||||||
|
: const SizedBox()
|
||||||
|
],
|
||||||
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
children: [
|
children: [
|
||||||
TextField(
|
TextField(
|
||||||
controller: nameController,
|
controller: _nameController,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
focusNode: nameNode,
|
focusNode: _nameNode,
|
||||||
onSubmitted: (_) => focusScope.requestFocus(keyNode),
|
onSubmitted: (_) => _focusScope.requestFocus(_keyNode),
|
||||||
decoration: buildDecoration(s.name, icon: Icons.info),
|
decoration: buildDecoration(_s.name, icon: Icons.info),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: keyController,
|
controller: _keyController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
minLines: 3,
|
minLines: 3,
|
||||||
maxLines: 10,
|
maxLines: 10,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
focusNode: keyNode,
|
focusNode: _keyNode,
|
||||||
onSubmitted: (_) => focusScope.requestFocus(pwdNode),
|
onSubmitted: (_) => _focusScope.requestFocus(_pwdNode),
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
decoration: buildDecoration(s.privateKey, icon: Icons.vpn_key),
|
decoration: buildDecoration(_s.privateKey, icon: Icons.vpn_key),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: pwdController,
|
controller: _pwdController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
focusNode: pwdNode,
|
focusNode: _pwdNode,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
decoration: buildDecoration(s.pwd, icon: Icons.password),
|
decoration: buildDecoration(_s.pwd, icon: Icons.password),
|
||||||
),
|
),
|
||||||
SizedBox(height: MediaQuery.of(context).size.height * 0.1),
|
SizedBox(height: MediaQuery.of(context).size.height * 0.1),
|
||||||
loading
|
_loading
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
tooltip: s.save,
|
tooltip: _s.save,
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final name = nameController.text;
|
final name = _nameController.text;
|
||||||
final key = keyController.text.trim();
|
final key = _keyController.text.trim();
|
||||||
final pwd = pwdController.text;
|
final pwd = _pwdController.text;
|
||||||
if (name.isEmpty || key.isEmpty) {
|
if (name.isEmpty || key.isEmpty) {
|
||||||
showSnackBar(context, Text(s.fieldMustNotEmpty));
|
showSnackBar(context, Text(_s.fieldMustNotEmpty));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FocusScope.of(context).unfocus();
|
FocusScope.of(context).unfocus();
|
||||||
setState(() {
|
setState(() {
|
||||||
loading = const SizedBox(
|
_loading = const SizedBox(
|
||||||
height: 50,
|
height: 50,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: CircularProgressIndicator(),
|
child: CircularProgressIndicator(),
|
||||||
@@ -123,7 +129,7 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
|||||||
haveErr = true;
|
haveErr = true;
|
||||||
} finally {
|
} finally {
|
||||||
setState(() {
|
setState(() {
|
||||||
loading = const SizedBox();
|
_loading = const SizedBox();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (haveErr) return;
|
if (haveErr) return;
|
||||||
@@ -140,11 +146,16 @@ class _PrivateKeyEditPageState extends State<PrivateKeyEditPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void afterFirstLayout(BuildContext context) {
|
Future<void> afterFirstLayout(BuildContext context) async {
|
||||||
if (widget.info != null) {
|
if (widget.info != null) {
|
||||||
nameController.text = widget.info!.id;
|
_nameController.text = widget.info!.id;
|
||||||
keyController.text = widget.info!.privateKey;
|
_keyController.text = widget.info!.privateKey;
|
||||||
pwdController.text = widget.info!.password;
|
_pwdController.text = widget.info!.password;
|
||||||
|
} else {
|
||||||
|
final clipdata = ((await Clipboard.getData(_format))?.text ?? '').trim();
|
||||||
|
if (clipdata.startsWith('-----BEGIN') && clipdata.endsWith('-----')) {
|
||||||
|
_keyController.text = clipdata;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/data/provider/private_key.dart';
|
import 'package:toolbox/data/provider/private_key.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
|
||||||
import 'package:toolbox/data/res/font_style.dart';
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/data/res/padding.dart';
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
@@ -17,20 +16,19 @@ class StoredPrivateKeysPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
||||||
final _textStyle = TextStyle(color: primaryColor);
|
late S _s;
|
||||||
late S s;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(s.privateKey, style: size18),
|
title: Text(_s.privateKey, style: textSize18),
|
||||||
),
|
),
|
||||||
body: Consumer<PrivateKeyProvider>(
|
body: Consumer<PrivateKeyProvider>(
|
||||||
builder: (_, key, __) {
|
builder: (_, key, __) {
|
||||||
@@ -51,19 +49,19 @@ class _PrivateKeyListState extends State<StoredPrivateKeysPage> {
|
|||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => AppRoute(
|
onPressed: () => AppRoute(
|
||||||
PrivateKeyEditPage(info: key.infos[idx]),
|
PrivateKeyEditPage(info: key.infos[idx]),
|
||||||
'private key edit page')
|
'private key edit page')
|
||||||
.go(context),
|
.go(context),
|
||||||
child: Text(
|
child: Text(_s.edit),
|
||||||
s.edit,
|
)
|
||||||
style: _textStyle,
|
|
||||||
))
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
})
|
})
|
||||||
: Center(child: Text(s.noSavedPrivateKey));
|
: Center(
|
||||||
|
child: Text(_s.noSavedPrivateKey),
|
||||||
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
|
|||||||
@@ -1,20 +1,19 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/extension/numx.dart';
|
import 'package:toolbox/core/extension/numx.dart';
|
||||||
|
import 'package:toolbox/data/model/server/dist.dart';
|
||||||
import 'package:toolbox/data/model/server/net_speed.dart';
|
import 'package:toolbox/data/model/server/net_speed.dart';
|
||||||
import 'package:toolbox/data/model/server/server.dart';
|
import 'package:toolbox/data/model/server/server.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/font_style.dart';
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/data/res/icon/linux_icons.dart';
|
|
||||||
import 'package:toolbox/data/res/padding.dart';
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
|
import 'package:toolbox/data/store/setting.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
const style11 = TextStyle(fontSize: 11);
|
|
||||||
const style13 = TextStyle(fontSize: 13);
|
|
||||||
|
|
||||||
class ServerDetailPage extends StatefulWidget {
|
class ServerDetailPage extends StatefulWidget {
|
||||||
const ServerDetailPage(this.id, {Key? key}) : super(key: key);
|
const ServerDetailPage(this.id, {Key? key}) : super(key: key);
|
||||||
|
|
||||||
@@ -27,49 +26,69 @@ class ServerDetailPage extends StatefulWidget {
|
|||||||
class _ServerDetailPageState extends State<ServerDetailPage>
|
class _ServerDetailPageState extends State<ServerDetailPage>
|
||||||
with SingleTickerProviderStateMixin {
|
with SingleTickerProviderStateMixin {
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late S s;
|
late S _s;
|
||||||
|
late Color pColor;
|
||||||
|
bool _showDistLogo = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
|
_showDistLogo = locator<SettingStore>().showDistLogo.fetch()!;
|
||||||
|
pColor = primaryColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
return Consumer<ServerProvider>(builder: (_, provider, __) {
|
||||||
return _buildMainPage(provider.servers
|
return _buildMainPage(
|
||||||
.firstWhere((e) => '${e.info.ip}:${e.info.port}' == widget.id));
|
provider.servers.firstWhere(
|
||||||
|
(e) => '${e.info.ip}:${e.info.port}' == widget.id,
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMainPage(ServerInfo si) {
|
Widget _buildMainPage(ServerInfo si) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(si.info.name, style: size18),
|
title: Text(si.info.name, style: textSize18),
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
children: [
|
children: [
|
||||||
_buildLinuxIcon(si.status.sysVer),
|
...(_buildLinuxIcon(si.status.sysVer) ?? []),
|
||||||
SizedBox(height: _media.size.height * 0.03),
|
|
||||||
_buildUpTimeAndSys(si.status),
|
_buildUpTimeAndSys(si.status),
|
||||||
_buildCPUView(si.status),
|
_buildCPUView(si.status),
|
||||||
_buildDiskView(si.status),
|
|
||||||
_buildMemView(si.status),
|
_buildMemView(si.status),
|
||||||
|
_buildDiskView(si.status),
|
||||||
_buildNetView(si.status.netSpeed),
|
_buildNetView(si.status.netSpeed),
|
||||||
|
// avoid the hieght of navigation bar
|
||||||
SizedBox(height: _media.padding.bottom),
|
SizedBox(height: _media.padding.bottom),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildLinuxIcon(String sysVer) {
|
List<Widget>? _buildLinuxIcon(String sysVer) {
|
||||||
final iconPath = linuxIcons.search(sysVer);
|
if (!_showDistLogo) return null;
|
||||||
if (iconPath == null) return const SizedBox();
|
final iconPath = sysVer.dist?.iconPath;
|
||||||
return SizedBox(
|
if (iconPath == null) return null;
|
||||||
height: _media.size.height * 0.15, child: Image.asset(iconPath));
|
return [
|
||||||
|
SizedBox(height: _media.size.height * 0.03),
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: _media.size.height * 0.13,
|
||||||
|
maxWidth: _media.size.width * 0.6,
|
||||||
|
),
|
||||||
|
child: Image.asset(
|
||||||
|
iconPath,
|
||||||
|
fit: BoxFit.contain,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: _media.size.height * 0.03),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCPUView(ServerStatus ss) {
|
Widget _buildCPUView(ServerStatus ss) {
|
||||||
@@ -77,7 +96,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
Padding(
|
Padding(
|
||||||
padding: roundRectCardPadding,
|
padding: roundRectCardPadding,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 12 * ss.cpu2Status.coresCount + 67,
|
height: 12 * ss.cpu2Status.coresCount + 63,
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: _media.size.height * 0.02,
|
height: _media.size.height * 0.02,
|
||||||
@@ -87,24 +106,24 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${ss.cpu2Status.usedPercent(coreIdx: 0).toInt()}%',
|
'${ss.cpu2Status.usedPercent(coreIdx: 0).toInt()}%',
|
||||||
style: const TextStyle(fontSize: 27),
|
style: textSize27,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
_buildCPUTimePercent(ss.cpu2Status.user, 'user'),
|
_buildDetailPercent(ss.cpu2Status.user, 'user'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width * 0.03,
|
width: _media.size.width * 0.03,
|
||||||
),
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.sys, 'sys'),
|
_buildDetailPercent(ss.cpu2Status.sys, 'sys'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width * 0.03,
|
width: _media.size.width * 0.03,
|
||||||
),
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.iowait, 'io'),
|
_buildDetailPercent(ss.cpu2Status.iowait, 'io'),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width * 0.03,
|
width: _media.size.width * 0.03,
|
||||||
),
|
),
|
||||||
_buildCPUTimePercent(ss.cpu2Status.idle, 'idle')
|
_buildDetailPercent(ss.cpu2Status.idle, 'idle')
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@@ -116,7 +135,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildCPUTimePercent(double percent, String timeType) {
|
Widget _buildDetailPercent(double percent, String timeType) {
|
||||||
return Column(
|
return Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -141,7 +160,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
height: 12.0 * ss.cpu2Status.coresCount,
|
height: 12.0 * ss.cpu2Status.coresCount,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
padding: const EdgeInsets.symmetric(vertical: 17),
|
padding: const EdgeInsets.only(top: 13),
|
||||||
itemBuilder: (ctx, idx) {
|
itemBuilder: (ctx, idx) {
|
||||||
if (idx == 0) return const SizedBox();
|
if (idx == 0) return const SizedBox();
|
||||||
return Padding(
|
return Padding(
|
||||||
@@ -156,7 +175,6 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
|
|
||||||
Widget _buildProgress(double percent) {
|
Widget _buildProgress(double percent) {
|
||||||
if (percent > 100) percent = 100;
|
if (percent > 100) percent = 100;
|
||||||
final pColor = primaryColor;
|
|
||||||
final percentWithinOne = percent / 100;
|
final percentWithinOne = percent / 100;
|
||||||
return LinearProgressIndicator(
|
return LinearProgressIndicator(
|
||||||
value: percentWithinOne,
|
value: percentWithinOne,
|
||||||
@@ -172,10 +190,10 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(ss.sysVer, style: style11, textScaleFactor: 1.0),
|
Text(ss.sysVer, style: textSize11, textScaleFactor: 1.0),
|
||||||
Text(
|
Text(
|
||||||
ss.uptime,
|
ss.uptime,
|
||||||
style: style11,
|
style: textSize11,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -184,14 +202,14 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMemView(ServerStatus ss) {
|
Widget _buildMemView(ServerStatus ss) {
|
||||||
final pColor = primaryColor;
|
final used = ss.memory.used / ss.memory.total * 100;
|
||||||
final used = ss.memory.used / ss.memory.total;
|
final free = ss.memory.free / ss.memory.total * 100;
|
||||||
final width = _media.size.width - 17 * 2 - 17 * 2;
|
final avail = ss.memory.avail / ss.memory.total * 100;
|
||||||
const mb = 1024;
|
|
||||||
return RoundRectCard(Padding(
|
return RoundRectCard(Padding(
|
||||||
padding: roundRectCardPadding,
|
padding: roundRectCardPadding,
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 47,
|
height: 70,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
@@ -199,63 +217,35 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
_buildMemExplain((ss.memory.used * mb).convertBytes, pColor),
|
Row(
|
||||||
_buildMemExplain(
|
children: [
|
||||||
(ss.memory.cache * mb).convertBytes, pColor.withAlpha(77)),
|
Text('${used.toStringAsFixed(0)}%', style: textSize27),
|
||||||
_buildMemExplain(
|
const SizedBox(width: 7),
|
||||||
((ss.memory.total - ss.memory.used) * mb).convertBytes,
|
Text('of ${(ss.memory.total * 1024).convertBytes}',
|
||||||
progressColor.resolve(context))
|
style: textSize13Grey)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
_buildDetailPercent(free, 'free'),
|
||||||
|
SizedBox(
|
||||||
|
width: _media.size.width * 0.03,
|
||||||
|
),
|
||||||
|
_buildDetailPercent(avail, 'avail'),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 7,
|
height: 11,
|
||||||
),
|
),
|
||||||
Row(
|
_buildProgress(used)
|
||||||
children: [
|
|
||||||
SizedBox(
|
|
||||||
width: width * used,
|
|
||||||
child: LinearProgressIndicator(
|
|
||||||
value: 1,
|
|
||||||
color: pColor,
|
|
||||||
)),
|
|
||||||
SizedBox(
|
|
||||||
width: width * (1 - used),
|
|
||||||
child: LinearProgressIndicator(
|
|
||||||
// memory.total == 1: failed to get mem, now mem = [emptyMemory] which is initial value.
|
|
||||||
value: ss.memory.total == 1
|
|
||||||
? 0
|
|
||||||
: ss.memory.cache / (ss.memory.total - ss.memory.used),
|
|
||||||
backgroundColor: progressColor.resolve(context),
|
|
||||||
color: pColor.withAlpha(77),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMemExplain(String value, Color color) {
|
|
||||||
return Row(
|
|
||||||
children: [
|
|
||||||
Container(
|
|
||||||
color: color,
|
|
||||||
height: 11,
|
|
||||||
width: 11,
|
|
||||||
),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
Text(
|
|
||||||
value,
|
|
||||||
style: style11,
|
|
||||||
textScaleFactor: 1.0,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildDiskView(ServerStatus ss) {
|
Widget _buildDiskView(ServerStatus ss) {
|
||||||
final clone = ss.disk.toList();
|
final clone = ss.disk.toList();
|
||||||
for (var item in ss.disk) {
|
for (var item in ss.disk) {
|
||||||
@@ -280,10 +270,11 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
'${disk.usedPercent}% of ${disk.size}',
|
'${disk.usedPercent}% of ${disk.size}',
|
||||||
style: style11,
|
style: textSize11,
|
||||||
textScaleFactor: 1.0,
|
textScaleFactor: 1.0,
|
||||||
),
|
),
|
||||||
Text(disk.mountPath, style: style11, textScaleFactor: 1.0)
|
Text(disk.mountPath,
|
||||||
|
style: textSize11, textScaleFactor: 1.0)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
_buildProgress(disk.usedPercent.toDouble())
|
_buildProgress(disk.usedPercent.toDouble())
|
||||||
@@ -304,7 +295,7 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
if (ns.devices.isEmpty) {
|
if (ns.devices.isEmpty) {
|
||||||
children.add(Center(
|
children.add(Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
s.noInterface,
|
_s.noInterface,
|
||||||
style: const TextStyle(color: Colors.grey, fontSize: 13),
|
style: const TextStyle(color: Colors.grey, fontSize: 13),
|
||||||
),
|
),
|
||||||
));
|
));
|
||||||
@@ -345,20 +336,21 @@ class _ServerDetailPageState extends State<ServerDetailPage>
|
|||||||
children: [
|
children: [
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width / 4,
|
width: _media.size.width / 4,
|
||||||
child: Text(device, style: style11, textScaleFactor: 1.0)),
|
child: Text(device, style: textSize11, textScaleFactor: 1.0)),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width / 4,
|
width: _media.size.width / 4,
|
||||||
child: Text(ns.speedIn(device: device),
|
child: Text(ns.speedIn(device: device),
|
||||||
style: style11,
|
style: textSize11,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
textScaleFactor: 1.0),
|
textScaleFactor: 1.0),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: _media.size.width / 4,
|
width: _media.size.width / 4,
|
||||||
child: Text(ns.speedOut(device: device),
|
child: Text(ns.speedOut(device: device),
|
||||||
style: style11,
|
style: textSize11,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
textScaleFactor: 1.0))
|
textScaleFactor: 1.0),
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -25,25 +25,21 @@ class ServerEditPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
||||||
final nameController = TextEditingController();
|
final _nameController = TextEditingController();
|
||||||
final ipController = TextEditingController();
|
final _ipController = TextEditingController();
|
||||||
final portController = TextEditingController();
|
final _portController = TextEditingController();
|
||||||
final usernameController = TextEditingController();
|
final _usernameController = TextEditingController();
|
||||||
final passwordController = TextEditingController();
|
final _passwordController = TextEditingController();
|
||||||
final keyController = TextEditingController();
|
final _nameFocus = FocusNode();
|
||||||
final nameFocus = FocusNode();
|
final _ipFocus = FocusNode();
|
||||||
final ipFocus = FocusNode();
|
final _portFocus = FocusNode();
|
||||||
final portFocus = FocusNode();
|
final _usernameFocus = FocusNode();
|
||||||
final usernameFocus = FocusNode();
|
|
||||||
|
|
||||||
late FocusScopeNode focusScope;
|
|
||||||
|
|
||||||
|
late FocusScopeNode _focusScope;
|
||||||
late ServerProvider _serverProvider;
|
late ServerProvider _serverProvider;
|
||||||
|
late S _s;
|
||||||
late S s;
|
|
||||||
|
|
||||||
bool usePublicKey = false;
|
bool usePublicKey = false;
|
||||||
|
|
||||||
int? _pubKeyIndex;
|
int? _pubKeyIndex;
|
||||||
PrivateKeyInfo? _keyInfo;
|
PrivateKeyInfo? _keyInfo;
|
||||||
|
|
||||||
@@ -56,37 +52,47 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
focusScope = FocusScope.of(context);
|
_focusScope = FocusScope.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text(s.edit, style: size18), actions: [
|
appBar: AppBar(
|
||||||
widget.spi != null
|
title: Text(_s.edit, style: textSize18),
|
||||||
? IconButton(
|
actions: [
|
||||||
onPressed: () {
|
widget.spi != null
|
||||||
showRoundDialog(context, s.attention,
|
? IconButton(
|
||||||
Text(s.sureToDeleteServer(widget.spi!.name)), [
|
onPressed: () {
|
||||||
TextButton(
|
showRoundDialog(
|
||||||
onPressed: () {
|
context,
|
||||||
_serverProvider.delServer(widget.spi!);
|
_s.attention,
|
||||||
Navigator.of(context).pop();
|
Text(_s.sureToDeleteServer(widget.spi!.name)),
|
||||||
Navigator.of(context).pop();
|
[
|
||||||
},
|
TextButton(
|
||||||
child: Text(
|
onPressed: () {
|
||||||
s.ok,
|
_serverProvider.delServer(widget.spi!);
|
||||||
style: const TextStyle(color: Colors.red),
|
Navigator.of(context).pop();
|
||||||
)),
|
Navigator.of(context).pop();
|
||||||
TextButton(
|
},
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
child: Text(
|
||||||
child: Text(s.cancel))
|
_s.ok,
|
||||||
]);
|
style: const TextStyle(color: Colors.red),
|
||||||
},
|
),
|
||||||
icon: const Icon(Icons.delete))
|
),
|
||||||
: const SizedBox()
|
TextButton(
|
||||||
]),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
)
|
||||||
|
: const SizedBox()
|
||||||
|
],
|
||||||
|
),
|
||||||
body: SingleChildScrollView(
|
body: SingleChildScrollView(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(17),
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -94,44 +100,44 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
TextField(
|
TextField(
|
||||||
controller: nameController,
|
controller: _nameController,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
focusNode: nameFocus,
|
focusNode: _nameFocus,
|
||||||
onSubmitted: (_) => focusScope.requestFocus(ipFocus),
|
onSubmitted: (_) => _focusScope.requestFocus(_ipFocus),
|
||||||
decoration: buildDecoration(s.name,
|
decoration: buildDecoration(_s.name,
|
||||||
icon: Icons.info, hint: s.exampleName),
|
icon: Icons.info, hint: _s.exampleName),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: ipController,
|
controller: _ipController,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
onSubmitted: (_) => focusScope.requestFocus(portFocus),
|
onSubmitted: (_) => _focusScope.requestFocus(_portFocus),
|
||||||
focusNode: ipFocus,
|
focusNode: _ipFocus,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
decoration: buildDecoration(s.host,
|
decoration: buildDecoration(_s.host,
|
||||||
icon: Icons.storage, hint: 'example.com'),
|
icon: Icons.storage, hint: 'example.com'),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: portController,
|
controller: _portController,
|
||||||
keyboardType: TextInputType.number,
|
keyboardType: TextInputType.number,
|
||||||
focusNode: portFocus,
|
focusNode: _portFocus,
|
||||||
onSubmitted: (_) => focusScope.requestFocus(usernameFocus),
|
onSubmitted: (_) => _focusScope.requestFocus(_usernameFocus),
|
||||||
decoration: buildDecoration(s.port,
|
decoration: buildDecoration(_s.port,
|
||||||
icon: Icons.format_list_numbered, hint: '22'),
|
icon: Icons.format_list_numbered, hint: '22'),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: usernameController,
|
controller: _usernameController,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
focusNode: usernameFocus,
|
focusNode: _usernameFocus,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
decoration: buildDecoration(s.user,
|
decoration: buildDecoration(_s.user,
|
||||||
icon: Icons.account_box, hint: 'root'),
|
icon: Icons.account_box, hint: 'root'),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 7),
|
const SizedBox(height: 7),
|
||||||
Row(
|
Row(
|
||||||
children: [
|
children: [
|
||||||
Text(s.keyAuth),
|
Text(_s.keyAuth),
|
||||||
Switch(
|
Switch(
|
||||||
value: usePublicKey,
|
value: usePublicKey,
|
||||||
onChanged: (val) => setState(() => usePublicKey = val)),
|
onChanged: (val) => setState(() => usePublicKey = val)),
|
||||||
@@ -139,51 +145,56 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
),
|
),
|
||||||
!usePublicKey
|
!usePublicKey
|
||||||
? TextField(
|
? TextField(
|
||||||
controller: passwordController,
|
controller: _passwordController,
|
||||||
obscureText: true,
|
obscureText: true,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
decoration: buildDecoration(s.pwd,
|
decoration: buildDecoration(_s.pwd,
|
||||||
icon: Icons.password, hint: s.pwd),
|
icon: Icons.password, hint: _s.pwd),
|
||||||
onSubmitted: (_) => {},
|
onSubmitted: (_) => {},
|
||||||
)
|
)
|
||||||
: const SizedBox(),
|
: const SizedBox(),
|
||||||
usePublicKey
|
usePublicKey
|
||||||
? Consumer<PrivateKeyProvider>(builder: (_, key, __) {
|
? Consumer<PrivateKeyProvider>(
|
||||||
for (var item in key.infos) {
|
builder: (_, key, __) {
|
||||||
if (item.id == widget.spi?.pubKeyId) {
|
for (var item in key.infos) {
|
||||||
_pubKeyIndex ??= key.infos.indexOf(item);
|
if (item.id == widget.spi?.pubKeyId) {
|
||||||
|
_pubKeyIndex ??= key.infos.indexOf(item);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
final tiles = key.infos
|
||||||
final tiles = key.infos
|
.map(
|
||||||
.map(
|
(e) => ListTile(
|
||||||
(e) => ListTile(
|
contentPadding: EdgeInsets.zero,
|
||||||
contentPadding: EdgeInsets.zero,
|
title: Text(e.id, textAlign: TextAlign.start),
|
||||||
title: Text(e.id, textAlign: TextAlign.start),
|
trailing: _buildRadio(key.infos.indexOf(e), e)),
|
||||||
trailing: _buildRadio(key.infos.indexOf(e), e)),
|
)
|
||||||
)
|
.toList();
|
||||||
.toList();
|
tiles.add(
|
||||||
tiles.add(ListTile(
|
ListTile(
|
||||||
title: Text(s.addPrivateKey),
|
title: Text(_s.addPrivateKey),
|
||||||
contentPadding: EdgeInsets.zero,
|
contentPadding: EdgeInsets.zero,
|
||||||
trailing: IconButton(
|
trailing: IconButton(
|
||||||
icon: const Icon(Icons.add),
|
icon: const Icon(Icons.add),
|
||||||
onPressed: () => AppRoute(const PrivateKeyEditPage(),
|
onPressed: () => AppRoute(
|
||||||
'private key edit page')
|
const PrivateKeyEditPage(),
|
||||||
.go(context),
|
'private key edit page')
|
||||||
),
|
.go(context),
|
||||||
));
|
),
|
||||||
return ExpansionTile(
|
),
|
||||||
textColor: primaryColor,
|
);
|
||||||
iconColor: primaryColor,
|
return ExpansionTile(
|
||||||
tilePadding: EdgeInsets.zero,
|
textColor: primaryColor,
|
||||||
childrenPadding: EdgeInsets.zero,
|
iconColor: primaryColor,
|
||||||
title: Text(
|
tilePadding: EdgeInsets.zero,
|
||||||
s.choosePrivateKey,
|
childrenPadding: EdgeInsets.zero,
|
||||||
style: const TextStyle(fontSize: 14),
|
title: Text(
|
||||||
),
|
_s.choosePrivateKey,
|
||||||
children: tiles,
|
style: const TextStyle(fontSize: 14),
|
||||||
);
|
),
|
||||||
})
|
children: tiles,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
: const SizedBox()
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -191,51 +202,53 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.send),
|
child: const Icon(Icons.send),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
if (ipController.text == '') {
|
if (_ipController.text == '') {
|
||||||
showSnackBar(context, Text(s.plzEnterHost));
|
showSnackBar(context, Text(_s.plzEnterHost));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!usePublicKey && passwordController.text == '') {
|
if (!usePublicKey && _passwordController.text == '') {
|
||||||
final cancel = await showRoundDialog<bool>(
|
final cancel = await showRoundDialog<bool>(
|
||||||
context,
|
context,
|
||||||
s.attention,
|
_s.attention,
|
||||||
Text(s.sureNoPwd),
|
Text(_s.sureNoPwd),
|
||||||
[
|
[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(false),
|
onPressed: () => Navigator.of(context).pop(false),
|
||||||
child: Text(s.ok)),
|
child: Text(_s.ok)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(true),
|
onPressed: () => Navigator.of(context).pop(true),
|
||||||
child: Text(s.cancel))
|
child: Text(_s.cancel))
|
||||||
],
|
],
|
||||||
barrierDismiss: false);
|
barrierDismiss: false,
|
||||||
|
);
|
||||||
if (cancel ?? true) {
|
if (cancel ?? true) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (usePublicKey && _pubKeyIndex == -1) {
|
if (usePublicKey && _pubKeyIndex == -1) {
|
||||||
showSnackBar(context, Text(s.plzSelectKey));
|
showSnackBar(context, Text(_s.plzSelectKey));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (usernameController.text == '') {
|
if (_usernameController.text == '') {
|
||||||
usernameController.text = 'root';
|
_usernameController.text = 'root';
|
||||||
}
|
}
|
||||||
if (portController.text == '') {
|
if (_portController.text == '') {
|
||||||
portController.text = '22';
|
_portController.text = '22';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (widget.spi != null && widget.spi!.pubKeyId != null) {
|
if (widget.spi != null && widget.spi!.pubKeyId != null) {
|
||||||
_keyInfo ??= locator<PrivateKeyStore>().get(widget.spi!.pubKeyId!);
|
_keyInfo ??= locator<PrivateKeyStore>().get(widget.spi!.pubKeyId!);
|
||||||
}
|
}
|
||||||
|
|
||||||
final authorization = passwordController.text;
|
final authorization = _passwordController.text;
|
||||||
final spi = ServerPrivateInfo(
|
final spi = ServerPrivateInfo(
|
||||||
name: nameController.text,
|
name: _nameController.text,
|
||||||
ip: ipController.text,
|
ip: _ipController.text,
|
||||||
port: int.parse(portController.text),
|
port: int.parse(_portController.text),
|
||||||
user: usernameController.text,
|
user: _usernameController.text,
|
||||||
pwd: authorization,
|
pwd: authorization,
|
||||||
pubKeyId: usePublicKey ? _keyInfo!.id : null);
|
pubKeyId: usePublicKey ? _keyInfo!.id : null,
|
||||||
|
);
|
||||||
|
|
||||||
if (widget.spi == null) {
|
if (widget.spi == null) {
|
||||||
_serverProvider.addServer(spi);
|
_serverProvider.addServer(spi);
|
||||||
@@ -265,12 +278,12 @@ class _ServerEditPageState extends State<ServerEditPage> with AfterLayoutMixin {
|
|||||||
@override
|
@override
|
||||||
void afterFirstLayout(BuildContext context) {
|
void afterFirstLayout(BuildContext context) {
|
||||||
if (widget.spi != null) {
|
if (widget.spi != null) {
|
||||||
nameController.text = widget.spi?.name ?? '';
|
_nameController.text = widget.spi?.name ?? '';
|
||||||
ipController.text = widget.spi?.ip ?? '';
|
_ipController.text = widget.spi?.ip ?? '';
|
||||||
portController.text = (widget.spi?.port ?? 22).toString();
|
_portController.text = (widget.spi?.port ?? 22).toString();
|
||||||
usernameController.text = widget.spi?.user ?? '';
|
_usernameController.text = widget.spi?.user ?? '';
|
||||||
if (widget.spi?.pubKeyId == null) {
|
if (widget.spi?.pubKeyId == null) {
|
||||||
passwordController.text = widget.spi?.pwd ?? '';
|
_passwordController.text = widget.spi?.pwd ?? '';
|
||||||
} else {
|
} else {
|
||||||
usePublicKey = true;
|
usePublicKey = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,8 @@
|
|||||||
import 'package:after_layout/after_layout.dart';
|
import 'package:after_layout/after_layout.dart';
|
||||||
import 'package:circle_chart/circle_chart.dart';
|
import 'package:circle_chart/circle_chart.dart';
|
||||||
import 'package:dropdown_button2/dropdown_button2.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:pull_to_refresh/pull_to_refresh.dart';
|
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
import 'package:toolbox/core/utils.dart';
|
||||||
import 'package:toolbox/data/model/app/menu_item.dart';
|
import 'package:toolbox/data/model/app/menu_item.dart';
|
||||||
@@ -12,18 +10,24 @@ import 'package:toolbox/data/model/server/server.dart';
|
|||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
import 'package:toolbox/data/model/server/server_private_info.dart';
|
||||||
import 'package:toolbox/data/model/server/server_status.dart';
|
import 'package:toolbox/data/model/server/server_status.dart';
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
import 'package:toolbox/data/provider/server.dart';
|
||||||
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/store/setting.dart';
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
|
import 'package:toolbox/data/res/url.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
import 'package:toolbox/locator.dart';
|
||||||
import 'package:toolbox/view/page/apt.dart';
|
import 'package:toolbox/view/page/pkg.dart';
|
||||||
import 'package:toolbox/view/page/docker.dart';
|
import 'package:toolbox/view/page/docker.dart';
|
||||||
import 'package:toolbox/view/page/server/detail.dart';
|
import 'package:toolbox/view/page/server/detail.dart';
|
||||||
import 'package:toolbox/view/page/server/edit.dart';
|
import 'package:toolbox/view/page/server/edit.dart';
|
||||||
import 'package:toolbox/view/page/sftp/view.dart';
|
import 'package:toolbox/view/page/sftp/view.dart';
|
||||||
import 'package:toolbox/view/page/snippet/list.dart';
|
import 'package:toolbox/view/page/snippet/edit.dart';
|
||||||
|
import 'package:toolbox/view/page/ssh.dart';
|
||||||
|
import 'package:toolbox/view/widget/picker.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
|
import '../../widget/url_text.dart';
|
||||||
|
|
||||||
class ServerPage extends StatefulWidget {
|
class ServerPage extends StatefulWidget {
|
||||||
const ServerPage({Key? key}) : super(key: key);
|
const ServerPage({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@@ -36,16 +40,13 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
late ThemeData _theme;
|
||||||
late Color _primaryColor;
|
late Color _primaryColor;
|
||||||
late RefreshController _refreshController;
|
|
||||||
|
|
||||||
late ServerProvider _serverProvider;
|
late ServerProvider _serverProvider;
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_serverProvider = locator<ServerProvider>();
|
_serverProvider = locator<ServerProvider>();
|
||||||
_refreshController = RefreshController();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -54,54 +55,45 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_theme = Theme.of(context);
|
_theme = Theme.of(context);
|
||||||
_primaryColor = primaryColor;
|
_primaryColor = primaryColor;
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
super.build(context);
|
super.build(context);
|
||||||
final autoUpdate =
|
final child = Consumer<ServerProvider>(
|
||||||
locator<SettingStore>().serverStatusUpdateInterval.fetch() != 0;
|
builder: (_, pro, __) {
|
||||||
final child = Consumer<ServerProvider>(builder: (_, pro, __) {
|
if (pro.servers.isEmpty) {
|
||||||
if (pro.servers.isEmpty) {
|
return Center(
|
||||||
return Center(
|
child: Text(
|
||||||
child: Text(
|
_s.serverTabEmpty,
|
||||||
s.serverTabEmpty,
|
textAlign: TextAlign.center,
|
||||||
textAlign: TextAlign.center,
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return ListView.separated(
|
||||||
|
padding: const EdgeInsets.all(7),
|
||||||
|
controller: ScrollController(),
|
||||||
|
itemBuilder: (ctx, idx) {
|
||||||
|
if (idx == pro.servers.length) {
|
||||||
|
return SizedBox(height: _media.padding.bottom);
|
||||||
|
}
|
||||||
|
return _buildEachServerCard(pro.servers[idx]);
|
||||||
|
},
|
||||||
|
itemCount: pro.servers.length + 1,
|
||||||
|
separatorBuilder: (_, __) => const SizedBox(
|
||||||
|
height: 3,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
return ListView.separated(
|
);
|
||||||
padding: const EdgeInsets.all(7),
|
|
||||||
controller: ScrollController(),
|
|
||||||
itemBuilder: (ctx, idx) {
|
|
||||||
if (idx == pro.servers.length) {
|
|
||||||
return SizedBox(height: _media.padding.bottom);
|
|
||||||
}
|
|
||||||
return _buildEachServerCard(pro.servers[idx]);
|
|
||||||
},
|
|
||||||
itemCount: pro.servers.length + 1,
|
|
||||||
separatorBuilder: (_, __) => const SizedBox(
|
|
||||||
height: 3,
|
|
||||||
),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: autoUpdate
|
body: child,
|
||||||
? child
|
|
||||||
: SmartRefresher(
|
|
||||||
controller: _refreshController,
|
|
||||||
child: child,
|
|
||||||
onRefresh: () async {
|
|
||||||
await _serverProvider.refreshData();
|
|
||||||
_refreshController.refreshCompleted();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
AppRoute(const ServerEditPage(), 'Add server info page')
|
AppRoute(const ServerEditPage(), 'Add server info page')
|
||||||
.go(context),
|
.go(context),
|
||||||
tooltip: s.addAServer,
|
tooltip: _s.addAServer,
|
||||||
heroTag: 'server page fab',
|
heroTag: 'server page fab',
|
||||||
child: const Icon(Icons.add),
|
child: const Icon(Icons.add),
|
||||||
),
|
),
|
||||||
@@ -118,9 +110,10 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
'Edit server info page')
|
'Edit server info page')
|
||||||
.go(context),
|
.go(context),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
child: _buildRealServerCard(
|
child: _buildRealServerCard(
|
||||||
si.status, si.info.name, si.connectionState, si.info)),
|
si.status, si.info.name, si.connectionState, si.info),
|
||||||
|
),
|
||||||
onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
|
onTap: () => AppRoute(ServerDetailPage('${si.info.ip}:${si.info.port}'),
|
||||||
'server detail page')
|
'server detail page')
|
||||||
.go(context),
|
.go(context),
|
||||||
@@ -138,7 +131,7 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
final hasError =
|
final hasError =
|
||||||
cs == ServerConnectionState.failed && ss.failedInfo != null;
|
cs == ServerConnectionState.failed && ss.failedInfo != null;
|
||||||
final style = TextStyle(
|
final style = TextStyle(
|
||||||
color: _theme.textTheme.bodyText1!.color!.withAlpha(100), fontSize: 11);
|
color: _theme.textTheme.bodyLarge!.color!.withAlpha(100), fontSize: 11);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@@ -168,9 +161,11 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
hasError
|
hasError
|
||||||
? GestureDetector(
|
? GestureDetector(
|
||||||
onTap: () => showRoundDialog(
|
onTap: () => showRoundDialog(
|
||||||
context, s.error, Text(ss.failedInfo ?? ''), []),
|
context, _s.error, Text(ss.failedInfo ?? ''), []),
|
||||||
child: Text(s.clickSee, style: style))
|
child: Text(_s.clickSee, style: style))
|
||||||
: Text(topRightStr, style: style, textScaleFactor: 1.0),
|
: Text(topRightStr, style: style, textScaleFactor: 1.0),
|
||||||
|
const SizedBox(width: 9),
|
||||||
|
_buildSSHBtn(spi),
|
||||||
_buildMoreBtn(spi),
|
_buildMoreBtn(spi),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
@@ -205,73 +200,67 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
Widget _buildSSHBtn(ServerPrivateInfo spi) {
|
||||||
return DropdownButtonHideUnderline(
|
return GestureDetector(
|
||||||
child: DropdownButton2(
|
child: const Icon(
|
||||||
customButton: const Padding(
|
Icons.terminal,
|
||||||
padding: EdgeInsets.symmetric(horizontal: 5, vertical: 1.7),
|
size: 21,
|
||||||
child: Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
size: 17,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
customItemsIndexes: [ServerTabMenuItems.firstItems.length],
|
|
||||||
customItemsHeight: 8,
|
|
||||||
items: [
|
|
||||||
...ServerTabMenuItems.firstItems.map(
|
|
||||||
(item) => DropdownMenuItem<DropdownBtnItem>(
|
|
||||||
value: item,
|
|
||||||
child: item.build,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const DropdownMenuItem<Divider>(enabled: false, child: Divider()),
|
|
||||||
...ServerTabMenuItems.secondItems.map(
|
|
||||||
(item) => DropdownMenuItem<DropdownBtnItem>(
|
|
||||||
value: item,
|
|
||||||
child: item.build,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
onChanged: (value) {
|
|
||||||
final item = value as DropdownBtnItem;
|
|
||||||
switch (item) {
|
|
||||||
case ServerTabMenuItems.apt:
|
|
||||||
AppRoute(AptManagePage(spi), 'apt manage page').go(context);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuItems.sftp:
|
|
||||||
AppRoute(SFTPPage(spi), 'SFTP').go(context);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuItems.snippet:
|
|
||||||
AppRoute(
|
|
||||||
SnippetListPage(
|
|
||||||
spi: spi,
|
|
||||||
),
|
|
||||||
'snippet list')
|
|
||||||
.go(context);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuItems.edit:
|
|
||||||
AppRoute(
|
|
||||||
ServerEditPage(
|
|
||||||
spi: spi,
|
|
||||||
),
|
|
||||||
'Edit server info page')
|
|
||||||
.go(context);
|
|
||||||
break;
|
|
||||||
case ServerTabMenuItems.docker:
|
|
||||||
AppRoute(DockerManagePage(spi), 'Docker manage page').go(context);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
itemHeight: 37,
|
|
||||||
itemPadding: const EdgeInsets.only(left: 17, right: 17),
|
|
||||||
dropdownWidth: 160,
|
|
||||||
dropdownPadding: const EdgeInsets.symmetric(vertical: 7),
|
|
||||||
dropdownDecoration: BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.circular(7),
|
|
||||||
),
|
|
||||||
dropdownElevation: 8,
|
|
||||||
offset: const Offset(0, 8),
|
|
||||||
),
|
),
|
||||||
|
onTap: () => showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.attention,
|
||||||
|
UrlText(
|
||||||
|
text: _s.sshTip(issueUrl),
|
||||||
|
replace: 'Github Issue',
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
AppRoute(SSHPage(spi: spi), 'ssh page').go(context);
|
||||||
|
},
|
||||||
|
child: Text(_s.ok),
|
||||||
|
)
|
||||||
|
]),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _buildMoreBtn(ServerPrivateInfo spi) {
|
||||||
|
return buildPopuopMenu(
|
||||||
|
items: <PopupMenuEntry>[
|
||||||
|
...ServerTabMenuItems.firstItems.map(
|
||||||
|
(item) => PopupMenuItem<DropdownBtnItem>(
|
||||||
|
value: item,
|
||||||
|
child: item.build,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const PopupMenuDivider(height: 1),
|
||||||
|
...ServerTabMenuItems.secondItems.map(
|
||||||
|
(item) => PopupMenuItem<DropdownBtnItem>(
|
||||||
|
value: item,
|
||||||
|
child: item.build,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
onSelected: (value) {
|
||||||
|
switch (value as DropdownBtnItem) {
|
||||||
|
case ServerTabMenuItems.pkg:
|
||||||
|
AppRoute(PkgManagePage(spi), 'pkg manage').go(context);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuItems.sftp:
|
||||||
|
AppRoute(SFTPPage(spi), 'SFTP').go(context);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuItems.snippet:
|
||||||
|
_showSnippetDialog(spi.id);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuItems.edit:
|
||||||
|
AppRoute(ServerEditPage(spi: spi), 'Edit server info').go(context);
|
||||||
|
break;
|
||||||
|
case ServerTabMenuItems.docker:
|
||||||
|
AppRoute(DockerManagePage(spi), 'Docker manage').go(context);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,11 +280,11 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
String? failedInfo) {
|
String? failedInfo) {
|
||||||
switch (cs) {
|
switch (cs) {
|
||||||
case ServerConnectionState.disconnected:
|
case ServerConnectionState.disconnected:
|
||||||
return s.disconnected;
|
return _s.disconnected;
|
||||||
case ServerConnectionState.connected:
|
case ServerConnectionState.connected:
|
||||||
if (temp == '') {
|
if (temp == '') {
|
||||||
if (upTime == '') {
|
if (upTime == '') {
|
||||||
return s.serverTabLoading;
|
return _s.serverTabLoading;
|
||||||
} else {
|
} else {
|
||||||
return upTime;
|
return upTime;
|
||||||
}
|
}
|
||||||
@@ -307,23 +296,23 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
case ServerConnectionState.connecting:
|
case ServerConnectionState.connecting:
|
||||||
return s.serverTabConnecting;
|
return _s.serverTabConnecting;
|
||||||
case ServerConnectionState.failed:
|
case ServerConnectionState.failed:
|
||||||
if (failedInfo == null) {
|
if (failedInfo == null) {
|
||||||
return s.serverTabFailed;
|
return _s.serverTabFailed;
|
||||||
}
|
}
|
||||||
if (failedInfo.contains('encypted')) {
|
if (failedInfo.contains('encypted')) {
|
||||||
return s.serverTabPlzSave;
|
return _s.serverTabPlzSave;
|
||||||
}
|
}
|
||||||
return failedInfo;
|
return failedInfo;
|
||||||
default:
|
default:
|
||||||
return s.serverTabUnkown;
|
return _s.serverTabUnkown;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildIOData(String up, String down) {
|
Widget _buildIOData(String up, String down) {
|
||||||
final statusTextStyle = TextStyle(
|
final statusTextStyle = TextStyle(
|
||||||
fontSize: 9, color: _theme.textTheme.bodyText1!.color!.withAlpha(177));
|
fontSize: 9, color: _theme.textTheme.bodyLarge!.color!.withAlpha(177));
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
width: _media.size.width * 0.2,
|
width: _media.size.width * 0.2,
|
||||||
child: Column(
|
child: Column(
|
||||||
@@ -378,6 +367,57 @@ class _ServerPageState extends State<ServerPage>
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showSnippetDialog(String id) {
|
||||||
|
final provider = locator<SnippetProvider>();
|
||||||
|
if (provider.snippets.isEmpty) {
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.attention,
|
||||||
|
Text(_s.noSavedSnippet),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.pop(context),
|
||||||
|
child: Text(_s.ok),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () =>
|
||||||
|
AppRoute(const SnippetEditPage(), 'edit snippet').go(context),
|
||||||
|
child: Text(_s.addOne),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var snippet = provider.snippets.first;
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.choose,
|
||||||
|
buildPicker(provider.snippets.map((e) => Text(e.name)).toList(),
|
||||||
|
(idx) => snippet = provider.snippets[idx]),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
final result =
|
||||||
|
await locator<ServerProvider>().runSnippet(id, snippet);
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.result,
|
||||||
|
Text(result ?? _s.error, style: textSize13),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.ok))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text(_s.run),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
|
|||||||
@@ -23,16 +23,16 @@ class SettingPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SettingPageState extends State<SettingPage> {
|
class _SettingPageState extends State<SettingPage> {
|
||||||
late SettingStore _store;
|
late final SettingStore _setting;
|
||||||
late int _selectedColorValue;
|
late int _selectedColorValue;
|
||||||
late int _launchPageIdx;
|
late int _launchPageIdx;
|
||||||
double _intervalValue = 0;
|
|
||||||
late Color priColor;
|
late Color priColor;
|
||||||
static const textStyle = TextStyle(fontSize: 14);
|
|
||||||
late final ServerProvider _serverProvider;
|
late final ServerProvider _serverProvider;
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late ThemeData _theme;
|
late ThemeData _theme;
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
|
var _updateInterval = 5.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
@@ -40,23 +40,23 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
priColor = primaryColor;
|
priColor = primaryColor;
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
_theme = Theme.of(context);
|
_theme = Theme.of(context);
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_serverProvider = locator<ServerProvider>();
|
_serverProvider = locator<ServerProvider>();
|
||||||
_store = locator<SettingStore>();
|
_setting = locator<SettingStore>();
|
||||||
_launchPageIdx = _store.launchPage.fetch()!;
|
_launchPageIdx = _setting.launchPage.fetch()!;
|
||||||
_intervalValue = _store.serverStatusUpdateInterval.fetch()!.toDouble();
|
_updateInterval = _setting.serverStatusUpdateInterval.fetch()!.toDouble();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(s.setting, style: size18),
|
title: Text(_s.setting),
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(17),
|
padding: const EdgeInsets.all(17),
|
||||||
@@ -64,34 +64,52 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_buildAppColorPreview(),
|
_buildAppColorPreview(),
|
||||||
_buildUpdateInterval(),
|
_buildUpdateInterval(),
|
||||||
_buildCheckUpdate(),
|
_buildCheckUpdate(),
|
||||||
_buildLaunchPage()
|
_buildLaunchPage(),
|
||||||
|
_buildDistLogoSwitch(),
|
||||||
].map((e) => RoundRectCard(e)).toList(),
|
].map((e) => RoundRectCard(e)).toList(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildDistLogoSwitch() {
|
||||||
|
return ListTile(
|
||||||
|
title: Text(
|
||||||
|
_s.showDistLogo,
|
||||||
|
style: textSize13,
|
||||||
|
),
|
||||||
|
subtitle: Text(
|
||||||
|
_s.onServerDetailPage,
|
||||||
|
style: textSize13Grey,
|
||||||
|
),
|
||||||
|
trailing: buildSwitch(context, _setting.showDistLogo),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Widget _buildCheckUpdate() {
|
Widget _buildCheckUpdate() {
|
||||||
return Consumer<AppProvider>(builder: (_, app, __) {
|
return Consumer<AppProvider>(
|
||||||
String display;
|
builder: (_, app, __) {
|
||||||
if (app.newestBuild != null) {
|
String display;
|
||||||
if (app.newestBuild! > BuildData.build) {
|
if (app.newestBuild != null) {
|
||||||
display = s.versionHaveUpdate(app.newestBuild!);
|
if (app.newestBuild! > BuildData.build) {
|
||||||
|
display = _s.versionHaveUpdate(app.newestBuild!);
|
||||||
|
} else {
|
||||||
|
display = _s.versionUpdated(BuildData.build);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
display = s.versionUpdated(BuildData.build);
|
display = _s.versionUnknownUpdate(BuildData.build);
|
||||||
}
|
}
|
||||||
} else {
|
return ListTile(
|
||||||
display = s.versionUnknownUpdate(BuildData.build);
|
|
||||||
}
|
|
||||||
return ListTile(
|
|
||||||
contentPadding: roundRectCardPadding,
|
contentPadding: roundRectCardPadding,
|
||||||
trailing: const Icon(Icons.keyboard_arrow_right),
|
trailing: const Icon(Icons.keyboard_arrow_right),
|
||||||
title: Text(
|
title: Text(
|
||||||
display,
|
display,
|
||||||
style: textStyle,
|
style: textSize13,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
),
|
),
|
||||||
onTap: () => doUpdate(context, force: true));
|
onTap: () => doUpdate(context, force: true),
|
||||||
});
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildUpdateInterval() {
|
Widget _buildUpdateInterval() {
|
||||||
@@ -100,40 +118,40 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
childrenPadding: roundRectCardPadding,
|
childrenPadding: roundRectCardPadding,
|
||||||
textColor: priColor,
|
textColor: priColor,
|
||||||
title: Text(
|
title: Text(
|
||||||
s.updateServerStatusInterval,
|
_s.updateServerStatusInterval,
|
||||||
style: textStyle,
|
style: textSize13,
|
||||||
textAlign: TextAlign.start,
|
textAlign: TextAlign.start,
|
||||||
),
|
),
|
||||||
subtitle: Text(
|
subtitle: Text(
|
||||||
s.willTakEeffectImmediately,
|
_s.willTakEeffectImmediately,
|
||||||
style: const TextStyle(color: Colors.grey, fontSize: 13),
|
style: textSize13Grey,
|
||||||
),
|
),
|
||||||
trailing: Text('${_intervalValue.toInt()} ${s.second}'),
|
trailing: Text('${_updateInterval.toInt()} ${_s.second}'),
|
||||||
children: [
|
children: [
|
||||||
Slider(
|
Slider(
|
||||||
thumbColor: priColor,
|
thumbColor: priColor,
|
||||||
activeColor: priColor.withOpacity(0.7),
|
activeColor: priColor.withOpacity(0.7),
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 10,
|
max: 10,
|
||||||
value: _intervalValue,
|
value: _updateInterval,
|
||||||
onChanged: (newValue) {
|
onChanged: (newValue) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_intervalValue = newValue;
|
_updateInterval = newValue;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
onChangeEnd: (val) {
|
onChangeEnd: (val) {
|
||||||
_store.serverStatusUpdateInterval.put(val.toInt());
|
_setting.serverStatusUpdateInterval.put(val.toInt());
|
||||||
_serverProvider.startAutoRefresh();
|
_serverProvider.startAutoRefresh();
|
||||||
},
|
},
|
||||||
label: '${_intervalValue.toInt()} ${s.second}',
|
label: '${_updateInterval.toInt()} ${_s.second}',
|
||||||
divisions: 10,
|
divisions: 10,
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 3,
|
height: 3,
|
||||||
),
|
),
|
||||||
_intervalValue == 0.0
|
_updateInterval == 0.0
|
||||||
? Text(
|
? Text(
|
||||||
s.updateIntervalEqual0,
|
_s.updateIntervalEqual0,
|
||||||
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
style: const TextStyle(color: Colors.grey, fontSize: 12),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
)
|
)
|
||||||
@@ -147,24 +165,22 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
|
|
||||||
Widget _buildAppColorPreview() {
|
Widget _buildAppColorPreview() {
|
||||||
return ExpansionTile(
|
return ExpansionTile(
|
||||||
textColor: priColor,
|
textColor: priColor,
|
||||||
tilePadding: roundRectCardPadding,
|
tilePadding: roundRectCardPadding,
|
||||||
childrenPadding: roundRectCardPadding,
|
childrenPadding: roundRectCardPadding,
|
||||||
trailing: ClipOval(
|
trailing: ClipOval(
|
||||||
child: Container(
|
child: Container(
|
||||||
color: priColor,
|
color: priColor,
|
||||||
height: 27,
|
height: 27,
|
||||||
width: 27,
|
width: 27,
|
||||||
),
|
|
||||||
),
|
),
|
||||||
title: Text(
|
),
|
||||||
s.appPrimaryColor,
|
title: Text(
|
||||||
style: textStyle,
|
_s.appPrimaryColor,
|
||||||
),
|
style: textSize13,
|
||||||
children: [
|
),
|
||||||
_buildAppColorPicker(priColor),
|
children: [_buildAppColorPicker(priColor), _buildColorPickerConfirmBtn()],
|
||||||
_buildColorPickerConfirmBtn()
|
);
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildAppColorPicker(Color selected) {
|
Widget _buildAppColorPicker(Color selected) {
|
||||||
@@ -180,7 +196,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
return IconButton(
|
return IconButton(
|
||||||
icon: const Icon(Icons.save),
|
icon: const Icon(Icons.save),
|
||||||
onPressed: (() {
|
onPressed: (() {
|
||||||
_store.primaryColor.put(_selectedColorValue);
|
_setting.primaryColor.put(_selectedColorValue);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -192,28 +208,30 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
tilePadding: roundRectCardPadding,
|
tilePadding: roundRectCardPadding,
|
||||||
childrenPadding: roundRectCardPadding,
|
childrenPadding: roundRectCardPadding,
|
||||||
title: Text(
|
title: Text(
|
||||||
s.launchPage,
|
_s.launchPage,
|
||||||
style: textStyle,
|
style: textSize13,
|
||||||
),
|
),
|
||||||
trailing: ConstrainedBox(
|
trailing: ConstrainedBox(
|
||||||
constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
|
constraints: BoxConstraints(maxWidth: _media.size.width * 0.35),
|
||||||
child: Text(
|
child: Text(
|
||||||
tabTitleName(context, _launchPageIdx),
|
tabTitleName(context, _launchPageIdx),
|
||||||
style: textStyle,
|
style: textSize13,
|
||||||
textAlign: TextAlign.right,
|
textAlign: TextAlign.right,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
children: tabs
|
children: tabs
|
||||||
.map((e) => ListTile(
|
.map(
|
||||||
contentPadding: EdgeInsets.zero,
|
(e) => ListTile(
|
||||||
title: Text(
|
contentPadding: EdgeInsets.zero,
|
||||||
tabTitleName(context, tabs.indexOf(e)),
|
title: Text(
|
||||||
style: TextStyle(
|
tabTitleName(context, tabs.indexOf(e)),
|
||||||
fontSize: 14,
|
style: TextStyle(
|
||||||
color: _theme.textTheme.bodyText2!.color!.withAlpha(177)),
|
fontSize: 14,
|
||||||
),
|
color: _theme.textTheme.bodyMedium!.color!.withAlpha(177)),
|
||||||
trailing: _buildRadio(tabs.indexOf(e)),
|
),
|
||||||
))
|
trailing: _buildRadio(tabs.indexOf(e)),
|
||||||
|
),
|
||||||
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -225,7 +243,7 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
onChanged: (int? value) {
|
onChanged: (int? value) {
|
||||||
setState(() {
|
setState(() {
|
||||||
_launchPageIdx = value!;
|
_launchPageIdx = value!;
|
||||||
_store.launchPage.put(value);
|
_setting.launchPage.put(value);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:toolbox/core/extension/colorx.dart';
|
|
||||||
import 'package:toolbox/core/extension/numx.dart';
|
import 'package:toolbox/core/extension/numx.dart';
|
||||||
import 'package:toolbox/core/extension/stringx.dart';
|
import 'package:toolbox/core/extension/stringx.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
@@ -23,8 +22,7 @@ class SFTPDownloadedPage extends StatefulWidget {
|
|||||||
class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
||||||
PathWithPrefix? _path;
|
PathWithPrefix? _path;
|
||||||
String? _prefixPath;
|
String? _prefixPath;
|
||||||
late S s;
|
late S _s;
|
||||||
late ThemeData _theme;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -39,15 +37,14 @@ class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
_theme = Theme.of(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(s.download),
|
title: Text(_s.download),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: const Icon(Icons.downloading),
|
icon: const Icon(Icons.downloading),
|
||||||
@@ -68,7 +65,7 @@ class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
|||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: (() {
|
onPressed: (() {
|
||||||
if (_path!.path == _prefixPath) {
|
if (_path!.path == _prefixPath) {
|
||||||
showSnackBar(context, Text(s.alreadyLastDir));
|
showSnackBar(context, Text(_s.alreadyLastDir));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_path!.update('..');
|
_path!.update('..');
|
||||||
@@ -80,18 +77,13 @@ class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildPath() {
|
Widget _buildPath() {
|
||||||
final color = _theme.scaffoldBackgroundColor;
|
|
||||||
return Container(
|
return Container(
|
||||||
color: color,
|
|
||||||
padding: const EdgeInsets.fromLTRB(11, 7, 11, 11),
|
padding: const EdgeInsets.fromLTRB(11, 7, 11, 11),
|
||||||
child: Column(
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const Divider(),
|
const Divider(),
|
||||||
(_path?.path ?? s.loadingFiles).omitStartStr(
|
(_path?.path ?? _s.loadingFiles).omitStartStr(),
|
||||||
style: TextStyle(
|
|
||||||
color: color.isBrightColor ? Colors.black : Colors.white),
|
|
||||||
)
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -141,44 +133,50 @@ class _SFTPDownloadedPageState extends State<SFTPDownloadedPage> {
|
|||||||
void showFileActionDialog(FileSystemEntity file) {
|
void showFileActionDialog(FileSystemEntity file) {
|
||||||
final fileName = file.path.split('/').last;
|
final fileName = file.path.split('/').last;
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.choose,
|
_s.choose,
|
||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.delete),
|
leading: const Icon(Icons.delete),
|
||||||
title: Text(s.delete),
|
title: Text(_s.delete),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context, s.sureDelete(fileName), const SizedBox(), [
|
context,
|
||||||
|
_s.sureDelete(fileName),
|
||||||
|
const SizedBox(),
|
||||||
|
[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: Text(s.cancel)),
|
child: Text(_s.cancel)),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
file.deleteSync();
|
file.deleteSync();
|
||||||
setState(() {});
|
setState(() {});
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text(s.ok),
|
child: Text(_s.ok),
|
||||||
),
|
),
|
||||||
]);
|
],
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
ListTile(
|
),
|
||||||
leading: const Icon(Icons.open_in_new),
|
ListTile(
|
||||||
title: Text(s.open),
|
leading: const Icon(Icons.open_in_new),
|
||||||
onTap: () {
|
title: Text(_s.open),
|
||||||
shareFiles(context, [file.absolute.path]);
|
onTap: () {
|
||||||
}),
|
shareFiles(context, [file.absolute.path]);
|
||||||
],
|
},
|
||||||
),
|
),
|
||||||
[
|
],
|
||||||
TextButton(
|
),
|
||||||
onPressed: (() => Navigator.of(context).pop()),
|
[
|
||||||
child: Text(s.close))
|
TextButton(
|
||||||
]);
|
onPressed: (() => Navigator.of(context).pop()),
|
||||||
|
child: Text(_s.close))
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ class SFTPDownloadingPage extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -30,8 +30,8 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
|||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(
|
title: Text(
|
||||||
s.download,
|
_s.download,
|
||||||
style: size18,
|
style: textSize18,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
body: _buildBody(),
|
body: _buildBody(),
|
||||||
@@ -42,7 +42,7 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
|||||||
return Consumer<SftpDownloadProvider>(builder: (__, pro, _) {
|
return Consumer<SftpDownloadProvider>(builder: (__, pro, _) {
|
||||||
if (pro.status.isEmpty) {
|
if (pro.status.isEmpty) {
|
||||||
return Center(
|
return Center(
|
||||||
child: Text(s.sftpNoDownloadTask),
|
child: Text(_s.sftpNoDownloadTask),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
@@ -58,16 +58,18 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
|||||||
|
|
||||||
Widget _wrapInCard(SftpDownloadStatus status, String? subtitle,
|
Widget _wrapInCard(SftpDownloadStatus status, String? subtitle,
|
||||||
{Widget? trailing}) {
|
{Widget? trailing}) {
|
||||||
return RoundRectCard(ListTile(
|
return RoundRectCard(
|
||||||
title: Text(status.fileName),
|
ListTile(
|
||||||
subtitle: subtitle == null
|
title: Text(status.fileName),
|
||||||
? null
|
subtitle: subtitle == null
|
||||||
: Text(
|
? null
|
||||||
subtitle,
|
: Text(
|
||||||
style: grey,
|
subtitle,
|
||||||
),
|
style: grey,
|
||||||
trailing: trailing,
|
),
|
||||||
));
|
trailing: trailing,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildItem(SftpDownloadStatus status) {
|
Widget _buildItem(SftpDownloadStatus status) {
|
||||||
@@ -77,28 +79,34 @@ class _SFTPDownloadingPageState extends State<SFTPDownloadingPage> {
|
|||||||
switch (status.status) {
|
switch (status.status) {
|
||||||
case SftpWorkerStatus.finished:
|
case SftpWorkerStatus.finished:
|
||||||
final time = status.spentTime.toString();
|
final time = status.spentTime.toString();
|
||||||
return _wrapInCard(status,
|
return _wrapInCard(
|
||||||
'${s.downloadFinished} ${s.spentTime(time == 'null' ? s.unknown : (time.substring(0, time.length - 7)))}',
|
status,
|
||||||
trailing: IconButton(
|
'${_s.downloadFinished} ${_s.spentTime(time == 'null' ? _s.unknown : (time.substring(0, time.length - 7)))}',
|
||||||
onPressed: () => shareFiles(context, [status.item.localPath]),
|
trailing: IconButton(
|
||||||
icon: const Icon(Icons.open_in_new)));
|
onPressed: () => shareFiles(context, [status.item.localPath]),
|
||||||
|
icon: const Icon(Icons.open_in_new),
|
||||||
|
),
|
||||||
|
);
|
||||||
case SftpWorkerStatus.downloading:
|
case SftpWorkerStatus.downloading:
|
||||||
return _wrapInCard(
|
return _wrapInCard(
|
||||||
status,
|
status,
|
||||||
s.downloadStatus((status.progress ?? 0.0).toStringAsFixed(2),
|
_s.downloadStatus((status.progress ?? 0.0).toStringAsFixed(2),
|
||||||
(status.size ?? 0).convertBytes),
|
(status.size ?? 0).convertBytes),
|
||||||
trailing:
|
trailing:
|
||||||
CircularProgressIndicator(value: (status.progress ?? 0) / 100));
|
CircularProgressIndicator(value: (status.progress ?? 0) / 100));
|
||||||
case SftpWorkerStatus.preparing:
|
case SftpWorkerStatus.preparing:
|
||||||
return _wrapInCard(status, s.sftpDlPrepare, trailing: loadingIcon);
|
return _wrapInCard(status, _s.sftpDlPrepare, trailing: loadingIcon);
|
||||||
case SftpWorkerStatus.sshConnectted:
|
case SftpWorkerStatus.sshConnectted:
|
||||||
return _wrapInCard(status, s.sftpSSHConnected, trailing: loadingIcon);
|
return _wrapInCard(status, _s.sftpSSHConnected, trailing: loadingIcon);
|
||||||
default:
|
default:
|
||||||
return _wrapInCard(status, s.unknown,
|
return _wrapInCard(
|
||||||
trailing: const Icon(
|
status,
|
||||||
Icons.error,
|
_s.unknown,
|
||||||
size: 40,
|
trailing: const Icon(
|
||||||
));
|
Icons.error,
|
||||||
|
size: 40,
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,62 +31,131 @@ class SFTPPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _SFTPPageState extends State<SFTPPage> {
|
class _SFTPPageState extends State<SFTPPage> {
|
||||||
final SftpBrowserStatus _status = SftpBrowserStatus();
|
final SftpBrowserStatus _status = SftpBrowserStatus();
|
||||||
|
|
||||||
final ScrollController _scrollController = ScrollController();
|
final ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
late MediaQueryData _media;
|
late MediaQueryData _media;
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
|
ServerInfo? _si;
|
||||||
|
SSHClient? _client;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
_media = MediaQuery.of(context);
|
_media = MediaQuery.of(context);
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_status.spi = widget.spi;
|
final serverProvider = locator<ServerProvider>();
|
||||||
_status.selected = true;
|
_si = serverProvider.servers.firstWhere((s) => s.info == widget.spi);
|
||||||
|
_client = _si?.client;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
title: TwoLineText(up: 'SFTP', down: widget.spi.name),
|
title: TwoLineText(up: 'SFTP', down: widget.spi.name),
|
||||||
actions: [
|
actions: [
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: (() => showRoundDialog(
|
onPressed: (() => showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.choose,
|
_s.choose,
|
||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.folder),
|
leading: const Icon(Icons.folder),
|
||||||
title: Text(s.createFolder),
|
title: Text(_s.createFolder),
|
||||||
onTap: () => mkdir(context)),
|
onTap: () => mkdir(context)),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.insert_drive_file),
|
leading: const Icon(Icons.insert_drive_file),
|
||||||
title: Text(s.createFile),
|
title: Text(_s.createFile),
|
||||||
onTap: () => newFile(context)),
|
onTap: () => newFile(context)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
[
|
[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: Text(s.close))
|
child: Text(_s.close))
|
||||||
])),
|
],
|
||||||
icon: const Icon(Icons.add),
|
)),
|
||||||
)
|
icon: const Icon(Icons.add),
|
||||||
]),
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
body: _buildFileView(),
|
body: _buildFileView(),
|
||||||
|
bottomNavigationBar: _buildPath(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Widget _buildPath() {
|
||||||
|
return SafeArea(
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.fromLTRB(11, 7, 11, 11),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
const Divider(),
|
||||||
|
(_status.path?.path ?? _s.loadingFiles).omitStartStr(),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () async {
|
||||||
|
await backward();
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.arrow_back),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
onPressed: () async {
|
||||||
|
final p = await showRoundDialog<String?>(
|
||||||
|
context,
|
||||||
|
_s.goto,
|
||||||
|
Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
TextField(
|
||||||
|
decoration: InputDecoration(
|
||||||
|
labelText: _s.path,
|
||||||
|
hintText: '/',
|
||||||
|
),
|
||||||
|
onSubmitted: (value) =>
|
||||||
|
Navigator.of(context).pop(value),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel))
|
||||||
|
],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (p != null) {
|
||||||
|
if (p.isEmpty) {
|
||||||
|
showSnackBar(context, Text(_s.fieldMustNotEmpty));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_status.path?.update(p);
|
||||||
|
listDir(path: p);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: const Icon(Icons.gps_fixed),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
Widget get centerCircleLoading => Center(
|
Widget get centerCircleLoading => Center(
|
||||||
child: Column(
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
@@ -99,272 +168,333 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
);
|
);
|
||||||
|
|
||||||
Widget _buildFileView() {
|
Widget _buildFileView() {
|
||||||
if (!_status.selected) {
|
if (_client == null ||
|
||||||
return ListView(
|
_si?.connectionState != ServerConnectionState.connected) {
|
||||||
children: [
|
return centerCircleLoading;
|
||||||
_buildDestSelector(),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
final spi = _status.spi;
|
|
||||||
final si =
|
if (_status.isBusy) {
|
||||||
locator<ServerProvider>().servers.firstWhere((s) => s.info == spi);
|
|
||||||
final client = si.client;
|
|
||||||
if (client == null ||
|
|
||||||
si.connectionState != ServerConnectionState.connected) {
|
|
||||||
return centerCircleLoading;
|
return centerCircleLoading;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_status.files == null) {
|
if (_status.files == null) {
|
||||||
_status.path = AbsolutePath('/');
|
_status.path = AbsolutePath('/');
|
||||||
listDir(path: '/', client: client);
|
listDir(path: '/', client: _client);
|
||||||
return centerCircleLoading;
|
return centerCircleLoading;
|
||||||
} else {
|
} else {
|
||||||
return RefreshIndicator(
|
return RefreshIndicator(
|
||||||
child: FadeIn(
|
child: FadeIn(
|
||||||
key: Key(_status.spi!.name + _status.path!.path),
|
key: Key(widget.spi.name + _status.path!.path),
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemCount: _status.files!.length + 1,
|
itemCount: _status.files!.length,
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index == 0) {
|
final file = _status.files![index];
|
||||||
return _buildDestSelector();
|
final isDir = file.attr.isDirectory;
|
||||||
}
|
return ListTile(
|
||||||
final file = _status.files![index - 1];
|
leading: Icon(isDir ? Icons.folder : Icons.insert_drive_file),
|
||||||
final isDir = file.attr.isDirectory;
|
title: Text(file.filename),
|
||||||
return ListTile(
|
trailing: Text(
|
||||||
leading: Icon(isDir ? Icons.folder : Icons.insert_drive_file),
|
'${getTime(file.attr.modifyTime)}\n${getMode(file.attr.mode)}',
|
||||||
title: Text(file.filename),
|
style: const TextStyle(color: Colors.grey),
|
||||||
trailing: Text(
|
textAlign: TextAlign.right,
|
||||||
DateTime.fromMillisecondsSinceEpoch(
|
),
|
||||||
(file.attr.modifyTime ?? 0) * 1000)
|
subtitle:
|
||||||
.toString()
|
isDir ? null : Text((file.attr.size ?? 0).convertBytes),
|
||||||
.replaceFirst('.000', ''),
|
onTap: () {
|
||||||
style: const TextStyle(color: Colors.grey),
|
if (isDir) {
|
||||||
),
|
_status.path?.update(file.filename);
|
||||||
subtitle:
|
listDir(path: _status.path?.path);
|
||||||
isDir ? null : Text((file.attr.size ?? 0).convertBytes),
|
} else {
|
||||||
onTap: () {
|
onItemPress(context, file, true);
|
||||||
if (isDir) {
|
}
|
||||||
_status.path?.update(file.filename);
|
},
|
||||||
listDir(path: _status.path?.path);
|
onLongPress: () => onItemPress(context, file, false),
|
||||||
} else {
|
);
|
||||||
onItemPress(context, file, true);
|
},
|
||||||
}
|
|
||||||
},
|
|
||||||
onLongPress: () => onItemPress(context, file, false),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onRefresh: () => listDir(path: _status.path?.path));
|
),
|
||||||
|
onRefresh: () => listDir(path: _status.path?.path),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getTime(int? unixMill) {
|
||||||
|
return DateTime.fromMillisecondsSinceEpoch((unixMill ?? 0) * 1000)
|
||||||
|
.toString()
|
||||||
|
.replaceFirst('.000', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
String getMode(SftpFileMode? mode) {
|
||||||
|
if (mode == null) {
|
||||||
|
return '---';
|
||||||
|
}
|
||||||
|
|
||||||
|
final user = getRoleMode(mode.userRead, mode.userWrite, mode.userExecute);
|
||||||
|
final group =
|
||||||
|
getRoleMode(mode.groupRead, mode.groupWrite, mode.groupExecute);
|
||||||
|
final other =
|
||||||
|
getRoleMode(mode.otherRead, mode.otherWrite, mode.otherExecute);
|
||||||
|
|
||||||
|
return '$user$group$other';
|
||||||
|
}
|
||||||
|
|
||||||
|
String getRoleMode(bool r, bool w, bool x) {
|
||||||
|
return '${r ? 'r' : '-'}${w ? 'w' : '-'}${x ? 'x' : '-'}';
|
||||||
|
}
|
||||||
|
|
||||||
void onItemPress(BuildContext context, SftpName file, bool showDownload) {
|
void onItemPress(BuildContext context, SftpName file, bool showDownload) {
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.choose,
|
_s.choose,
|
||||||
Column(
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.delete),
|
leading: const Icon(Icons.delete),
|
||||||
title: Text(s.delete),
|
title: Text(_s.delete),
|
||||||
onTap: () => delete(context, file),
|
onTap: () => delete(context, file),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.edit),
|
leading: const Icon(Icons.edit),
|
||||||
title: Text(s.rename),
|
title: Text(_s.rename),
|
||||||
onTap: () => rename(context, file),
|
onTap: () => rename(context, file),
|
||||||
),
|
),
|
||||||
showDownload
|
showDownload
|
||||||
? ListTile(
|
? ListTile(
|
||||||
leading: const Icon(Icons.download),
|
leading: const Icon(Icons.download),
|
||||||
title: Text(s.download),
|
title: Text(_s.download),
|
||||||
onTap: () => download(context, file),
|
onTap: () => download(context, file),
|
||||||
)
|
)
|
||||||
: const SizedBox()
|
: const SizedBox()
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
[
|
[
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: Text(s.cancel))
|
child: Text(_s.cancel))
|
||||||
]);
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void download(BuildContext context, SftpName name) {
|
void download(BuildContext context, SftpName name) {
|
||||||
showRoundDialog(context, s.download,
|
showRoundDialog(
|
||||||
Text('${s.dl2Local(name.filename)}\n${s.keepForeground}'), [
|
context,
|
||||||
TextButton(
|
_s.download,
|
||||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.cancel)),
|
Text('${_s.dl2Local(name.filename)}\n${_s.keepForeground}'),
|
||||||
TextButton(
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel)),
|
||||||
|
TextButton(
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
final prePath = _status.path!.path;
|
final prePath = _status.path!.path;
|
||||||
final remotePath =
|
final remotePath =
|
||||||
prePath + (prePath.endsWith('/') ? '' : '/') + name.filename;
|
prePath + (prePath.endsWith('/') ? '' : '/') + name.filename;
|
||||||
final local = '${(await sftpDownloadDir).path}$remotePath';
|
final local = '${(await sftpDownloadDir).path}$remotePath';
|
||||||
final pubKeyId = _status.spi!.pubKeyId;
|
final pubKeyId = widget.spi.pubKeyId;
|
||||||
|
|
||||||
locator<SftpDownloadProvider>().add(
|
locator<SftpDownloadProvider>().add(
|
||||||
DownloadItem(_status.spi!, remotePath, local),
|
DownloadItem(
|
||||||
key: pubKeyId == null
|
widget.spi,
|
||||||
? null
|
remotePath,
|
||||||
: locator<PrivateKeyStore>().get(pubKeyId).privateKey);
|
local,
|
||||||
|
),
|
||||||
|
key: pubKeyId == null
|
||||||
|
? null
|
||||||
|
: locator<PrivateKeyStore>().get(pubKeyId).privateKey,
|
||||||
|
);
|
||||||
|
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
showRoundDialog(context, s.goSftpDlPage, const SizedBox(), [
|
showRoundDialog(
|
||||||
TextButton(
|
context,
|
||||||
|
_s.goSftpDlPage,
|
||||||
|
const SizedBox(),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: Text(s.cancel)),
|
child: Text(_s.cancel),
|
||||||
TextButton(
|
),
|
||||||
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
AppRoute(const SFTPDownloadingPage(), 'sftp downloading')
|
AppRoute(const SFTPDownloadingPage(), 'sftp downloading')
|
||||||
.go(context);
|
.go(context);
|
||||||
},
|
},
|
||||||
child: Text(s.ok))
|
child: Text(_s.ok),
|
||||||
]);
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
},
|
},
|
||||||
child: Text(s.download))
|
child: Text(_s.download),
|
||||||
]);
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete(BuildContext context, SftpName file) {
|
void delete(BuildContext context, SftpName file) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
showRoundDialog(context, s.attention, Text(s.sureDelete(file.filename)), [
|
showRoundDialog(
|
||||||
TextButton(
|
context,
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
_s.attention,
|
||||||
child: const Text('Cancel')),
|
Text(_s.sureDelete(file.filename)),
|
||||||
TextButton(
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: const Text('Cancel')),
|
||||||
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
_status.client!.remove(file.filename);
|
_status.client!.remove(file.filename);
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
listDir();
|
listDir();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
s.delete,
|
_s.delete,
|
||||||
style: const TextStyle(color: Colors.red),
|
style: const TextStyle(color: Colors.red),
|
||||||
)),
|
),
|
||||||
]);
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void mkdir(BuildContext context) {
|
void mkdir(BuildContext context) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
final textController = TextEditingController();
|
final textController = TextEditingController();
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.createFolder,
|
_s.createFolder,
|
||||||
TextField(
|
TextField(
|
||||||
controller: textController,
|
controller: textController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: s.name,
|
labelText: _s.name,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
if (textController.text == '') {
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.attention,
|
||||||
|
Text(_s.fieldMustNotEmpty),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.ok)),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_status.client!
|
||||||
|
.mkdir('${_status.path!.path}/${textController.text}');
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
listDir();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_s.ok,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
[
|
],
|
||||||
TextButton(
|
);
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(s.cancel)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
if (textController.text == '') {
|
|
||||||
showRoundDialog(
|
|
||||||
context, s.attention, Text(s.fieldMustNotEmpty), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(s.ok)),
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
_status.client!
|
|
||||||
.mkdir('${_status.path!.path}/${textController.text}');
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
listDir();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
)),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void newFile(BuildContext context) {
|
void newFile(BuildContext context) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
final textController = TextEditingController();
|
final textController = TextEditingController();
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.createFile,
|
_s.createFile,
|
||||||
TextField(
|
TextField(
|
||||||
controller: textController,
|
controller: textController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: s.name,
|
labelText: _s.name,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel),
|
||||||
|
),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (textController.text == '') {
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.attention,
|
||||||
|
Text(_s.fieldMustNotEmpty),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
(await _status.client!
|
||||||
|
.open('${_status.path!.path}/${textController.text}'))
|
||||||
|
.writeBytes(Uint8List(0));
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
listDir();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_s.ok,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
[
|
],
|
||||||
TextButton(
|
);
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(s.cancel)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
if (textController.text == '') {
|
|
||||||
showRoundDialog(
|
|
||||||
context, s.attention, Text(s.fieldMustNotEmpty), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(s.ok)),
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
(await _status.client!
|
|
||||||
.open('${_status.path!.path}/${textController.text}'))
|
|
||||||
.writeBytes(Uint8List(0));
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
listDir();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
s.ok,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
)),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void rename(BuildContext context, SftpName file) {
|
void rename(BuildContext context, SftpName file) {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
final textController = TextEditingController();
|
final textController = TextEditingController();
|
||||||
showRoundDialog(
|
showRoundDialog(
|
||||||
context,
|
context,
|
||||||
s.rename,
|
_s.rename,
|
||||||
TextField(
|
TextField(
|
||||||
controller: textController,
|
controller: textController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: s.name,
|
labelText: _s.name,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.cancel)),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (textController.text == '') {
|
||||||
|
showRoundDialog(
|
||||||
|
context,
|
||||||
|
_s.attention,
|
||||||
|
Text(_s.fieldMustNotEmpty),
|
||||||
|
[
|
||||||
|
TextButton(
|
||||||
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.ok),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await _status.client!.rename(file.filename, textController.text);
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
listDir();
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
_s.rename,
|
||||||
|
style: const TextStyle(color: Colors.red),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
[
|
],
|
||||||
TextButton(
|
);
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(s.cancel)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async {
|
|
||||||
if (textController.text == '') {
|
|
||||||
showRoundDialog(
|
|
||||||
context, s.attention, Text(s.fieldMustNotEmpty), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
|
||||||
child: Text(s.ok)),
|
|
||||||
]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await _status.client!
|
|
||||||
.rename(file.filename, textController.text);
|
|
||||||
Navigator.of(context).pop();
|
|
||||||
listDir();
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
s.rename,
|
|
||||||
style: const TextStyle(color: Colors.red),
|
|
||||||
)),
|
|
||||||
]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> listDir({String? path, SSHClient? client}) async {
|
Future<void> listDir({String? path, SSHClient? client}) async {
|
||||||
@@ -378,7 +508,7 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
final fs =
|
final fs =
|
||||||
await _status.client!.listdir(path ?? (_status.path?.path ?? '/'));
|
await _status.client!.listdir(path ?? _status.path?.path ?? '/');
|
||||||
fs.sort((a, b) => a.filename.compareTo(b.filename));
|
fs.sort((a, b) => a.filename.compareTo(b.filename));
|
||||||
fs.removeAt(0);
|
fs.removeAt(0);
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
@@ -388,44 +518,24 @@ class _SFTPPageState extends State<SFTPPage> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
await showRoundDialog(context, s.error, Text(e.toString()), [
|
await showRoundDialog(
|
||||||
TextButton(
|
context,
|
||||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.ok))
|
_s.error,
|
||||||
]);
|
Text(e.toString()),
|
||||||
if (_status.path!.undo()) {
|
[
|
||||||
await listDir();
|
TextButton(
|
||||||
}
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
|
child: Text(_s.ok),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
);
|
||||||
|
await backward();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildDestSelector() {
|
Future<void> backward() async {
|
||||||
final str = _status.path?.path;
|
if (_status.path!.undo()) {
|
||||||
return ExpansionTile(
|
await listDir();
|
||||||
title: Text(_status.spi?.name ?? s.chooseDestination),
|
}
|
||||||
subtitle: _status.selected
|
|
||||||
? str!.omitStartStr(style: const TextStyle(color: Colors.grey))
|
|
||||||
: null,
|
|
||||||
children: locator<ServerProvider>()
|
|
||||||
.servers
|
|
||||||
.map((e) => _buildDestSelectorItem(e.info))
|
|
||||||
.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
Widget _buildDestSelectorItem(ServerPrivateInfo spi) {
|
|
||||||
return ListTile(
|
|
||||||
title: Text(spi.name),
|
|
||||||
subtitle: Text('${spi.user}@${spi.ip}:${spi.port}'),
|
|
||||||
onTap: () {
|
|
||||||
_status.spi = spi;
|
|
||||||
_status.selected = true;
|
|
||||||
_status.path = AbsolutePath('/');
|
|
||||||
listDir(
|
|
||||||
client: locator<ServerProvider>()
|
|
||||||
.servers
|
|
||||||
.firstWhere((s) => s.info == spi)
|
|
||||||
.client,
|
|
||||||
path: '/');
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,12 +19,12 @@ class SnippetEditPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _SnippetEditPageState extends State<SnippetEditPage>
|
class _SnippetEditPageState extends State<SnippetEditPage>
|
||||||
with AfterLayoutMixin {
|
with AfterLayoutMixin {
|
||||||
final nameController = TextEditingController();
|
final _nameController = TextEditingController();
|
||||||
final scriptController = TextEditingController();
|
final _scriptController = TextEditingController();
|
||||||
final scriptNode = FocusNode();
|
final _scriptNode = FocusNode();
|
||||||
|
|
||||||
late SnippetProvider _provider;
|
late SnippetProvider _provider;
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -35,51 +35,55 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
|||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text(s.edit, style: size18), actions: [
|
appBar: AppBar(
|
||||||
widget.snippet != null
|
title: Text(_s.edit, style: textSize18),
|
||||||
? IconButton(
|
actions: [
|
||||||
onPressed: () {
|
widget.snippet != null
|
||||||
_provider.del(widget.snippet!);
|
? IconButton(
|
||||||
Navigator.of(context).pop();
|
onPressed: () {
|
||||||
},
|
_provider.del(widget.snippet!);
|
||||||
tooltip: s.delete,
|
Navigator.of(context).pop();
|
||||||
icon: const Icon(Icons.delete))
|
},
|
||||||
: const SizedBox()
|
tooltip: _s.delete,
|
||||||
]),
|
icon: const Icon(Icons.delete))
|
||||||
|
: const SizedBox()
|
||||||
|
],
|
||||||
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.all(13),
|
padding: const EdgeInsets.all(13),
|
||||||
children: [
|
children: [
|
||||||
TextField(
|
TextField(
|
||||||
controller: nameController,
|
controller: _nameController,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
onSubmitted: (_) => FocusScope.of(context).requestFocus(scriptNode),
|
onSubmitted: (_) =>
|
||||||
decoration: buildDecoration(s.name, icon: Icons.info),
|
FocusScope.of(context).requestFocus(_scriptNode),
|
||||||
|
decoration: buildDecoration(_s.name, icon: Icons.info),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
controller: scriptController,
|
controller: _scriptController,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
focusNode: scriptNode,
|
focusNode: _scriptNode,
|
||||||
minLines: 3,
|
minLines: 3,
|
||||||
maxLines: 10,
|
maxLines: 10,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
decoration: buildDecoration(s.snippet, icon: Icons.code),
|
decoration: buildDecoration(_s.snippet, icon: Icons.code),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
child: const Icon(Icons.send),
|
child: const Icon(Icons.send),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
final name = nameController.text;
|
final name = _nameController.text;
|
||||||
final script = scriptController.text;
|
final script = _scriptController.text;
|
||||||
if (name.isEmpty || script.isEmpty) {
|
if (name.isEmpty || script.isEmpty) {
|
||||||
showSnackBar(context, Text(s.fieldMustNotEmpty));
|
showSnackBar(context, Text(_s.fieldMustNotEmpty));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final snippet = Snippet(name, script);
|
final snippet = Snippet(name, script);
|
||||||
@@ -97,8 +101,8 @@ class _SnippetEditPageState extends State<SnippetEditPage>
|
|||||||
@override
|
@override
|
||||||
void afterFirstLayout(BuildContext context) {
|
void afterFirstLayout(BuildContext context) {
|
||||||
if (widget.snippet != null) {
|
if (widget.snippet != null) {
|
||||||
nameController.text = widget.snippet!.name;
|
_nameController.text = widget.snippet!.name;
|
||||||
scriptController.text = widget.snippet!.script;
|
_scriptController.text = widget.snippet!.script;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +1,37 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:toolbox/core/route.dart';
|
import 'package:toolbox/core/route.dart';
|
||||||
import 'package:toolbox/core/utils.dart';
|
|
||||||
import 'package:toolbox/data/model/server/server_private_info.dart';
|
|
||||||
import 'package:toolbox/data/model/server/snippet.dart';
|
|
||||||
import 'package:toolbox/data/provider/server.dart';
|
|
||||||
import 'package:toolbox/data/provider/snippet.dart';
|
import 'package:toolbox/data/provider/snippet.dart';
|
||||||
import 'package:toolbox/data/res/color.dart';
|
import 'package:toolbox/data/res/color.dart';
|
||||||
import 'package:toolbox/data/res/font_style.dart';
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
import 'package:toolbox/data/res/padding.dart';
|
import 'package:toolbox/data/res/padding.dart';
|
||||||
import 'package:toolbox/generated/l10n.dart';
|
import 'package:toolbox/generated/l10n.dart';
|
||||||
import 'package:toolbox/locator.dart';
|
|
||||||
import 'package:toolbox/view/page/snippet/edit.dart';
|
import 'package:toolbox/view/page/snippet/edit.dart';
|
||||||
import 'package:toolbox/view/widget/round_rect_card.dart';
|
import 'package:toolbox/view/widget/round_rect_card.dart';
|
||||||
|
|
||||||
class SnippetListPage extends StatefulWidget {
|
class SnippetListPage extends StatefulWidget {
|
||||||
const SnippetListPage({Key? key, this.spi}) : super(key: key);
|
const SnippetListPage({Key? key}) : super(key: key);
|
||||||
final ServerPrivateInfo? spi;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
_SnippetListPageState createState() => _SnippetListPageState();
|
_SnippetListPageState createState() => _SnippetListPageState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _SnippetListPageState extends State<SnippetListPage> {
|
class _SnippetListPageState extends State<SnippetListPage> {
|
||||||
late ServerPrivateInfo _selectedIndex;
|
|
||||||
|
|
||||||
final _textStyle = TextStyle(color: primaryColor);
|
final _textStyle = TextStyle(color: primaryColor);
|
||||||
|
|
||||||
late S s;
|
late S _s;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didChangeDependencies() {
|
void didChangeDependencies() {
|
||||||
super.didChangeDependencies();
|
super.didChangeDependencies();
|
||||||
s = S.of(context);
|
_s = S.of(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: Text(s.snippet, style: size18),
|
title: Text(_s.snippet, style: textSize18),
|
||||||
),
|
),
|
||||||
body: _buildBody(),
|
body: _buildBody(),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
@@ -53,113 +45,45 @@ class _SnippetListPageState extends State<SnippetListPage> {
|
|||||||
Widget _buildBody() {
|
Widget _buildBody() {
|
||||||
return Consumer<SnippetProvider>(
|
return Consumer<SnippetProvider>(
|
||||||
builder: (_, key, __) {
|
builder: (_, key, __) {
|
||||||
return key.snippets.isNotEmpty
|
if (key.snippets.isEmpty) {
|
||||||
? ListView.builder(
|
return Center(
|
||||||
padding: const EdgeInsets.all(13),
|
child: Text(_s.noSavedSnippet),
|
||||||
itemCount: key.snippets.length,
|
);
|
||||||
itemExtent: 57,
|
}
|
||||||
itemBuilder: (context, idx) {
|
|
||||||
return RoundRectCard(Padding(
|
return ListView.builder(
|
||||||
padding: roundRectCardPadding,
|
padding: const EdgeInsets.all(13),
|
||||||
child: Row(
|
itemCount: key.snippets.length,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
itemExtent: 57,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
itemBuilder: (context, idx) {
|
||||||
children: [
|
return RoundRectCard(
|
||||||
Text(
|
Padding(
|
||||||
key.snippets[idx].name,
|
padding: roundRectCardPadding,
|
||||||
textAlign: TextAlign.center,
|
child: Row(
|
||||||
),
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
Row(children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
TextButton(
|
children: [
|
||||||
onPressed: () => AppRoute(
|
Text(
|
||||||
SnippetEditPage(
|
key.snippets[idx].name,
|
||||||
snippet: key.snippets[idx]),
|
textAlign: TextAlign.center,
|
||||||
'snippet edit page')
|
|
||||||
.go(context),
|
|
||||||
child: Text(
|
|
||||||
s.edit,
|
|
||||||
style: _textStyle,
|
|
||||||
)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () {
|
|
||||||
final snippet = key.snippets[idx];
|
|
||||||
if (widget.spi == null) {
|
|
||||||
_showRunDialog(snippet);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
run(context, snippet);
|
|
||||||
},
|
|
||||||
child: Text(
|
|
||||||
s.run,
|
|
||||||
style: _textStyle,
|
|
||||||
))
|
|
||||||
])
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
));
|
TextButton(
|
||||||
})
|
onPressed: () => AppRoute(
|
||||||
: Center(child: Text(s.noSavedSnippet));
|
SnippetEditPage(snippet: key.snippets[idx]),
|
||||||
|
'snippet edit page')
|
||||||
|
.go(context),
|
||||||
|
child: Text(
|
||||||
|
_s.edit,
|
||||||
|
style: _textStyle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _showRunDialog(Snippet snippet) {
|
|
||||||
showRoundDialog(context, s.chooseDestination,
|
|
||||||
Consumer<ServerProvider>(builder: (_, provider, __) {
|
|
||||||
if (provider.servers.isEmpty) {
|
|
||||||
return Text(s.noServerAvailable);
|
|
||||||
}
|
|
||||||
_selectedIndex = provider.servers.first.info;
|
|
||||||
return SizedBox(
|
|
||||||
height: 111,
|
|
||||||
child: Stack(children: [
|
|
||||||
Positioned(
|
|
||||||
top: 36,
|
|
||||||
bottom: 36,
|
|
||||||
left: 0,
|
|
||||||
right: 0,
|
|
||||||
child: Container(
|
|
||||||
height: 37,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(7)),
|
|
||||||
color: Colors.black12,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
ListWheelScrollView.useDelegate(
|
|
||||||
itemExtent: 37,
|
|
||||||
diameterRatio: 1.2,
|
|
||||||
controller: FixedExtentScrollController(initialItem: 0),
|
|
||||||
onSelectedItemChanged: (idx) =>
|
|
||||||
_selectedIndex = provider.servers[idx].info,
|
|
||||||
physics: const FixedExtentScrollPhysics(),
|
|
||||||
childDelegate: ListWheelChildBuilderDelegate(
|
|
||||||
builder: (context, index) => Center(
|
|
||||||
child: Text(
|
|
||||||
provider.servers[index].info.name,
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
childCount: provider.servers.length),
|
|
||||||
)
|
|
||||||
]));
|
|
||||||
}), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () async => run(context, snippet), child: Text(s.run)),
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.cancel)),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
Future<void> run(BuildContext context, Snippet snippet) async {
|
|
||||||
final result = await locator<ServerProvider>()
|
|
||||||
.runSnippet(widget.spi ?? _selectedIndex, snippet);
|
|
||||||
if (result != null) {
|
|
||||||
showRoundDialog(context, s.result,
|
|
||||||
Text(result, style: const TextStyle(fontSize: 13)), [
|
|
||||||
TextButton(
|
|
||||||
onPressed: () => Navigator.of(context).pop(), child: Text(s.close))
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
119
lib/view/page/ssh.dart
Normal file
119
lib/view/page/ssh.dart
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:dartssh2/dartssh2.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
import 'package:toolbox/data/res/font_style.dart';
|
||||||
|
import 'package:xterm/xterm.dart';
|
||||||
|
|
||||||
|
import '../../core/utils.dart';
|
||||||
|
import '../../data/model/server/server_private_info.dart';
|
||||||
|
import '../../data/provider/server.dart';
|
||||||
|
import '../../data/res/terminal_theme.dart';
|
||||||
|
import '../../locator.dart';
|
||||||
|
import '../widget/virtual_keyboard.dart';
|
||||||
|
|
||||||
|
class SSHPage extends StatefulWidget {
|
||||||
|
final ServerPrivateInfo spi;
|
||||||
|
const SSHPage({Key? key, required this.spi}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
_SSHPageState createState() => _SSHPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SSHPageState extends State<SSHPage> {
|
||||||
|
late final terminal = Terminal(inputHandler: keyboard);
|
||||||
|
late final SSHSession session;
|
||||||
|
final keyboard = VirtualKeyboard(defaultInputHandler);
|
||||||
|
|
||||||
|
var title = '';
|
||||||
|
var isDark = false;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
initTerminal();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void didChangeDependencies() {
|
||||||
|
super.didChangeDependencies();
|
||||||
|
isDark = isDarkMode(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
session.close();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> initTerminal() async {
|
||||||
|
terminal.write('Connecting...\r\n');
|
||||||
|
|
||||||
|
final client = locator<ServerProvider>()
|
||||||
|
.servers
|
||||||
|
.where((e) => e.info.id == widget.spi.id)
|
||||||
|
.first
|
||||||
|
.client;
|
||||||
|
if (client == null) {
|
||||||
|
terminal.write('Failed to connect\r\n');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
terminal.write('Connected\r\n');
|
||||||
|
|
||||||
|
session = await client.shell(
|
||||||
|
pty: SSHPtyConfig(
|
||||||
|
width: terminal.viewWidth,
|
||||||
|
height: terminal.viewHeight,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
terminal.buffer.clear();
|
||||||
|
terminal.buffer.setCursor(0, 0);
|
||||||
|
|
||||||
|
terminal.onTitleChange = (title) {
|
||||||
|
setState(() => this.title = title);
|
||||||
|
};
|
||||||
|
|
||||||
|
terminal.onResize = (width, height, pixelWidth, pixelHeight) {
|
||||||
|
session.resizeTerminal(width, height, pixelWidth, pixelHeight);
|
||||||
|
};
|
||||||
|
|
||||||
|
terminal.onOutput = (data) {
|
||||||
|
session.write(utf8.encode(data) as Uint8List);
|
||||||
|
};
|
||||||
|
|
||||||
|
session.stdout
|
||||||
|
.cast<List<int>>()
|
||||||
|
.transform(const Utf8Decoder())
|
||||||
|
.listen(terminal.write);
|
||||||
|
|
||||||
|
session.stderr
|
||||||
|
.cast<List<int>>()
|
||||||
|
.transform(const Utf8Decoder())
|
||||||
|
.listen(terminal.write);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: Text(title, style: textSize18),
|
||||||
|
),
|
||||||
|
body: Column(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: TerminalView(
|
||||||
|
terminal,
|
||||||
|
keyboardType: TextInputType.visiblePassword,
|
||||||
|
theme: isDark ? termDarkTheme : termLightTheme,
|
||||||
|
keyboardAppearance: isDark ? Brightness.dark : Brightness.light,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
VirtualKeyboardView(keyboard),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
36
lib/view/widget/picker.dart
Normal file
36
lib/view/widget/picker.dart
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
Widget buildPicker(List<Widget> items, Function(int idx) onSelected) {
|
||||||
|
return SizedBox(
|
||||||
|
height: 111,
|
||||||
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
Positioned(
|
||||||
|
top: 36,
|
||||||
|
bottom: 36,
|
||||||
|
left: 0,
|
||||||
|
right: 0,
|
||||||
|
child: Container(
|
||||||
|
height: 37,
|
||||||
|
decoration: const BoxDecoration(
|
||||||
|
borderRadius: BorderRadius.all(Radius.circular(7)),
|
||||||
|
color: Colors.black12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
ListWheelScrollView.useDelegate(
|
||||||
|
itemExtent: 37,
|
||||||
|
diameterRatio: 1.2,
|
||||||
|
controller: FixedExtentScrollController(initialItem: 0),
|
||||||
|
onSelectedItemChanged: (idx) => onSelected(idx),
|
||||||
|
physics: const FixedExtentScrollPhysics(),
|
||||||
|
childDelegate: ListWheelChildBuilderDelegate(
|
||||||
|
builder: (context, index) => Center(
|
||||||
|
child: items[index],
|
||||||
|
),
|
||||||
|
childCount: items.length),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
81
lib/view/widget/virtual_keyboard.dart
Normal file
81
lib/view/widget/virtual_keyboard.dart
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:xterm/xterm.dart';
|
||||||
|
|
||||||
|
class VirtualKeyboardView extends StatelessWidget {
|
||||||
|
const VirtualKeyboardView(this.keyboard, {super.key});
|
||||||
|
|
||||||
|
final VirtualKeyboard keyboard;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AnimatedBuilder(
|
||||||
|
animation: keyboard,
|
||||||
|
builder: (context, child) => ToggleButtons(
|
||||||
|
renderBorder: false,
|
||||||
|
isSelected: [keyboard.ctrl, keyboard.alt, keyboard.shift],
|
||||||
|
onPressed: (index) {
|
||||||
|
switch (index) {
|
||||||
|
case 0:
|
||||||
|
keyboard.ctrl = !keyboard.ctrl;
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
keyboard.alt = !keyboard.alt;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
keyboard.shift = !keyboard.shift;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
children: const [Text('Ctrl'), Text('Alt'), Text('Shift')],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VirtualKeyboard extends TerminalInputHandler with ChangeNotifier {
|
||||||
|
final TerminalInputHandler _inputHandler;
|
||||||
|
|
||||||
|
VirtualKeyboard(this._inputHandler);
|
||||||
|
|
||||||
|
bool _ctrl = false;
|
||||||
|
|
||||||
|
bool get ctrl => _ctrl;
|
||||||
|
|
||||||
|
set ctrl(bool value) {
|
||||||
|
if (_ctrl != value) {
|
||||||
|
_ctrl = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _shift = false;
|
||||||
|
|
||||||
|
bool get shift => _shift;
|
||||||
|
|
||||||
|
set shift(bool value) {
|
||||||
|
if (_shift != value) {
|
||||||
|
_shift = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool _alt = false;
|
||||||
|
|
||||||
|
bool get alt => _alt;
|
||||||
|
|
||||||
|
set alt(bool value) {
|
||||||
|
if (_alt != value) {
|
||||||
|
_alt = value;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String? call(TerminalKeyboardEvent event) {
|
||||||
|
return _inputHandler.call(event.copyWith(
|
||||||
|
ctrl: event.ctrl || _ctrl,
|
||||||
|
shift: event.shift || _shift,
|
||||||
|
alt: event.alt || _alt,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
1
macos/.gitignore
vendored
1
macos/.gitignore
vendored
@@ -3,4 +3,5 @@
|
|||||||
**/Pods/
|
**/Pods/
|
||||||
|
|
||||||
# Xcode-related
|
# Xcode-related
|
||||||
|
**/dgph
|
||||||
**/xcuserdata/
|
**/xcuserdata/
|
||||||
|
|||||||
@@ -5,8 +5,8 @@
|
|||||||
import FlutterMacOS
|
import FlutterMacOS
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
import path_provider_macos
|
import path_provider_foundation
|
||||||
import share_plus_macos
|
import share_plus
|
||||||
import url_launcher_macos
|
import url_launcher_macos
|
||||||
|
|
||||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
platform :osx, '10.11'
|
platform :osx, '10.14'
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
||||||
|
|||||||
@@ -1,34 +1,35 @@
|
|||||||
PODS:
|
PODS:
|
||||||
- FlutterMacOS (1.0.0)
|
- FlutterMacOS (1.0.0)
|
||||||
- path_provider_macos (0.0.1):
|
- path_provider_foundation (0.0.1):
|
||||||
|
- Flutter
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- share_plus_macos (0.0.1):
|
- share_plus (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
- url_launcher_macos (0.0.1):
|
- url_launcher_macos (0.0.1):
|
||||||
- FlutterMacOS
|
- FlutterMacOS
|
||||||
|
|
||||||
DEPENDENCIES:
|
DEPENDENCIES:
|
||||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||||
- path_provider_macos (from `Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos`)
|
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos`)
|
||||||
- share_plus_macos (from `Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos`)
|
- share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`)
|
||||||
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
EXTERNAL SOURCES:
|
||||||
FlutterMacOS:
|
FlutterMacOS:
|
||||||
:path: Flutter/ephemeral
|
:path: Flutter/ephemeral
|
||||||
path_provider_macos:
|
path_provider_foundation:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/macos
|
||||||
share_plus_macos:
|
share_plus:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/share_plus_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos
|
||||||
url_launcher_macos:
|
url_launcher_macos:
|
||||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
SPEC CHECKSUMS:
|
||||||
FlutterMacOS: ae6af50a8ea7d6103d888583d46bd8328a7e9811
|
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
|
||||||
path_provider_macos: 3c0c3b4b0d4a76d2bf989a913c2de869c5641a19
|
path_provider_foundation: 37748e03f12783f9de2cb2c4eadfaa25fe6d4852
|
||||||
share_plus_macos: 853ee48e7dce06b633998ca0735d482dd671ade4
|
share_plus: 76dd39142738f7a68dd57b05093b5e8193f220f7
|
||||||
url_launcher_macos: 597e05b8e514239626bcf4a850fcf9ef5c856ec3
|
url_launcher_macos: c04e4fa86382d4f94f6b38f14625708be3ae52e2
|
||||||
|
|
||||||
PODFILE CHECKSUM: 6eac6b3292e5142cfc23bdeb71848a40ec51c14c
|
PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7
|
||||||
|
|
||||||
COCOAPODS: 1.11.3
|
COCOAPODS: 1.11.3
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 51;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXAggregateTarget section */
|
/* Begin PBXAggregateTarget section */
|
||||||
@@ -21,12 +21,12 @@
|
|||||||
/* End PBXAggregateTarget section */
|
/* End PBXAggregateTarget section */
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
13023FEA984C8BDB6E86C760 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EB8E7EC3D3F94E678A33714A /* Pods_Runner.framework */; };
|
|
||||||
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
|
335BBD1B22A9A15E00E9071D /* GeneratedPluginRegistrant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */; };
|
||||||
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
|
33CC10F12044A3C60003C045 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC10F02044A3C60003C045 /* AppDelegate.swift */; };
|
||||||
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
33CC10F32044A3C60003C045 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F22044A3C60003C045 /* Assets.xcassets */; };
|
||||||
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
33CC10F62044A3C60003C045 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33CC10F42044A3C60003C045 /* MainMenu.xib */; };
|
||||||
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
33CC11132044BFA00003C045 /* MainFlutterWindow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 33CC11122044BFA00003C045 /* MainFlutterWindow.swift */; };
|
||||||
|
E3D733E2A8794200D26EFCCF /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 7ADDB81DD1CCC4A9ED73177B /* Pods_Runner.framework */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
/* Begin PBXContainerItemProxy section */
|
/* Begin PBXContainerItemProxy section */
|
||||||
@@ -53,10 +53,9 @@
|
|||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
11B144C2A4236173ED27E4BD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
|
||||||
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
|
||||||
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
|
||||||
33CC10ED2044A3C60003C045 /* ServerBox.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ServerBox.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
33CC10ED2044A3C60003C045 /* server_box.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = server_box.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
|
||||||
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
|
||||||
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
|
||||||
@@ -68,11 +67,12 @@
|
|||||||
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
33E51913231747F40026EE4D /* DebugProfile.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = DebugProfile.entitlements; sourceTree = "<group>"; };
|
||||||
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
33E51914231749380026EE4D /* Release.entitlements */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.entitlements; path = Release.entitlements; sourceTree = "<group>"; };
|
||||||
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
33E5194F232828860026EE4D /* AppInfo.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = AppInfo.xcconfig; sourceTree = "<group>"; };
|
||||||
4677EE1296857C03A50C6F9A /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
6B35024F2A8A5A7961F90167 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
||||||
482650D389602D26534AC41E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
|
6F4CBCB4E20C50200E1C67AD /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
|
||||||
|
7ADDB81DD1CCC4A9ED73177B /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Release.xcconfig; sourceTree = "<group>"; };
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Debug.xcconfig; sourceTree = "<group>"; };
|
||||||
EB8E7EC3D3F94E678A33714A /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
A3006D048053A6426855B015 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
@@ -80,23 +80,13 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
13023FEA984C8BDB6E86C760 /* Pods_Runner.framework in Frameworks */,
|
E3D733E2A8794200D26EFCCF /* Pods_Runner.framework in Frameworks */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
16F296B9098A48A19BD5CD7A /* Pods */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
482650D389602D26534AC41E /* Pods-Runner.debug.xcconfig */,
|
|
||||||
4677EE1296857C03A50C6F9A /* Pods-Runner.release.xcconfig */,
|
|
||||||
11B144C2A4236173ED27E4BD /* Pods-Runner.profile.xcconfig */,
|
|
||||||
);
|
|
||||||
path = Pods;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
33BA886A226E78AF003329D5 /* Configs */ = {
|
33BA886A226E78AF003329D5 /* Configs */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@@ -115,14 +105,14 @@
|
|||||||
33CEB47122A05771004F2AC0 /* Flutter */,
|
33CEB47122A05771004F2AC0 /* Flutter */,
|
||||||
33CC10EE2044A3C60003C045 /* Products */,
|
33CC10EE2044A3C60003C045 /* Products */,
|
||||||
D73912EC22F37F3D000D13A0 /* Frameworks */,
|
D73912EC22F37F3D000D13A0 /* Frameworks */,
|
||||||
16F296B9098A48A19BD5CD7A /* Pods */,
|
B9C356C33EBFDC4109524AEE /* Pods */,
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
33CC10EE2044A3C60003C045 /* Products */ = {
|
33CC10EE2044A3C60003C045 /* Products */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
33CC10ED2044A3C60003C045 /* ServerBox.app */,
|
33CC10ED2044A3C60003C045 /* server_box.app */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -162,10 +152,21 @@
|
|||||||
path = Runner;
|
path = Runner;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
B9C356C33EBFDC4109524AEE /* Pods */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
6B35024F2A8A5A7961F90167 /* Pods-Runner.debug.xcconfig */,
|
||||||
|
A3006D048053A6426855B015 /* Pods-Runner.release.xcconfig */,
|
||||||
|
6F4CBCB4E20C50200E1C67AD /* Pods-Runner.profile.xcconfig */,
|
||||||
|
);
|
||||||
|
name = Pods;
|
||||||
|
path = Pods;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
|
D73912EC22F37F3D000D13A0 /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
EB8E7EC3D3F94E678A33714A /* Pods_Runner.framework */,
|
7ADDB81DD1CCC4A9ED73177B /* Pods_Runner.framework */,
|
||||||
);
|
);
|
||||||
name = Frameworks;
|
name = Frameworks;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@@ -177,13 +178,13 @@
|
|||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 33CC10FB2044A3C60003C045 /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
DBB8303E8C3096724C62B102 /* [CP] Check Pods Manifest.lock */,
|
6380F17CF8505331723EA2D3 /* [CP] Check Pods Manifest.lock */,
|
||||||
33CC10E92044A3C60003C045 /* Sources */,
|
33CC10E92044A3C60003C045 /* Sources */,
|
||||||
33CC10EA2044A3C60003C045 /* Frameworks */,
|
33CC10EA2044A3C60003C045 /* Frameworks */,
|
||||||
33CC10EB2044A3C60003C045 /* Resources */,
|
33CC10EB2044A3C60003C045 /* Resources */,
|
||||||
33CC110E2044A8840003C045 /* Bundle Framework */,
|
33CC110E2044A8840003C045 /* Bundle Framework */,
|
||||||
3399D490228B24CF009A79C7 /* ShellScript */,
|
3399D490228B24CF009A79C7 /* ShellScript */,
|
||||||
08C07125B63B2876811CD3BF /* [CP] Embed Pods Frameworks */,
|
3A1CB36BB218FE124CA9BC01 /* [CP] Embed Pods Frameworks */,
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
@@ -192,7 +193,7 @@
|
|||||||
);
|
);
|
||||||
name = Runner;
|
name = Runner;
|
||||||
productName = Runner;
|
productName = Runner;
|
||||||
productReference = 33CC10ED2044A3C60003C045 /* ServerBox.app */;
|
productReference = 33CC10ED2044A3C60003C045 /* server_box.app */;
|
||||||
productType = "com.apple.product-type.application";
|
productType = "com.apple.product-type.application";
|
||||||
};
|
};
|
||||||
/* End PBXNativeTarget section */
|
/* End PBXNativeTarget section */
|
||||||
@@ -202,7 +203,7 @@
|
|||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
attributes = {
|
attributes = {
|
||||||
LastSwiftUpdateCheck = 0920;
|
LastSwiftUpdateCheck = 0920;
|
||||||
LastUpgradeCheck = 0930;
|
LastUpgradeCheck = 1300;
|
||||||
ORGANIZATIONNAME = "";
|
ORGANIZATIONNAME = "";
|
||||||
TargetAttributes = {
|
TargetAttributes = {
|
||||||
33CC10EC2044A3C60003C045 = {
|
33CC10EC2044A3C60003C045 = {
|
||||||
@@ -253,25 +254,9 @@
|
|||||||
/* End PBXResourcesBuildPhase section */
|
/* End PBXResourcesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXShellScriptBuildPhase section */
|
/* Begin PBXShellScriptBuildPhase section */
|
||||||
08C07125B63B2876811CD3BF /* [CP] Embed Pods Frameworks */ = {
|
|
||||||
isa = PBXShellScriptBuildPhase;
|
|
||||||
buildActionMask = 2147483647;
|
|
||||||
files = (
|
|
||||||
);
|
|
||||||
inputFileListPaths = (
|
|
||||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
|
||||||
);
|
|
||||||
name = "[CP] Embed Pods Frameworks";
|
|
||||||
outputFileListPaths = (
|
|
||||||
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
|
||||||
);
|
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
|
||||||
shellPath = /bin/sh;
|
|
||||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
|
||||||
showEnvVarsInLog = 0;
|
|
||||||
};
|
|
||||||
3399D490228B24CF009A79C7 /* ShellScript */ = {
|
3399D490228B24CF009A79C7 /* ShellScript */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
alwaysOutOfDate = 1;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
);
|
);
|
||||||
@@ -307,7 +292,24 @@
|
|||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
shellScript = "\"$FLUTTER_ROOT\"/packages/flutter_tools/bin/macos_assemble.sh && touch Flutter/ephemeral/tripwire";
|
||||||
};
|
};
|
||||||
DBB8303E8C3096724C62B102 /* [CP] Check Pods Manifest.lock */ = {
|
3A1CB36BB218FE124CA9BC01 /* [CP] Embed Pods Frameworks */ = {
|
||||||
|
isa = PBXShellScriptBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
inputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
|
||||||
|
);
|
||||||
|
name = "[CP] Embed Pods Frameworks";
|
||||||
|
outputFileListPaths = (
|
||||||
|
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
shellPath = /bin/sh;
|
||||||
|
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
|
||||||
|
showEnvVarsInLog = 0;
|
||||||
|
};
|
||||||
|
6380F17CF8505331723EA2D3 /* [CP] Check Pods Manifest.lock */ = {
|
||||||
isa = PBXShellScriptBuildPhase;
|
isa = PBXShellScriptBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
@@ -403,7 +405,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
@@ -420,15 +422,11 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 153;
|
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.153;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
@@ -486,7 +484,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
MTL_ENABLE_DEBUG_INFO = YES;
|
MTL_ENABLE_DEBUG_INFO = YES;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
@@ -533,7 +531,7 @@
|
|||||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
@@ -550,15 +548,11 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/DebugProfile.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 153;
|
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.153;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
@@ -574,15 +568,11 @@
|
|||||||
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
CODE_SIGN_ENTITLEMENTS = Runner/Release.entitlements;
|
||||||
CODE_SIGN_STYLE = Automatic;
|
CODE_SIGN_STYLE = Automatic;
|
||||||
COMBINE_HIDPI_IMAGES = YES;
|
COMBINE_HIDPI_IMAGES = YES;
|
||||||
CURRENT_PROJECT_VERSION = 153;
|
|
||||||
DEVELOPMENT_TEAM = BA88US33G6;
|
|
||||||
INFOPLIST_FILE = Runner/Info.plist;
|
INFOPLIST_FILE = Runner/Info.plist;
|
||||||
LD_RUNPATH_SEARCH_PATHS = (
|
LD_RUNPATH_SEARCH_PATHS = (
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
"@executable_path/../Frameworks",
|
"@executable_path/../Frameworks",
|
||||||
);
|
);
|
||||||
MARKETING_VERSION = 1.0.153;
|
|
||||||
PRODUCT_BUNDLE_IDENTIFIER = com.lollipopkit.toolbox;
|
|
||||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||||
SWIFT_VERSION = 5.0;
|
SWIFT_VERSION = 5.0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<Scheme
|
<Scheme
|
||||||
LastUpgradeVersion = "1000"
|
LastUpgradeVersion = "1300"
|
||||||
version = "1.3">
|
version = "1.3">
|
||||||
<BuildAction
|
<BuildAction
|
||||||
parallelizeBuildables = "YES"
|
parallelizeBuildables = "YES"
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "toolbox.app"
|
BuildableName = "server_box.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
@@ -31,13 +31,13 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "toolbox.app"
|
BuildableName = "server_box.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</MacroExpansion>
|
</MacroExpansion>
|
||||||
<AdditionalOptions>
|
<Testables>
|
||||||
</AdditionalOptions>
|
</Testables>
|
||||||
</TestAction>
|
</TestAction>
|
||||||
<LaunchAction
|
<LaunchAction
|
||||||
buildConfiguration = "Debug"
|
buildConfiguration = "Debug"
|
||||||
@@ -54,13 +54,11 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "toolbox.app"
|
BuildableName = "server_box.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
</BuildableProductRunnable>
|
</BuildableProductRunnable>
|
||||||
<AdditionalOptions>
|
|
||||||
</AdditionalOptions>
|
|
||||||
</LaunchAction>
|
</LaunchAction>
|
||||||
<ProfileAction
|
<ProfileAction
|
||||||
buildConfiguration = "Profile"
|
buildConfiguration = "Profile"
|
||||||
@@ -73,7 +71,7 @@
|
|||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = "primary"
|
BuildableIdentifier = "primary"
|
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
|
||||||
BuildableName = "toolbox.app"
|
BuildableName = "server_box.app"
|
||||||
BlueprintName = "Runner"
|
BlueprintName = "Runner"
|
||||||
ReferencedContainer = "container:Runner.xcodeproj">
|
ReferencedContainer = "container:Runner.xcodeproj">
|
||||||
</BuildableReference>
|
</BuildableReference>
|
||||||
|
|||||||
@@ -1,68 +1,68 @@
|
|||||||
{
|
{
|
||||||
"images" : [
|
"images" : [
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "16x16",
|
"size" : "16x16",
|
||||||
"scale" : "1x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_16@1x.png"
|
"filename" : "app_icon_16.png",
|
||||||
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "16x16",
|
"size" : "16x16",
|
||||||
"scale" : "2x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_16@2x.png"
|
"filename" : "app_icon_32.png",
|
||||||
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "32x32",
|
"size" : "32x32",
|
||||||
"scale" : "1x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_32@1x.png"
|
"filename" : "app_icon_32.png",
|
||||||
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "32x32",
|
"size" : "32x32",
|
||||||
"scale" : "2x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_32@2x.png"
|
"filename" : "app_icon_64.png",
|
||||||
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "128x128",
|
"size" : "128x128",
|
||||||
"scale" : "1x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_128@1x.png"
|
"filename" : "app_icon_128.png",
|
||||||
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "128x128",
|
"size" : "128x128",
|
||||||
"scale" : "2x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_128@2x.png"
|
"filename" : "app_icon_256.png",
|
||||||
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "256x256",
|
"size" : "256x256",
|
||||||
"scale" : "1x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_256@1x.png"
|
"filename" : "app_icon_256.png",
|
||||||
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "256x256",
|
"size" : "256x256",
|
||||||
"scale" : "2x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_256@2x.png"
|
"filename" : "app_icon_512.png",
|
||||||
|
"scale" : "2x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "512x512",
|
"size" : "512x512",
|
||||||
"scale" : "1x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_512@1x.png"
|
"filename" : "app_icon_512.png",
|
||||||
|
"scale" : "1x"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"idiom" : "mac",
|
|
||||||
"size" : "512x512",
|
"size" : "512x512",
|
||||||
"scale" : "2x",
|
"idiom" : "mac",
|
||||||
"filename" : "icon_512@2x.png"
|
"filename" : "app_icon_1024.png",
|
||||||
|
"scale" : "2x"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"info" : {
|
"info" : {
|
||||||
"version" : 1,
|
"version" : 1,
|
||||||
"author" : "xcode"
|
"author" : "xcode"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 101 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
Normal file
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
Normal file
BIN
macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 520 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user