Compare commits
56 Commits
v0.1.17
...
developmen
| Author | SHA1 | Date | |
|---|---|---|---|
| 83ec068a27 | |||
| a984269c15 | |||
| 600ff26016 | |||
| 9c85d565a9 | |||
| 446ef9a57a | |||
| 6103d0b679 | |||
| 5fd690197a | |||
| 31c0ade243 | |||
| 8ec264cebe | |||
| 83bfdf322b | |||
| cad43c7664 | |||
| 5c44574949 | |||
| 336be6cb72 | |||
| 214ae08bb9 | |||
| 100b86d3f9 | |||
| ff1b102047 | |||
| d51f3d4ba7 | |||
| b4016e6e5b | |||
| eae4a853e9 | |||
| 8eb4cadc85 | |||
| 06c5ca9910 | |||
| 27c3804b1e | |||
| debf960d70 | |||
| 1029bad20f | |||
| cef23a1c83 | |||
| c4fe32e4b1 | |||
| 893a1b558f | |||
| b0eebb5ee8 | |||
| 56daf1b940 | |||
| 8687b7788b | |||
| eeae1d919e | |||
| d02684bb84 | |||
| ea961da678 | |||
| 632da54311 | |||
| bc20593661 | |||
| 045f8b5b6b | |||
| 81f7b45619 | |||
| 06a76afc42 | |||
| 3032e13dc9 | |||
| d0492b2f79 | |||
| c2506fab7a | |||
| dca8c64555 | |||
| c80606b7d0 | |||
| be6020d6c5 | |||
| 5eb58d7cf2 | |||
| 306a38a36a | |||
| 1aaea5f6d9 | |||
| 99a8aaa409 | |||
| 85d57c6e1c | |||
| 77a647d17d | |||
| 3a54a077f3 | |||
| cf88a9a371 | |||
| 5feb535cf3 | |||
| 2d23207497 | |||
| c7c5b3682d | |||
| 321a310add |
@@ -4,9 +4,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
@@ -23,13 +20,6 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
# - name: Cache pub deps
|
|
||||||
# uses: actions/cache@v3
|
|
||||||
# with:
|
|
||||||
# path: ~/.pub-cache
|
|
||||||
# key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }}
|
|
||||||
# restore-keys: ${{ runner.os }}-pub-
|
|
||||||
|
|
||||||
- name: Setup Java (Temurin 17)
|
- name: Setup Java (Temurin 17)
|
||||||
uses: actions/setup-java@v3
|
uses: actions/setup-java@v3
|
||||||
with:
|
with:
|
||||||
@@ -66,7 +56,6 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
GITEA_TOKEN: ${{ secrets.RUNNER_CREATE_RELEASE }}
|
GITEA_TOKEN: ${{ secrets.RUNNER_CREATE_RELEASE }}
|
||||||
with:
|
with:
|
||||||
# tag & name: adjust to your versioning
|
|
||||||
tag_name: "v0.1.${{ github.run_number }}"
|
tag_name: "v0.1.${{ github.run_number }}"
|
||||||
name: "Flutter Android v0.1.${{ github.run_number }}"
|
name: "Flutter Android v0.1.${{ github.run_number }}"
|
||||||
body: "Automated build from CI"
|
body: "Automated build from CI"
|
||||||
|
|||||||
155
.gitignore
vendored
155
.gitignore
vendored
@@ -1,16 +1,23 @@
|
|||||||
|
# Do not remove or rename entries in this file, only add new ones
|
||||||
|
# See https://github.com/flutter/flutter/issues/128635 for more context.
|
||||||
|
|
||||||
# Miscellaneous
|
# Miscellaneous
|
||||||
*.class
|
*.class
|
||||||
|
*.lock
|
||||||
*.log
|
*.log
|
||||||
*.pyc
|
*.pyc
|
||||||
*.swp
|
*.swp
|
||||||
.DS_Store
|
.DS_Store
|
||||||
.atom/
|
.atom/
|
||||||
.build/
|
|
||||||
.buildlog/
|
.buildlog/
|
||||||
.history
|
.history
|
||||||
.svn/
|
.svn/
|
||||||
.swiftpm/
|
lib/l10n/app_localizations*
|
||||||
migrate_working_dir/
|
|
||||||
|
# As packages are no longer pinned, we use a lockfile for testing locally.
|
||||||
|
# When unpinning packages, Using lockfiles ensures that failures in PRs are
|
||||||
|
# actually due to those PRs, not due to a package being updated.
|
||||||
|
!/pubspec.lock
|
||||||
|
|
||||||
# IntelliJ related
|
# IntelliJ related
|
||||||
*.iml
|
*.iml
|
||||||
@@ -18,28 +25,142 @@ migrate_working_dir/
|
|||||||
*.iws
|
*.iws
|
||||||
.idea/
|
.idea/
|
||||||
|
|
||||||
# The .vscode folder contains launch configuration and tasks you configure in
|
# Visual Studio Code related
|
||||||
# VS Code which you may wish to be included in version control, so this line
|
.classpath
|
||||||
# is commented out by default.
|
.project
|
||||||
#.vscode/
|
.settings/
|
||||||
|
.vscode/*
|
||||||
|
.ccls-cache
|
||||||
|
|
||||||
|
# This file, on the master branch, should never exist or be checked-in.
|
||||||
|
#
|
||||||
|
# On a *final* release branch, that is, what will ship to stable or beta, the
|
||||||
|
# file can be force added (git add --force) and checked-in in order to effectively
|
||||||
|
# "pin" the engine artifact version so the flutter tool does not need to use git
|
||||||
|
# to determine the engine artifacts.
|
||||||
|
#
|
||||||
|
# See https://github.com/flutter/flutter/blob/main/docs/tool/Engine-artifacts.md.
|
||||||
|
/bin/internal/engine.version
|
||||||
|
|
||||||
|
# Flutter repo-specific
|
||||||
|
/bin/cache/
|
||||||
|
/bin/internal/bootstrap.bat
|
||||||
|
/bin/internal/bootstrap.sh
|
||||||
|
/bin/internal/engine.realm
|
||||||
|
/bin/mingit/
|
||||||
|
/dev/benchmarks/mega_gallery/
|
||||||
|
/dev/bots/.recipe_deps
|
||||||
|
/dev/bots/android_tools/
|
||||||
|
/dev/devicelab/ABresults*.json
|
||||||
|
/dev/docs/doc/
|
||||||
|
/dev/docs/api_docs.zip
|
||||||
|
/dev/docs/flutter.docs.zip
|
||||||
|
/dev/docs/lib/
|
||||||
|
/dev/docs/pubspec.yaml
|
||||||
|
/dev/integration_tests/**/xcuserdata
|
||||||
|
/dev/integration_tests/**/Pods
|
||||||
|
/packages/flutter/coverage/
|
||||||
|
version
|
||||||
|
analysis_benchmark.json
|
||||||
|
|
||||||
|
# packages file containing multi-root paths
|
||||||
|
.packages.generated
|
||||||
|
|
||||||
# Flutter/Dart/Pub related
|
# Flutter/Dart/Pub related
|
||||||
**/doc/api/
|
**/doc/api/
|
||||||
**/ios/Flutter/.last_build_id
|
|
||||||
.dart_tool/
|
.dart_tool/
|
||||||
.flutter-plugins-dependencies
|
.flutter-plugins-dependencies
|
||||||
|
**/generated_plugin_registrant.dart
|
||||||
|
.packages
|
||||||
|
.pub-preload-cache/
|
||||||
.pub-cache/
|
.pub-cache/
|
||||||
.pub/
|
.pub/
|
||||||
/build/
|
build/
|
||||||
/coverage/
|
flutter_*.png
|
||||||
|
linked_*.ds
|
||||||
|
unlinked.ds
|
||||||
|
unlinked_spec.ds
|
||||||
|
|
||||||
# Symbolication related
|
# Android related
|
||||||
|
**/android/**/gradle-wrapper.jar
|
||||||
|
.gradle/
|
||||||
|
**/android/captures/
|
||||||
|
**/android/gradlew
|
||||||
|
**/android/gradlew.bat
|
||||||
|
**/android/**/GeneratedPluginRegistrant.java
|
||||||
|
**/android/key.properties
|
||||||
|
*.jks
|
||||||
|
local.properties
|
||||||
|
**/.cxx/
|
||||||
|
|
||||||
|
# iOS/XCode related
|
||||||
|
**/ios/**/*.mode1v3
|
||||||
|
**/ios/**/*.mode2v3
|
||||||
|
**/ios/**/*.moved-aside
|
||||||
|
**/ios/**/*.pbxuser
|
||||||
|
**/ios/**/*.perspectivev3
|
||||||
|
**/ios/**/*sync/
|
||||||
|
**/ios/**/.sconsign.dblite
|
||||||
|
**/ios/**/.tags*
|
||||||
|
**/ios/**/.vagrant/
|
||||||
|
**/ios/**/DerivedData/
|
||||||
|
**/ios/**/Icon?
|
||||||
|
**/ios/**/Pods/
|
||||||
|
**/ios/**/.symlinks/
|
||||||
|
**/ios/**/profile
|
||||||
|
**/ios/**/xcuserdata
|
||||||
|
**/ios/.generated/
|
||||||
|
**/ios/Flutter/.last_build_id
|
||||||
|
**/ios/Flutter/App.framework
|
||||||
|
**/ios/Flutter/Flutter.framework
|
||||||
|
**/ios/Flutter/Flutter.podspec
|
||||||
|
**/ios/Flutter/Generated.xcconfig
|
||||||
|
**/ios/Flutter/ephemeral
|
||||||
|
**/ios/Flutter/app.flx
|
||||||
|
**/ios/Flutter/app.zip
|
||||||
|
**/ios/Flutter/flutter_assets/
|
||||||
|
**/ios/Flutter/flutter_export_environment.sh
|
||||||
|
**/ios/ServiceDefinitions.json
|
||||||
|
**/ios/Runner/GeneratedPluginRegistrant.*
|
||||||
|
|
||||||
|
# macOS
|
||||||
|
**/Flutter/ephemeral/
|
||||||
|
**/Pods/
|
||||||
|
**/macos/Flutter/GeneratedPluginRegistrant.swift
|
||||||
|
**/macos/Flutter/ephemeral
|
||||||
|
**/xcuserdata/
|
||||||
|
|
||||||
|
# Windows
|
||||||
|
**/windows/flutter/ephemeral/
|
||||||
|
**/windows/flutter/generated_plugin_registrant.cc
|
||||||
|
**/windows/flutter/generated_plugin_registrant.h
|
||||||
|
**/windows/flutter/generated_plugins.cmake
|
||||||
|
|
||||||
|
# Linux
|
||||||
|
**/linux/flutter/ephemeral/
|
||||||
|
**/linux/flutter/generated_plugin_registrant.cc
|
||||||
|
**/linux/flutter/generated_plugin_registrant.h
|
||||||
|
**/linux/flutter/generated_plugins.cmake
|
||||||
|
|
||||||
|
# Coverage
|
||||||
|
coverage/
|
||||||
|
|
||||||
|
# Symbols
|
||||||
app.*.symbols
|
app.*.symbols
|
||||||
|
|
||||||
# Obfuscation related
|
# Exceptions to above rules.
|
||||||
app.*.map.json
|
!**/ios/**/default.mode1v3
|
||||||
|
!**/ios/**/default.mode2v3
|
||||||
|
!**/ios/**/default.pbxuser
|
||||||
|
!**/ios/**/default.perspectivev3
|
||||||
|
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
|
||||||
|
!/dev/ci/**/Gemfile.lock
|
||||||
|
!.vscode/settings.json
|
||||||
|
|
||||||
# Android Studio will place build artifacts here
|
# Monorepo
|
||||||
/android/app/debug
|
.cipd
|
||||||
/android/app/profile
|
.gclient
|
||||||
/android/app/release
|
.gclient_entries
|
||||||
|
.python-version
|
||||||
|
.gclient_previous_custom_vars
|
||||||
|
.gclient_previous_sync_commits
|
||||||
339
License
Normal file
339
License
Normal file
@@ -0,0 +1,339 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 2, June 1991
|
||||||
|
|
||||||
|
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The licenses for most software are designed to take away your
|
||||||
|
freedom to share and change it. By contrast, the GNU General Public
|
||||||
|
License is intended to guarantee your freedom to share and change free
|
||||||
|
software--to make sure the software is free for all its users. This
|
||||||
|
General Public License applies to most of the Free Software
|
||||||
|
Foundation's software and to any other program whose authors commit to
|
||||||
|
using it. (Some other Free Software Foundation software is covered by
|
||||||
|
the GNU Lesser General Public License instead.) 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
|
||||||
|
this service 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 make restrictions that forbid
|
||||||
|
anyone to deny you these rights or to ask you to surrender the rights.
|
||||||
|
These restrictions translate to certain responsibilities for you if you
|
||||||
|
distribute copies of the software, or if you modify it.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must give the recipients all the rights that
|
||||||
|
you have. 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.
|
||||||
|
|
||||||
|
We protect your rights with two steps: (1) copyright the software, and
|
||||||
|
(2) offer you this license which gives you legal permission to copy,
|
||||||
|
distribute and/or modify the software.
|
||||||
|
|
||||||
|
Also, for each author's protection and ours, we want to make certain
|
||||||
|
that everyone understands that there is no warranty for this free
|
||||||
|
software. If the software is modified by someone else and passed on, we
|
||||||
|
want its recipients to know that what they have is not the original, so
|
||||||
|
that any problems introduced by others will not reflect on the original
|
||||||
|
authors' reputations.
|
||||||
|
|
||||||
|
Finally, any free program is threatened constantly by software
|
||||||
|
patents. We wish to avoid the danger that redistributors of a free
|
||||||
|
program will individually obtain patent licenses, in effect making the
|
||||||
|
program proprietary. To prevent this, we have made it clear that any
|
||||||
|
patent must be licensed for everyone's free use or not licensed at all.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||||
|
|
||||||
|
0. This License applies to any program or other work which contains
|
||||||
|
a notice placed by the copyright holder saying it may be distributed
|
||||||
|
under the terms of this General Public License. The "Program", below,
|
||||||
|
refers to any such program or work, and a "work based on the Program"
|
||||||
|
means either the Program or any derivative work under copyright law:
|
||||||
|
that is to say, a work containing the Program or a portion of it,
|
||||||
|
either verbatim or with modifications and/or translated into another
|
||||||
|
language. (Hereinafter, translation is included without limitation in
|
||||||
|
the term "modification".) Each licensee is addressed as "you".
|
||||||
|
|
||||||
|
Activities other than copying, distribution and modification are not
|
||||||
|
covered by this License; they are outside its scope. The act of
|
||||||
|
running the Program is not restricted, and the output from the Program
|
||||||
|
is covered only if its contents constitute a work based on the
|
||||||
|
Program (independent of having been made by running the Program).
|
||||||
|
Whether that is true depends on what the Program does.
|
||||||
|
|
||||||
|
1. You may copy and distribute 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 and disclaimer of warranty; keep intact all the
|
||||||
|
notices that refer to this License and to the absence of any warranty;
|
||||||
|
and give any other recipients of the Program a copy of this License
|
||||||
|
along with the Program.
|
||||||
|
|
||||||
|
You may charge a fee for the physical act of transferring a copy, and
|
||||||
|
you may at your option offer warranty protection in exchange for a fee.
|
||||||
|
|
||||||
|
2. You may modify your copy or copies of the Program or any portion
|
||||||
|
of it, thus forming a work based on the Program, and copy and
|
||||||
|
distribute such modifications or work under the terms of Section 1
|
||||||
|
above, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) You must cause the modified files to carry prominent notices
|
||||||
|
stating that you changed the files and the date of any change.
|
||||||
|
|
||||||
|
b) You must cause any work that you distribute or publish, that in
|
||||||
|
whole or in part contains or is derived from the Program or any
|
||||||
|
part thereof, to be licensed as a whole at no charge to all third
|
||||||
|
parties under the terms of this License.
|
||||||
|
|
||||||
|
c) If the modified program normally reads commands interactively
|
||||||
|
when run, you must cause it, when started running for such
|
||||||
|
interactive use in the most ordinary way, to print or display an
|
||||||
|
announcement including an appropriate copyright notice and a
|
||||||
|
notice that there is no warranty (or else, saying that you provide
|
||||||
|
a warranty) and that users may redistribute the program under
|
||||||
|
these conditions, and telling the user how to view a copy of this
|
||||||
|
License. (Exception: if the Program itself is interactive but
|
||||||
|
does not normally print such an announcement, your work based on
|
||||||
|
the Program is not required to print an announcement.)
|
||||||
|
|
||||||
|
These requirements apply to the modified work as a whole. If
|
||||||
|
identifiable sections of that work are not derived from the Program,
|
||||||
|
and can be reasonably considered independent and separate works in
|
||||||
|
themselves, then this License, and its terms, do not apply to those
|
||||||
|
sections when you distribute them as separate works. But when you
|
||||||
|
distribute the same sections as part of a whole which is a work based
|
||||||
|
on the Program, the distribution of the whole must be on the terms of
|
||||||
|
this License, whose permissions for other licensees extend to the
|
||||||
|
entire whole, and thus to each and every part regardless of who wrote it.
|
||||||
|
|
||||||
|
Thus, it is not the intent of this section to claim rights or contest
|
||||||
|
your rights to work written entirely by you; rather, the intent is to
|
||||||
|
exercise the right to control the distribution of derivative or
|
||||||
|
collective works based on the Program.
|
||||||
|
|
||||||
|
In addition, mere aggregation of another work not based on the Program
|
||||||
|
with the Program (or with a work based on the Program) on a volume of
|
||||||
|
a storage or distribution medium does not bring the other work under
|
||||||
|
the scope of this License.
|
||||||
|
|
||||||
|
3. You may copy and distribute the Program (or a work based on it,
|
||||||
|
under Section 2) in object code or executable form under the terms of
|
||||||
|
Sections 1 and 2 above provided that you also do one of the following:
|
||||||
|
|
||||||
|
a) Accompany it with the complete corresponding machine-readable
|
||||||
|
source code, which must be distributed under the terms of Sections
|
||||||
|
1 and 2 above on a medium customarily used for software interchange; or,
|
||||||
|
|
||||||
|
b) Accompany it with a written offer, valid for at least three
|
||||||
|
years, to give any third party, for a charge no more than your
|
||||||
|
cost of physically performing source distribution, a complete
|
||||||
|
machine-readable copy of the corresponding source code, to be
|
||||||
|
distributed under the terms of Sections 1 and 2 above on a medium
|
||||||
|
customarily used for software interchange; or,
|
||||||
|
|
||||||
|
c) Accompany it with the information you received as to the offer
|
||||||
|
to distribute corresponding source code. (This alternative is
|
||||||
|
allowed only for noncommercial distribution and only if you
|
||||||
|
received the program in object code or executable form with such
|
||||||
|
an offer, in accord with Subsection b above.)
|
||||||
|
|
||||||
|
The source code for a work means the preferred form of the work for
|
||||||
|
making modifications to it. For an executable work, complete source
|
||||||
|
code means all the source code for all modules it contains, plus any
|
||||||
|
associated interface definition files, plus the scripts used to
|
||||||
|
control compilation and installation of the executable. However, as a
|
||||||
|
special exception, the source code distributed need not include
|
||||||
|
anything that is normally distributed (in either source or binary
|
||||||
|
form) with the major components (compiler, kernel, and so on) of the
|
||||||
|
operating system on which the executable runs, unless that component
|
||||||
|
itself accompanies the executable.
|
||||||
|
|
||||||
|
If distribution of executable or object code is made by offering
|
||||||
|
access to copy from a designated place, then offering equivalent
|
||||||
|
access to copy the source code from the same place counts as
|
||||||
|
distribution of the source code, even though third parties are not
|
||||||
|
compelled to copy the source along with the object code.
|
||||||
|
|
||||||
|
4. You may not copy, modify, sublicense, or distribute the Program
|
||||||
|
except as expressly provided under this License. Any attempt
|
||||||
|
otherwise to copy, modify, sublicense or distribute the Program is
|
||||||
|
void, and will automatically terminate your rights under this License.
|
||||||
|
However, parties who have received copies, or rights, from you under
|
||||||
|
this License will not have their licenses terminated so long as such
|
||||||
|
parties remain in full compliance.
|
||||||
|
|
||||||
|
5. You are not required to accept this License, since you have not
|
||||||
|
signed it. However, nothing else grants you permission to modify or
|
||||||
|
distribute the Program or its derivative works. These actions are
|
||||||
|
prohibited by law if you do not accept this License. Therefore, by
|
||||||
|
modifying or distributing the Program (or any work based on the
|
||||||
|
Program), you indicate your acceptance of this License to do so, and
|
||||||
|
all its terms and conditions for copying, distributing or modifying
|
||||||
|
the Program or works based on it.
|
||||||
|
|
||||||
|
6. Each time you redistribute the Program (or any work based on the
|
||||||
|
Program), the recipient automatically receives a license from the
|
||||||
|
original licensor to copy, distribute or modify the Program subject to
|
||||||
|
these terms and conditions. You may not impose any further
|
||||||
|
restrictions on the recipients' exercise of the rights granted herein.
|
||||||
|
You are not responsible for enforcing compliance by third parties to
|
||||||
|
this License.
|
||||||
|
|
||||||
|
7. If, as a consequence of a court judgment or allegation of patent
|
||||||
|
infringement or for any other reason (not limited to patent issues),
|
||||||
|
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
|
||||||
|
distribute so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you
|
||||||
|
may not distribute the Program at all. For example, if a patent
|
||||||
|
license would not permit royalty-free redistribution of the Program by
|
||||||
|
all those who receive copies directly or indirectly through you, then
|
||||||
|
the only way you could satisfy both it and this License would be to
|
||||||
|
refrain entirely from distribution of the Program.
|
||||||
|
|
||||||
|
If any portion of this section is held invalid or unenforceable under
|
||||||
|
any particular circumstance, the balance of the section is intended to
|
||||||
|
apply and the section as a whole is intended to apply in other
|
||||||
|
circumstances.
|
||||||
|
|
||||||
|
It is not the purpose of this section to induce you to infringe any
|
||||||
|
patents or other property right claims or to contest validity of any
|
||||||
|
such claims; this section has the sole purpose of protecting the
|
||||||
|
integrity of the free software distribution system, which is
|
||||||
|
implemented by public license practices. Many people have made
|
||||||
|
generous contributions to the wide range of software distributed
|
||||||
|
through that system in reliance on consistent application of that
|
||||||
|
system; it is up to the author/donor to decide if he or she is willing
|
||||||
|
to distribute software through any other system and a licensee cannot
|
||||||
|
impose that choice.
|
||||||
|
|
||||||
|
This section is intended to make thoroughly clear what is believed to
|
||||||
|
be a consequence of the rest of this License.
|
||||||
|
|
||||||
|
8. If the distribution and/or use of the Program is restricted in
|
||||||
|
certain countries either by patents or by copyrighted interfaces, the
|
||||||
|
original copyright holder who places the Program under this License
|
||||||
|
may add an explicit geographical distribution limitation excluding
|
||||||
|
those countries, so that distribution is permitted only in or among
|
||||||
|
countries not thus excluded. In such case, this License incorporates
|
||||||
|
the limitation as if written in the body of this License.
|
||||||
|
|
||||||
|
9. The Free Software Foundation may publish revised and/or new versions
|
||||||
|
of the 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 a version number of this License which applies to it and "any
|
||||||
|
later version", you have the option of following the terms and conditions
|
||||||
|
either of that version or of any later version published by the Free
|
||||||
|
Software Foundation. If the Program does not specify a version number of
|
||||||
|
this License, you may choose any version ever published by the Free Software
|
||||||
|
Foundation.
|
||||||
|
|
||||||
|
10. If you wish to incorporate parts of the Program into other free
|
||||||
|
programs whose distribution conditions are different, write to the author
|
||||||
|
to ask for permission. For software which is copyrighted by the Free
|
||||||
|
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||||
|
make exceptions for this. Our decision will be guided by the two goals
|
||||||
|
of preserving the free status of all derivatives of our free software and
|
||||||
|
of promoting the sharing and reuse of software generally.
|
||||||
|
|
||||||
|
NO WARRANTY
|
||||||
|
|
||||||
|
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, 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.
|
||||||
|
|
||||||
|
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||||
|
REDISTRIBUTE 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.
|
||||||
|
|
||||||
|
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
|
||||||
|
convey 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 2 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, write to the Free Software Foundation, Inc.,
|
||||||
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program is interactive, make it output a short notice like this
|
||||||
|
when it starts in an interactive mode:
|
||||||
|
|
||||||
|
Gnomovision version 69, Copyright (C) year name of author
|
||||||
|
Gnomovision 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, the commands you use may
|
||||||
|
be called something other than `show w' and `show c'; they could even be
|
||||||
|
mouse-clicks or menu items--whatever suits your program.
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or your
|
||||||
|
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||||
|
necessary. Here is a sample; alter the names:
|
||||||
|
|
||||||
|
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||||
|
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||||
|
|
||||||
|
<signature of Ty Coon>, 1 April 1989
|
||||||
|
Ty Coon, President of Vice
|
||||||
|
|
||||||
|
This 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.
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<uses-permission android:name="android.permission.INTERNET"/>
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE"/>
|
||||||
<application
|
<application
|
||||||
android:label="maps_bookmarks"
|
android:label="maps_bookmarks"
|
||||||
android:name="${applicationName}"
|
android:name="${applicationName}"
|
||||||
|
|||||||
3
l10n.yaml
Normal file
3
l10n.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
arb-dir: lib/l10n
|
||||||
|
template-arb-file: app_en.arb
|
||||||
|
output-localization-file: app_localizations.dart
|
||||||
3
lib/assets/constants.dart
Normal file
3
lib/assets/constants.dart
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
const String appName = 'Maps Bookmarks';
|
||||||
|
const String jsonFileName = 'MapsBookmarksData.json';
|
||||||
|
const String defaultAndroidExportDirectory = '/storage/emulated/0/Documents';
|
||||||
43
lib/l10n/app_de.arb
Normal file
43
lib/l10n/app_de.arb
Normal file
@@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"@@locale": "de",
|
||||||
|
"addToCollection": "Speichern in {collection_name}",
|
||||||
|
"@addToCollection": {
|
||||||
|
"placeholders": {
|
||||||
|
"collection_name" : {
|
||||||
|
"type": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cancel": "Abbrechen",
|
||||||
|
"chooseCollection": "Sammlung auswählen",
|
||||||
|
"collections": "Sammlungen",
|
||||||
|
"tipCreateCollections": "Erstelle deine erste Sammlung!",
|
||||||
|
"search": "Suche",
|
||||||
|
"createBookmark": "Lesezeichen erstellen",
|
||||||
|
"createCollection": "Sammlung erstellen",
|
||||||
|
"create": "Erstellen",
|
||||||
|
"delete": "Löschen",
|
||||||
|
"add": "Hinzufügen",
|
||||||
|
"startSearching": "Suche etwas",
|
||||||
|
"tipNoResults": "Keine Suchergebnisse gefunden",
|
||||||
|
"collectionName": "Name der Sammlung",
|
||||||
|
"bookmarkTitle": "Titel des Lesezeichens",
|
||||||
|
"url": "Url",
|
||||||
|
"description": "Beschreibung",
|
||||||
|
"settings": "Einstellungen",
|
||||||
|
"appData": "App-Daten",
|
||||||
|
"export": "Exportieren",
|
||||||
|
"import": "Importieren",
|
||||||
|
"activateJsonExport": "Immer als JSON speichern",
|
||||||
|
|
||||||
|
"@@comment": "Info",
|
||||||
|
"exportSuccess": "Daten exportiert",
|
||||||
|
"importSuccess": "Daten importiert",
|
||||||
|
|
||||||
|
"@@comment": "Errors",
|
||||||
|
"errorStoragePermisson": "Zugriff auf Speicher verwehrt",
|
||||||
|
"errorCouldNotLaunchUrl": "Konnte Url nicht öffnen",
|
||||||
|
"errorInvalidUrl": "Fehlerhafte Url",
|
||||||
|
"exportFailed": "Export fehlgeschlagen",
|
||||||
|
"importFailed": "Import fehlgeschlagen"
|
||||||
|
}
|
||||||
44
lib/l10n/app_en.arb
Normal file
44
lib/l10n/app_en.arb
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
{
|
||||||
|
"@@locale": "en",
|
||||||
|
"addToCollection": "Add to {collection_name}",
|
||||||
|
"@addToCollection": {
|
||||||
|
"placeholders": {
|
||||||
|
"collection_name" : {
|
||||||
|
"type": "String"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"cancel": "Cancel",
|
||||||
|
"chooseCollection": "Choose Collection",
|
||||||
|
"collections": "Collections",
|
||||||
|
"tipCreateCollections": "Create your first Collection to get started!",
|
||||||
|
"search": "Search",
|
||||||
|
"createBookmark": "Create Bookmark",
|
||||||
|
"createCollection": "Create Collection",
|
||||||
|
"create": "Create",
|
||||||
|
"delete": "Delete",
|
||||||
|
"add": "Add",
|
||||||
|
"startSearching": "Start searching",
|
||||||
|
"tipNoResults": "There are no results that match your search",
|
||||||
|
"collectionName": "Collection Name",
|
||||||
|
"bookmarkTitle": "Bookmark Title",
|
||||||
|
"url": "Url",
|
||||||
|
"description": "Description",
|
||||||
|
"settings": "Settings",
|
||||||
|
"appData": "App data",
|
||||||
|
"export": "Export",
|
||||||
|
"import": "Import",
|
||||||
|
"activateJsonExport": "Always save to JSON",
|
||||||
|
|
||||||
|
|
||||||
|
"@@comment": "Info",
|
||||||
|
"exportSuccess": "Exported data",
|
||||||
|
"importSuccess": "Imported data",
|
||||||
|
|
||||||
|
"@@comment": "Errors",
|
||||||
|
"errorStoragePermisson": "Storage permissions denied",
|
||||||
|
"errorCouldNotLaunchUrl": "Could not launch Url",
|
||||||
|
"errorInvalidUrl": "Invalid Url",
|
||||||
|
"exportFailed": "Export failed",
|
||||||
|
"importFailed": "Import failed"
|
||||||
|
}
|
||||||
@@ -1,9 +1,13 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import 'l10n/app_localizations.dart';
|
||||||
import 'pages/collection_page.dart';
|
import 'pages/collection_page.dart';
|
||||||
import 'pages/collections_list_page.dart';
|
import 'pages/collections_list_page.dart';
|
||||||
import 'pages/search_page.dart';
|
import 'pages/search_page.dart';
|
||||||
|
import 'pages/settings_page.dart';
|
||||||
import 'service/search_provider.dart';
|
import 'service/search_provider.dart';
|
||||||
|
import 'service/settings_provider.dart';
|
||||||
import 'service/shared_link_provider.dart';
|
import 'service/shared_link_provider.dart';
|
||||||
import 'service/storage.dart';
|
import 'service/storage.dart';
|
||||||
import 'service/share_intent_service.dart';
|
import 'service/share_intent_service.dart';
|
||||||
@@ -17,6 +21,7 @@ void main() async {
|
|||||||
providers: [
|
providers: [
|
||||||
ChangeNotifierProvider(create: (_) => SharedLinkProvider()),
|
ChangeNotifierProvider(create: (_) => SharedLinkProvider()),
|
||||||
ChangeNotifierProvider(create: (_) => SearchProvider()),
|
ChangeNotifierProvider(create: (_) => SearchProvider()),
|
||||||
|
ChangeNotifierProvider(create: (_) => SettingsProvider()),
|
||||||
],
|
],
|
||||||
child: const MapsBookmarks(),
|
child: const MapsBookmarks(),
|
||||||
),
|
),
|
||||||
@@ -66,6 +71,13 @@ class _MapsBookmarksState extends State<MapsBookmarks>
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
|
localizationsDelegates: [
|
||||||
|
AppLocalizations.delegate,
|
||||||
|
GlobalMaterialLocalizations.delegate,
|
||||||
|
GlobalWidgetsLocalizations.delegate,
|
||||||
|
GlobalCupertinoLocalizations.delegate,
|
||||||
|
],
|
||||||
|
supportedLocales: [Locale('en'), Locale('de')],
|
||||||
navigatorKey: _navigatorKey,
|
navigatorKey: _navigatorKey,
|
||||||
theme: lightTheme,
|
theme: lightTheme,
|
||||||
darkTheme: darkTheme,
|
darkTheme: darkTheme,
|
||||||
@@ -74,6 +86,7 @@ class _MapsBookmarksState extends State<MapsBookmarks>
|
|||||||
CollectionsListPage.routeName: (context) => const CollectionsListPage(),
|
CollectionsListPage.routeName: (context) => const CollectionsListPage(),
|
||||||
CollectionPage.routeName: (context) => const CollectionPage(),
|
CollectionPage.routeName: (context) => const CollectionPage(),
|
||||||
SearchPage.routeName: (context) => const SearchPage(),
|
SearchPage.routeName: (context) => const SearchPage(),
|
||||||
|
SettingsPage.routeName: (context) => const SettingsPage(),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
39
lib/model/settings.dart
Normal file
39
lib/model/settings.dart
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
import '../assets/constants.dart' as constants;
|
||||||
|
|
||||||
|
class Settings {
|
||||||
|
final String exportDirectoryPath;
|
||||||
|
final bool alwaysExportEnabled;
|
||||||
|
|
||||||
|
Settings._({
|
||||||
|
required this.exportDirectoryPath,
|
||||||
|
required this.alwaysExportEnabled,
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return {
|
||||||
|
'exportDirectoryPath': exportDirectoryPath,
|
||||||
|
'alwaysExportEnabled': alwaysExportEnabled,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Settings.fromJson(Map<String, dynamic> json) {
|
||||||
|
return Settings._(
|
||||||
|
exportDirectoryPath: json['exportDirectoryPath'] as String,
|
||||||
|
alwaysExportEnabled: json['alwaysExportEnabled'] as bool,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
factory Settings.defaults() {
|
||||||
|
return Settings._(
|
||||||
|
exportDirectoryPath: constants.defaultAndroidExportDirectory,
|
||||||
|
alwaysExportEnabled: false,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings copyWith({String? exportDirectoryPath, bool? alwaysExportEnabled}) {
|
||||||
|
return Settings._(
|
||||||
|
exportDirectoryPath: exportDirectoryPath ?? this.exportDirectoryPath,
|
||||||
|
alwaysExportEnabled: alwaysExportEnabled ?? this.alwaysExportEnabled,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
import '../model/bookmark.dart';
|
import '../model/bookmark.dart';
|
||||||
import '../model/maps_link_metadata.dart';
|
import '../model/maps_link_metadata.dart';
|
||||||
import '../service/bookmarks_provider.dart';
|
import '../service/bookmarks_provider.dart';
|
||||||
@@ -8,6 +9,7 @@ import '../service/notifying.dart';
|
|||||||
import '../service/shared_link_provider.dart';
|
import '../service/shared_link_provider.dart';
|
||||||
import '../service/storage.dart';
|
import '../service/storage.dart';
|
||||||
import '../service/url_launcher.dart';
|
import '../service/url_launcher.dart';
|
||||||
|
import '../widgets/collection_page_widgets/list_item_actions_widget.dart';
|
||||||
import '../widgets/create_bookmark_dialog.dart';
|
import '../widgets/create_bookmark_dialog.dart';
|
||||||
|
|
||||||
class CollectionPage extends StatefulWidget {
|
class CollectionPage extends StatefulWidget {
|
||||||
@@ -21,6 +23,7 @@ class CollectionPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _CollectionPageState extends State<CollectionPage> {
|
class _CollectionPageState extends State<CollectionPage> {
|
||||||
MapsLinkMetadata? selectedMapsLink;
|
MapsLinkMetadata? selectedMapsLink;
|
||||||
|
int selectedBookmarkId = -1;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -51,29 +54,46 @@ class _CollectionPageState extends State<CollectionPage> {
|
|||||||
).whenComplete(() => setState(() {}));
|
).whenComplete(() => setState(() {}));
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
).whenComplete(deselectBookmark);
|
||||||
|
|
||||||
void onBookmarkSaved(Bookmark bookmark) {
|
void onBookmarkSaved(Bookmark bookmark) {
|
||||||
Storage.addOrUpdateBookmark(bookmark);
|
Storage.addOrUpdateBookmark(bookmark);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
context.read<SharedLinkProvider>().removeCurrentMapsLink();
|
Provider.of<SharedLinkProvider>(
|
||||||
|
context,
|
||||||
|
listen: false,
|
||||||
|
).removeCurrentMapsLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget bookmarksListItemBuilder(BuildContext context, Bookmark bookmark) {
|
Widget bookmarksListItemBuilder(BuildContext context, Bookmark bookmark) {
|
||||||
|
final selected = selectedBookmarkId == bookmark.id;
|
||||||
return ListTile(
|
return ListTile(
|
||||||
title: Text(bookmark.name),
|
title: Text(bookmark.name),
|
||||||
onTap: () => launchUrlFromString(bookmark.link).then((errorCode) {
|
selected: selected,
|
||||||
|
onTap: () {
|
||||||
|
if (selected) {
|
||||||
|
onCancelSelectionPressed();
|
||||||
|
setState(() {});
|
||||||
|
} else if (selectedBookmarkId != -1 && !selected) {
|
||||||
|
selectedBookmarkId = bookmark.id;
|
||||||
|
setState(() {});
|
||||||
|
} else {
|
||||||
|
launchUrlFromString(bookmark.link).then((errorCode) {
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
return Notifying.showUrlErrorSnackbar(context, errorCode);
|
return Notifying.showUrlErrorSnackbar(context, errorCode);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onLongPress: () => setState(() {
|
||||||
|
selectedBookmarkId = bookmark.id;
|
||||||
}),
|
}),
|
||||||
onLongPress: () => editBookmark(bookmark),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
SharedLinkProvider provider = context.watch<SharedLinkProvider>();
|
SharedLinkProvider provider = Provider.of<SharedLinkProvider>(context);
|
||||||
selectedMapsLink = provider.currentMapsLinkMetadata;
|
selectedMapsLink = provider.currentMapsLinkMetadata;
|
||||||
|
|
||||||
if (BookmarksProvider.selectedCollectionId == null) {
|
if (BookmarksProvider.selectedCollectionId == null) {
|
||||||
@@ -86,28 +106,69 @@ class _CollectionPageState extends State<CollectionPage> {
|
|||||||
(c) => c.id == BookmarksProvider.selectedCollectionId,
|
(c) => c.id == BookmarksProvider.selectedCollectionId,
|
||||||
);
|
);
|
||||||
|
|
||||||
return Scaffold(
|
return PopScope(
|
||||||
|
canPop: selectedBookmarkId == -1,
|
||||||
|
onPopInvokedWithResult: (didPop, result) {
|
||||||
|
if (didPop == false) deselectBookmark();
|
||||||
|
},
|
||||||
|
child: Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: selectedMapsLink != null
|
title: selectedMapsLink != null
|
||||||
? Text('Add to ${collection.name}')
|
? Text(
|
||||||
|
AppLocalizations.of(
|
||||||
|
context,
|
||||||
|
)!.addToCollection(collection.name),
|
||||||
|
)
|
||||||
: Text(collection.name),
|
: Text(collection.name),
|
||||||
actions: [
|
actions: [
|
||||||
if (selectedMapsLink != null)
|
if (selectedMapsLink != null)
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => provider.removeCurrentMapsLink(),
|
onPressed: () => provider.removeCurrentMapsLink(),
|
||||||
child: Text('Cancel'),
|
child: Text(AppLocalizations.of(context)!.cancel),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: ListView.builder(
|
bottomNavigationBar: selectedBookmarkId > 0
|
||||||
|
? ListItemActionsWidget(
|
||||||
|
onDeletePressed: onDeleteBookmarkPressed,
|
||||||
|
onCancelPressed: onCancelSelectionPressed,
|
||||||
|
onEditPressed: () => editBookmark(
|
||||||
|
bookmarks.firstWhere(
|
||||||
|
(element) => element.id == selectedBookmarkId,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
body: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.9,
|
||||||
|
child: ListView.separated(
|
||||||
itemBuilder: (context, index) =>
|
itemBuilder: (context, index) =>
|
||||||
bookmarksListItemBuilder(context, bookmarks.elementAt(index)),
|
bookmarksListItemBuilder(context, bookmarks.elementAt(index)),
|
||||||
itemCount: bookmarks.length,
|
itemCount: bookmarks.length,
|
||||||
|
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton(
|
floatingActionButton: FloatingActionButton(
|
||||||
onPressed: onAddButtonPressed,
|
onPressed: onAddButtonPressed,
|
||||||
child: Icon(selectedMapsLink != null ? Icons.save : Icons.add),
|
child: Icon(selectedMapsLink != null ? Icons.save : Icons.add),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onCancelSelectionPressed() => deselectBookmark();
|
||||||
|
|
||||||
|
void onDeleteBookmarkPressed() {
|
||||||
|
Storage.deleteBookmarkById(
|
||||||
|
selectedBookmarkId,
|
||||||
|
).whenComplete(() => setState(() {}));
|
||||||
|
deselectBookmark();
|
||||||
|
}
|
||||||
|
|
||||||
|
void deselectBookmark() {
|
||||||
|
selectedBookmarkId = -1;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
import '../model/collection.dart';
|
import '../model/collection.dart';
|
||||||
import '../service/bookmarks_provider.dart';
|
import '../service/bookmarks_provider.dart';
|
||||||
import '../service/shared_link_provider.dart';
|
import '../service/shared_link_provider.dart';
|
||||||
@@ -8,6 +9,7 @@ import '../service/storage.dart';
|
|||||||
import '../widgets/create_bookmark_collection_dialog.dart';
|
import '../widgets/create_bookmark_collection_dialog.dart';
|
||||||
import 'collection_page.dart';
|
import 'collection_page.dart';
|
||||||
import 'search_page.dart' show SearchPage;
|
import 'search_page.dart' show SearchPage;
|
||||||
|
import 'settings_page.dart';
|
||||||
|
|
||||||
class CollectionsListPage extends StatefulWidget {
|
class CollectionsListPage extends StatefulWidget {
|
||||||
const CollectionsListPage({super.key});
|
const CollectionsListPage({super.key});
|
||||||
@@ -20,6 +22,7 @@ class CollectionsListPage extends StatefulWidget {
|
|||||||
|
|
||||||
class _CollectionsListPageState extends State<CollectionsListPage> {
|
class _CollectionsListPageState extends State<CollectionsListPage> {
|
||||||
bool addingNewBookmark = false;
|
bool addingNewBookmark = false;
|
||||||
|
var bookmarkCountMap = <int, int>{};
|
||||||
|
|
||||||
Widget bottomSheetBuilder(BuildContext context) {
|
Widget bottomSheetBuilder(BuildContext context) {
|
||||||
final titleTextFieldController = TextEditingController(
|
final titleTextFieldController = TextEditingController(
|
||||||
@@ -53,6 +56,11 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
|
|||||||
title: Text(collection.name),
|
title: Text(collection.name),
|
||||||
onTap: () => navigateToCollection(collection.id),
|
onTap: () => navigateToCollection(collection.id),
|
||||||
onLongPress: () => onEditCollection(collection),
|
onLongPress: () => onEditCollection(collection),
|
||||||
|
leading: const Icon(Icons.list_rounded),
|
||||||
|
trailing: Text(
|
||||||
|
bookmarkCountMap[collection.id]?.toString() ?? '0',
|
||||||
|
style: Theme.of(context).textTheme.bodyMedium,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,24 +85,34 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final collections = Storage.loadCollections();
|
final collections = Storage.loadCollections();
|
||||||
final provider = context.watch<SharedLinkProvider>();
|
bookmarkCountMap = Storage.loadPerCollectionBookmarkCount();
|
||||||
addingNewBookmark = provider.currentMapsLinkMetadata != null;
|
addingNewBookmark =
|
||||||
|
Provider.of<SharedLinkProvider>(context).currentMapsLinkMetadata !=
|
||||||
|
null;
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: addingNewBookmark
|
title: addingNewBookmark
|
||||||
? Text('Choose Collection')
|
? Text(AppLocalizations.of(context)!.chooseCollection)
|
||||||
: Text('Collections'),
|
: Text(AppLocalizations.of(context)!.collections),
|
||||||
actions: [
|
actions: [
|
||||||
if (addingNewBookmark)
|
if (addingNewBookmark)
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => provider.removeCurrentMapsLink(),
|
onPressed: () => Provider.of<SharedLinkProvider>(
|
||||||
child: Text('Cancel'),
|
context,
|
||||||
|
listen: false,
|
||||||
|
).removeCurrentMapsLink(),
|
||||||
|
child: Text(AppLocalizations.of(context)!.cancel),
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
Navigator.of(context).pushNamed(SearchPage.routeName),
|
Navigator.of(context).pushNamed(SearchPage.routeName),
|
||||||
icon: Icon(Icons.search),
|
icon: Icon(Icons.search_rounded),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () =>
|
||||||
|
Navigator.of(context).pushNamed(SettingsPage.routeName),
|
||||||
|
icon: Icon(Icons.settings_rounded),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -103,14 +121,22 @@ class _CollectionsListPageState extends State<CollectionsListPage> {
|
|||||||
child: Icon(Icons.add),
|
child: Icon(Icons.add),
|
||||||
),
|
),
|
||||||
body: collections.isNotEmpty
|
body: collections.isNotEmpty
|
||||||
? ListView.builder(
|
? Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.9,
|
||||||
|
child: ListView.separated(
|
||||||
itemBuilder: (context, index) => collectionsListItemBuilder(
|
itemBuilder: (context, index) => collectionsListItemBuilder(
|
||||||
context,
|
context,
|
||||||
collections.elementAt(index),
|
collections.elementAt(index),
|
||||||
),
|
),
|
||||||
itemCount: collections.length,
|
itemCount: collections.length,
|
||||||
|
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||||
|
),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
: Center(child: Text('Create your first Collection to get started!')),
|
: Center(
|
||||||
|
child: Text(AppLocalizations.of(context)!.tipCreateCollections),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
import '../service/search_provider.dart';
|
import '../service/search_provider.dart';
|
||||||
import '../widgets/search_widgets/search_bar_widget.dart';
|
import '../widgets/search_widgets/search_bar_widget.dart';
|
||||||
import '../widgets/search_widgets/search_results_widget.dart';
|
import '../widgets/search_widgets/search_results_widget.dart';
|
||||||
@@ -12,15 +13,23 @@ class SearchPage extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: Text('Search')),
|
appBar: AppBar(title: Text(AppLocalizations.of(context)!.search)),
|
||||||
body: Column(
|
body: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.9,
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
|
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||||
SearchBarWidget(
|
SearchBarWidget(
|
||||||
onEditingComplete: context.read<SearchProvider>().setSearchText,
|
onEditingComplete: context.read<SearchProvider>().setSearchText,
|
||||||
|
onResetSearch: context.read<SearchProvider>().removeSearchText,
|
||||||
),
|
),
|
||||||
|
Padding(padding: EdgeInsetsGeometry.only(top: 10)),
|
||||||
Expanded(child: SearchResultsWidget()),
|
Expanded(child: SearchResultsWidget()),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
191
lib/pages/settings_page.dart
Normal file
191
lib/pages/settings_page.dart
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
|
import '../service/notifying.dart';
|
||||||
|
import '../service/permission_service.dart';
|
||||||
|
import '../service/settings_provider.dart';
|
||||||
|
import '../service/storage.dart';
|
||||||
|
|
||||||
|
class SettingsPage extends StatefulWidget {
|
||||||
|
static const routeName = '/settings';
|
||||||
|
const SettingsPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<SettingsPage> createState() => _SettingsPageState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _SettingsPageState extends State<SettingsPage> {
|
||||||
|
bool storagePermissionIsGranted = false;
|
||||||
|
final tileSpacing = 16.0;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
PermissionService.storagePermissionStatus.then((value) {
|
||||||
|
storagePermissionIsGranted = value.isGranted;
|
||||||
|
if (context.mounted) setState(() {});
|
||||||
|
});
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Localize
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final titlePadding = Theme.of(context).listTileTheme.contentPadding!;
|
||||||
|
checkStoragePermission();
|
||||||
|
final alwaysExportEnabled = context
|
||||||
|
.watch<SettingsProvider>()
|
||||||
|
.settings
|
||||||
|
.alwaysExportEnabled;
|
||||||
|
|
||||||
|
return Scaffold(
|
||||||
|
appBar: AppBar(title: Text(AppLocalizations.of(context)!.settings)),
|
||||||
|
body: Center(
|
||||||
|
child: SizedBox(
|
||||||
|
width: MediaQuery.of(context).size.width * 0.9,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: titlePadding,
|
||||||
|
child: Text(
|
||||||
|
AppLocalizations.of(context)!.appData,
|
||||||
|
style: Theme.of(context).textTheme.titleLarge,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
SizedBox(height: tileSpacing),
|
||||||
|
ListTile(
|
||||||
|
title: Text('Grant storage permisson'),
|
||||||
|
subtitle: storagePermissionIsGranted
|
||||||
|
? Text('Storage permission granted')
|
||||||
|
: Text(
|
||||||
|
'For app-data settings to work, you need to grant the app permissions to manage internal storage.',
|
||||||
|
),
|
||||||
|
onTap: () => PermissionService.requestStoragePermission
|
||||||
|
.whenComplete(() => checkStoragePermission()),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||||
|
enabled: !storagePermissionIsGranted,
|
||||||
|
),
|
||||||
|
SizedBox(height: tileSpacing),
|
||||||
|
ListTile(
|
||||||
|
title: Text(AppLocalizations.of(context)!.import),
|
||||||
|
subtitle: Text('Import app-data from a json file.'),
|
||||||
|
onTap: () => onJsonImportPressed(),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||||
|
enabled: storagePermissionIsGranted,
|
||||||
|
),
|
||||||
|
SizedBox(height: tileSpacing),
|
||||||
|
ListTile(
|
||||||
|
title: Text(AppLocalizations.of(context)!.export),
|
||||||
|
subtitle: Text(
|
||||||
|
'Export app-data to a json file in the selected directory.',
|
||||||
|
),
|
||||||
|
onTap: () => onJsonExportPressed(),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||||
|
enabled: storagePermissionIsGranted,
|
||||||
|
),
|
||||||
|
SizedBox(height: tileSpacing),
|
||||||
|
ListTile(
|
||||||
|
title: Text('Always save to file'),
|
||||||
|
subtitle: Text(
|
||||||
|
'Export app data to a directory, every time you make a change',
|
||||||
|
),
|
||||||
|
onTap: () => onAlwaysSaveToJsonPressed(),
|
||||||
|
trailing: Checkbox(
|
||||||
|
value: alwaysExportEnabled,
|
||||||
|
onChanged: (value) {
|
||||||
|
onAlwaysSaveToJsonPressed();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
enabled: storagePermissionIsGranted,
|
||||||
|
),
|
||||||
|
if (alwaysExportEnabled) SizedBox(height: tileSpacing),
|
||||||
|
if (alwaysExportEnabled)
|
||||||
|
ListTile(
|
||||||
|
title: Text('Change export directory'),
|
||||||
|
subtitle: Text(
|
||||||
|
context
|
||||||
|
.watch<SettingsProvider>()
|
||||||
|
.settings
|
||||||
|
.exportDirectoryPath,
|
||||||
|
),
|
||||||
|
onTap: () => onChangeExportDirectoryPressed(),
|
||||||
|
trailing: Icon(Icons.arrow_forward_ios_rounded),
|
||||||
|
enabled: storagePermissionIsGranted,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onJsonExportPressed() async {
|
||||||
|
if (!await checkStoragePermission()) return;
|
||||||
|
Storage.exportToJsonFile().then(showExportInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onJsonImportPressed() async {
|
||||||
|
if (!await checkStoragePermission()) return;
|
||||||
|
Storage.importFromJsonFile().then(showImportInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onAlwaysSaveToJsonPressed() async {
|
||||||
|
if (context.read<SettingsProvider>().settings.alwaysExportEnabled) {
|
||||||
|
context.read<SettingsProvider>().setExportDirectoryPath('', silent: true);
|
||||||
|
context.read<SettingsProvider>().setAlwaysExportEnabled(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!await PermissionService.storagePermissionStatus.isGranted) return;
|
||||||
|
final dir = await Storage.selectDirectoryPath();
|
||||||
|
if (dir.isEmpty || !context.mounted) return;
|
||||||
|
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
|
context.read<SettingsProvider>().setExportDirectoryPath(dir, silent: true);
|
||||||
|
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
|
Storage.saveDataToFile().whenComplete(
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
|
() => context.read<SettingsProvider>().setAlwaysExportEnabled(true),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onChangeExportDirectoryPressed() async {
|
||||||
|
if (!await PermissionService.storagePermissionStatus.isGranted) return;
|
||||||
|
final dir = await Storage.selectDirectoryPath();
|
||||||
|
if (dir.isEmpty || !context.mounted) return;
|
||||||
|
|
||||||
|
// ignore: use_build_context_synchronously
|
||||||
|
context.read<SettingsProvider>().setExportDirectoryPath(dir);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<bool> checkStoragePermission() async {
|
||||||
|
PermissionService.storagePermissionStatus.then((value) {
|
||||||
|
if (context.mounted && value.isGranted != storagePermissionIsGranted) {
|
||||||
|
storagePermissionIsGranted = value.isGranted;
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return storagePermissionIsGranted;
|
||||||
|
}
|
||||||
|
|
||||||
|
void showExportInfo(bool success) => Notifying.showSnackbar(
|
||||||
|
context,
|
||||||
|
text: success
|
||||||
|
? AppLocalizations.of(context)!.exportSuccess
|
||||||
|
: AppLocalizations.of(context)!.exportFailed,
|
||||||
|
isError: !success,
|
||||||
|
);
|
||||||
|
|
||||||
|
void showImportInfo(bool success) => Notifying.showSnackbar(
|
||||||
|
context,
|
||||||
|
text: success
|
||||||
|
? AppLocalizations.of(context)!.importSuccess
|
||||||
|
: AppLocalizations.of(context)!.importFailed,
|
||||||
|
isError: !success,
|
||||||
|
);
|
||||||
|
}
|
||||||
90
lib/service/json_file_service.dart
Normal file
90
lib/service/json_file_service.dart
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:file_selector/file_selector.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import '../model/bookmark.dart';
|
||||||
|
import '../model/collection.dart';
|
||||||
|
import '../assets/constants.dart' as constants;
|
||||||
|
|
||||||
|
class JsonFileService {
|
||||||
|
static Future<bool> exportToJson({
|
||||||
|
required List<Collection> collections,
|
||||||
|
required List<Bookmark> bookmarks,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final dir = await selectDirectoryPath();
|
||||||
|
if (dir.isEmpty) return false;
|
||||||
|
|
||||||
|
saveDataToFile(collections, bookmarks, dir);
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<({List<Collection> collections, List<Bookmark> bookmarks})>
|
||||||
|
importFromJson() async {
|
||||||
|
try {
|
||||||
|
const typeGroup = XTypeGroup(label: 'json', extensions: <String>['json']);
|
||||||
|
final XFile? file = await openFile(
|
||||||
|
acceptedTypeGroups: <XTypeGroup>[typeGroup],
|
||||||
|
);
|
||||||
|
|
||||||
|
if (file == null) {
|
||||||
|
return (collections: <Collection>[], bookmarks: <Bookmark>[]);
|
||||||
|
}
|
||||||
|
|
||||||
|
final jsonString = await file.readAsString();
|
||||||
|
|
||||||
|
final data = jsonDecode(jsonString) as Map<String, dynamic>;
|
||||||
|
|
||||||
|
final collections = (data['collections'] as List<dynamic>? ?? [])
|
||||||
|
.map((json) => Collection.fromJson(json as Map<String, dynamic>))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
final bookmarks = (data['bookmarks'] as List<dynamic>? ?? [])
|
||||||
|
.map((json) => Bookmark.fromJson(json as Map<String, dynamic>))
|
||||||
|
.toList();
|
||||||
|
|
||||||
|
return (collections: collections, bookmarks: bookmarks);
|
||||||
|
} catch (e) {
|
||||||
|
return (collections: <Collection>[], bookmarks: <Bookmark>[]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<bool> saveDataToFile(
|
||||||
|
List<Collection> collections,
|
||||||
|
List<Bookmark> bookmarks,
|
||||||
|
String directory,
|
||||||
|
) async {
|
||||||
|
try {
|
||||||
|
final data = jsonEncode({
|
||||||
|
'collections': collections.map((c) => c.toJson()).toList(),
|
||||||
|
'bookmarks': bookmarks.map((b) => b.toJson()).toList(),
|
||||||
|
}).codeUnits;
|
||||||
|
|
||||||
|
final file = XFile.fromData(
|
||||||
|
Uint8List.fromList(data),
|
||||||
|
mimeType: 'application/json',
|
||||||
|
name: constants.jsonFileName,
|
||||||
|
);
|
||||||
|
|
||||||
|
file.saveTo('$directory/${constants.jsonFileName}');
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<String> selectDirectoryPath() async {
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
return await getDirectoryPath(
|
||||||
|
initialDirectory: constants.defaultAndroidExportDirectory,
|
||||||
|
) ??
|
||||||
|
'';
|
||||||
|
}
|
||||||
|
return await getDirectoryPath() ?? '';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,15 +1,9 @@
|
|||||||
// service/maps_launcher_service.dart
|
|
||||||
import 'dart:io' show Platform;
|
import 'dart:io' show Platform;
|
||||||
import 'package:android_intent_plus/android_intent.dart';
|
import 'package:android_intent_plus/android_intent.dart';
|
||||||
|
|
||||||
class MapsLauncherService {
|
class MapsLauncherService {
|
||||||
/// Opens a URL in Google Maps app
|
|
||||||
/// Falls back to browser if Maps app is not installed
|
|
||||||
static Future<bool> openInGoogleMaps(String url) async {
|
static Future<bool> openInGoogleMaps(String url) async {
|
||||||
if (!Platform.isAndroid) {
|
if (!Platform.isAndroid) return false;
|
||||||
// Handle iOS or other platforms if needed
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Try to open in Google Maps app
|
// Try to open in Google Maps app
|
||||||
@@ -28,36 +22,16 @@ class MapsLauncherService {
|
|||||||
await browserIntent.launch();
|
await browserIntent.launch();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Failed to open maps link: $e');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Opens navigation to specific coordinates
|
|
||||||
static Future<bool> navigateToCoordinates(
|
|
||||||
String latitude,
|
|
||||||
String longitude,
|
|
||||||
) async {
|
|
||||||
final url = 'google.navigation:q=$latitude,$longitude';
|
|
||||||
return openInGoogleMaps(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Opens a search query in Google Maps
|
|
||||||
static Future<bool> searchInMaps(String query) async {
|
|
||||||
final encodedQuery = Uri.encodeComponent(query);
|
|
||||||
final url = 'geo:0,0?q=$encodedQuery';
|
|
||||||
return openInGoogleMaps(url);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Shares a Google Maps link or location via Android share sheet
|
|
||||||
static Future<bool> shareLocation({
|
static Future<bool> shareLocation({
|
||||||
required String text,
|
required String text,
|
||||||
String? subject,
|
String? subject,
|
||||||
}) async {
|
}) async {
|
||||||
if (!Platform.isAndroid) {
|
if (!Platform.isAndroid) return false;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final intent = AndroidIntent(
|
final intent = AndroidIntent(
|
||||||
@@ -72,7 +46,6 @@ class MapsLauncherService {
|
|||||||
await intent.launch();
|
await intent.launch();
|
||||||
return true;
|
return true;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
print('Failed to share location: $e');
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
import 'url_launcher.dart' show UrlLaunchErrorCode;
|
import 'url_launcher.dart' show UrlLaunchErrorCode;
|
||||||
|
|
||||||
class Notifying {
|
class Notifying {
|
||||||
@@ -8,14 +9,32 @@ class Notifying {
|
|||||||
required String text,
|
required String text,
|
||||||
bool isError = false,
|
bool isError = false,
|
||||||
}) {
|
}) {
|
||||||
|
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(
|
backgroundColor: isError ? Theme.of(context).colorScheme.error : null,
|
||||||
|
content: SizedBox(
|
||||||
|
height: 30,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
Text(
|
||||||
text,
|
text,
|
||||||
style: isError
|
style: isError
|
||||||
? TextStyle(color: Theme.of(context).colorScheme.error)
|
? TextStyle(color: Theme.of(context).colorScheme.onError)
|
||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: () =>
|
||||||
|
ScaffoldMessenger.of(context).hideCurrentSnackBar(),
|
||||||
|
icon: Icon(
|
||||||
|
Icons.close_rounded,
|
||||||
|
color: isError ? Theme.of(context).colorScheme.onError : null,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -28,10 +47,18 @@ class Notifying {
|
|||||||
if (errorCode == UrlLaunchErrorCode.none) {
|
if (errorCode == UrlLaunchErrorCode.none) {
|
||||||
return;
|
return;
|
||||||
} else if (errorCode == UrlLaunchErrorCode.couldNotLaunch) {
|
} else if (errorCode == UrlLaunchErrorCode.couldNotLaunch) {
|
||||||
errorText = 'Could not launch Url';
|
errorText = AppLocalizations.of(context)!.errorCouldNotLaunchUrl;
|
||||||
} else {
|
} else {
|
||||||
errorText = 'Invalid Url';
|
errorText = AppLocalizations.of(context)!.errorInvalidUrl;
|
||||||
}
|
}
|
||||||
showSnackbar(context, text: errorText, isError: true);
|
showSnackbar(context, text: errorText, isError: true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void showErrorSnackbar(BuildContext context, String message) {
|
||||||
|
showSnackbar(context, text: message, isError: true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void showMessageSnackbar(BuildContext context, String message) {
|
||||||
|
showSnackbar(context, text: message, isError: false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
9
lib/service/permission_service.dart
Normal file
9
lib/service/permission_service.dart
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
import 'package:permission_handler/permission_handler.dart';
|
||||||
|
|
||||||
|
class PermissionService {
|
||||||
|
static Future<PermissionStatus> get storagePermissionStatus =>
|
||||||
|
Permission.manageExternalStorage.status;
|
||||||
|
|
||||||
|
static Future<PermissionStatus> get requestStoragePermission =>
|
||||||
|
Permission.manageExternalStorage.request();
|
||||||
|
}
|
||||||
@@ -8,5 +8,10 @@ class SearchProvider extends ChangeNotifier {
|
|||||||
if (!silent) notifyListeners();
|
if (!silent) notifyListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeSearchText({bool silent = false}) {
|
||||||
|
_searchText = '';
|
||||||
|
if (!silent) notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
String get searchText => _searchText;
|
String get searchText => _searchText;
|
||||||
}
|
}
|
||||||
|
|||||||
24
lib/service/settings_provider.dart
Normal file
24
lib/service/settings_provider.dart
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../model/settings.dart';
|
||||||
|
import 'storage.dart';
|
||||||
|
|
||||||
|
class SettingsProvider extends ChangeNotifier {
|
||||||
|
SettingsProvider() : _settings = Storage.loadSettings();
|
||||||
|
|
||||||
|
Settings _settings;
|
||||||
|
|
||||||
|
Settings get settings => _settings;
|
||||||
|
|
||||||
|
void setExportDirectoryPath(String path, {bool silent = false}) {
|
||||||
|
_settings = _settings.copyWith(exportDirectoryPath: path);
|
||||||
|
Storage.saveSettings(_settings);
|
||||||
|
if (!silent) notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
void setAlwaysExportEnabled(bool enabled, {bool silent = false}) {
|
||||||
|
_settings = _settings.copyWith(alwaysExportEnabled: enabled);
|
||||||
|
Storage.saveSettings(_settings);
|
||||||
|
if (!silent) notifyListeners();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,21 +4,49 @@ import 'package:shared_preferences/shared_preferences.dart';
|
|||||||
|
|
||||||
import '../model/bookmark.dart';
|
import '../model/bookmark.dart';
|
||||||
import '../model/collection.dart';
|
import '../model/collection.dart';
|
||||||
|
import '../model/settings.dart';
|
||||||
|
import 'json_file_service.dart';
|
||||||
|
|
||||||
class Storage {
|
class Storage {
|
||||||
static const String _bookmarksKey = 'bookmarks';
|
static const String _bookmarksKey = 'bookmarks';
|
||||||
static const String _collectionsKey = 'collections';
|
static const String _collectionsKey = 'collections';
|
||||||
static SharedPreferencesWithCache? _prefsWithCache;
|
static SharedPreferencesWithCache? _prefsWithCache;
|
||||||
|
static const String _settingsKey = 'settings';
|
||||||
static const String _statsKey = 'stats';
|
static const String _statsKey = 'stats';
|
||||||
|
static Settings _currentSettings = Settings.defaults();
|
||||||
|
|
||||||
static Future<void> initialize() async {
|
static Future<void> initialize() async {
|
||||||
_prefsWithCache = await SharedPreferencesWithCache.create(
|
_prefsWithCache = await SharedPreferencesWithCache.create(
|
||||||
cacheOptions: const SharedPreferencesWithCacheOptions(
|
cacheOptions: const SharedPreferencesWithCacheOptions(
|
||||||
allowList: <String>{_collectionsKey, _bookmarksKey, _statsKey},
|
allowList: <String>{
|
||||||
|
_collectionsKey,
|
||||||
|
_bookmarksKey,
|
||||||
|
_statsKey,
|
||||||
|
_settingsKey,
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Settings loadSettings() {
|
||||||
|
final jsonString = _prefs.getString(_settingsKey);
|
||||||
|
if (jsonString != null) {
|
||||||
|
final json = jsonDecode(jsonString) as Map<String, dynamic>;
|
||||||
|
_currentSettings = Settings.fromJson(json);
|
||||||
|
return _currentSettings;
|
||||||
|
} else {
|
||||||
|
final settings = Settings.defaults();
|
||||||
|
saveSettings(settings);
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<void> saveSettings(Settings settings) {
|
||||||
|
final json = jsonEncode(settings.toJson());
|
||||||
|
_currentSettings = settings;
|
||||||
|
return _prefs.setString(_settingsKey, json);
|
||||||
|
}
|
||||||
|
|
||||||
static List<Collection> loadCollections() {
|
static List<Collection> loadCollections() {
|
||||||
final jsonString = _prefs.getString(_collectionsKey) ?? '[]';
|
final jsonString = _prefs.getString(_collectionsKey) ?? '[]';
|
||||||
final jsonList = jsonDecode(jsonString) as List;
|
final jsonList = jsonDecode(jsonString) as List;
|
||||||
@@ -38,11 +66,13 @@ class Storage {
|
|||||||
static Future<void> saveCollections(List<Collection> collections) async {
|
static Future<void> saveCollections(List<Collection> collections) async {
|
||||||
final jsonList = collections.map((c) => c.toJson()).toList();
|
final jsonList = collections.map((c) => c.toJson()).toList();
|
||||||
await _prefs.setString(_collectionsKey, jsonEncode(jsonList));
|
await _prefs.setString(_collectionsKey, jsonEncode(jsonList));
|
||||||
|
if (_currentSettings.alwaysExportEnabled) saveDataToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
static Future<void> saveBookmarks(List<Bookmark> bookmarks) async {
|
static Future<void> saveBookmarks(List<Bookmark> bookmarks) async {
|
||||||
final jsonList = bookmarks.map((b) => b.toJson()).toList();
|
final jsonList = bookmarks.map((b) => b.toJson()).toList();
|
||||||
await _prefs.setString(_bookmarksKey, jsonEncode(jsonList));
|
await _prefs.setString(_bookmarksKey, jsonEncode(jsonList));
|
||||||
|
if (_currentSettings.alwaysExportEnabled) saveDataToFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
static List<Bookmark> loadBookmarksForCollection(int collectionId) {
|
static List<Bookmark> loadBookmarksForCollection(int collectionId) {
|
||||||
@@ -50,6 +80,14 @@ class Storage {
|
|||||||
return allBookmarks.where((b) => b.collectionId == collectionId).toList();
|
return allBookmarks.where((b) => b.collectionId == collectionId).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Map<int, int> loadPerCollectionBookmarkCount() {
|
||||||
|
return loadBookmarks().fold(<int, int>{}, (map, bookmark) {
|
||||||
|
map[bookmark.collectionId] ??= 0;
|
||||||
|
map[bookmark.collectionId] = map[bookmark.collectionId]! + 1;
|
||||||
|
return map;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
static Future<void> addBookmark(Bookmark bookmark) async {
|
static Future<void> addBookmark(Bookmark bookmark) async {
|
||||||
final bookmarks = loadBookmarks();
|
final bookmarks = loadBookmarks();
|
||||||
bookmarks.add(bookmark);
|
bookmarks.add(bookmark);
|
||||||
@@ -147,6 +185,31 @@ class Storage {
|
|||||||
await _prefs.setString(_statsKey, jsonEncode(stats));
|
await _prefs.setString(_statsKey, jsonEncode(stats));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<bool> exportToJsonFile() => JsonFileService.exportToJson(
|
||||||
|
collections: loadCollections(),
|
||||||
|
bookmarks: loadBookmarks(),
|
||||||
|
);
|
||||||
|
|
||||||
|
static Future<bool> importFromJsonFile() async {
|
||||||
|
final import = await JsonFileService.importFromJson();
|
||||||
|
|
||||||
|
if (import.bookmarks.isNotEmpty || import.collections.isNotEmpty) {
|
||||||
|
saveBookmarks(import.bookmarks);
|
||||||
|
saveCollections(import.collections);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static Future<String> selectDirectoryPath() =>
|
||||||
|
JsonFileService.selectDirectoryPath();
|
||||||
|
|
||||||
|
static Future<bool> saveDataToFile() => JsonFileService.saveDataToFile(
|
||||||
|
loadCollections(),
|
||||||
|
loadBookmarks(),
|
||||||
|
_currentSettings.exportDirectoryPath,
|
||||||
|
);
|
||||||
|
|
||||||
static SharedPreferencesWithCache get _prefs {
|
static SharedPreferencesWithCache get _prefs {
|
||||||
if (_prefsWithCache == null) {
|
if (_prefsWithCache == null) {
|
||||||
throw StateError(
|
throw StateError(
|
||||||
|
|||||||
@@ -1,15 +1,30 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
ThemeData get lightTheme => ThemeData.from(colorScheme: _lightColorScheme);
|
const _seed = Colors.deepPurple;
|
||||||
|
|
||||||
ThemeData get darkTheme => ThemeData.from(colorScheme: _darkColorScheme);
|
ColorScheme get _lightColorScheme =>
|
||||||
|
ColorScheme.fromSeed(seedColor: _seed, brightness: Brightness.light);
|
||||||
|
|
||||||
ColorScheme get _darkColorScheme => ColorScheme.fromSeed(
|
ColorScheme get _darkColorScheme =>
|
||||||
seedColor: Colors.deepPurple,
|
ColorScheme.fromSeed(seedColor: _seed, brightness: Brightness.dark);
|
||||||
brightness: Brightness.dark,
|
|
||||||
);
|
ThemeData get lightTheme => _baseTheme(_lightColorScheme);
|
||||||
|
|
||||||
ColorScheme get _lightColorScheme => ColorScheme.fromSeed(
|
ThemeData get darkTheme => _baseTheme(_darkColorScheme);
|
||||||
seedColor: Colors.deepPurple,
|
|
||||||
brightness: Brightness.light,
|
ThemeData _baseTheme(ColorScheme scheme) =>
|
||||||
|
ThemeData.from(colorScheme: scheme, useMaterial3: true).copyWith(
|
||||||
|
inputDecorationTheme: InputDecorationTheme(
|
||||||
|
border: OutlineInputBorder(borderRadius: BorderRadius.circular(12)),
|
||||||
|
),
|
||||||
|
listTileTheme: ListTileThemeData(
|
||||||
|
tileColor: scheme.surfaceContainer,
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadiusGeometry.circular(12),
|
||||||
|
),
|
||||||
|
textColor: scheme.onPrimaryContainer,
|
||||||
|
selectedTileColor: scheme.primaryContainer,
|
||||||
|
selectedColor: scheme.onPrimaryContainer,
|
||||||
|
contentPadding: EdgeInsetsDirectional.only(start: 16.0, end: 24.0),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class ListItemActionsWidget extends StatelessWidget {
|
||||||
|
final VoidCallback _onDeletePressed;
|
||||||
|
final VoidCallback _onCancelPressed;
|
||||||
|
final VoidCallback _onEditPressed;
|
||||||
|
|
||||||
|
const ListItemActionsWidget({
|
||||||
|
super.key,
|
||||||
|
required void Function() onDeletePressed,
|
||||||
|
required void Function() onCancelPressed,
|
||||||
|
required void Function() onEditPressed,
|
||||||
|
}) : _onEditPressed = onEditPressed,
|
||||||
|
_onCancelPressed = onCancelPressed,
|
||||||
|
_onDeletePressed = onDeletePressed;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Container(
|
||||||
|
padding: EdgeInsetsGeometry.fromLTRB(
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
10,
|
||||||
|
MediaQuery.of(context).viewPadding.bottom,
|
||||||
|
),
|
||||||
|
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: _onCancelPressed,
|
||||||
|
icon: const Icon(Icons.close_rounded),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: _onDeletePressed,
|
||||||
|
icon: const Icon(Icons.delete_forever_rounded),
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
onPressed: _onEditPressed,
|
||||||
|
icon: const Icon(Icons.edit_rounded),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
import '../model/collection.dart';
|
import '../model/collection.dart';
|
||||||
import 'edit_dialog_widgets/edit_dialog_actions.dart' show EditDialogActions;
|
import 'edit_dialog_widgets/edit_dialog_actions.dart' show EditDialogActions;
|
||||||
import 'edit_dialog_widgets/edit_dialog_title.dart';
|
import 'edit_dialog_widgets/edit_dialog_title.dart';
|
||||||
@@ -40,9 +41,7 @@ class CreateBookmarkCollectionDialog extends StatelessWidget {
|
|||||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||||
],
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
// TODO: Localize
|
labelText: AppLocalizations.of(context)!.collectionName,
|
||||||
labelText: 'Collection Name',
|
|
||||||
border: OutlineInputBorder(borderRadius: BorderRadius.circular(10)),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
|
import '../l10n/app_localizations.dart';
|
||||||
import '../model/bookmark.dart';
|
import '../model/bookmark.dart';
|
||||||
import '../model/maps_link_metadata.dart';
|
import '../model/maps_link_metadata.dart';
|
||||||
import 'edit_dialog_widgets/edit_dialog_actions.dart';
|
import 'edit_dialog_widgets/edit_dialog_actions.dart';
|
||||||
@@ -59,10 +60,7 @@ class CreateBookmarkDialog extends StatelessWidget {
|
|||||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||||
],
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Bookmark Title',
|
labelText: AppLocalizations.of(context)!.bookmarkTitle,
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
@@ -76,10 +74,7 @@ class CreateBookmarkDialog extends StatelessWidget {
|
|||||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||||
],
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Url',
|
labelText: AppLocalizations.of(context)!.url,
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
TextField(
|
TextField(
|
||||||
@@ -93,10 +88,7 @@ class CreateBookmarkDialog extends StatelessWidget {
|
|||||||
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
FilteringTextInputFormatter.deny(RegExp(r'\s\s+')),
|
||||||
],
|
],
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: 'Description',
|
labelText: AppLocalizations.of(context)!.description,
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -2,6 +2,8 @@ import 'package:flutter/material.dart'
|
|||||||
show TextButton, FloatingActionButton, Icons;
|
show TextButton, FloatingActionButton, Icons;
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
import '../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
class EditDialogActions extends StatelessWidget {
|
class EditDialogActions extends StatelessWidget {
|
||||||
const EditDialogActions({super.key, required this.onSavePressed});
|
const EditDialogActions({super.key, required this.onSavePressed});
|
||||||
final VoidCallback onSavePressed;
|
final VoidCallback onSavePressed;
|
||||||
@@ -13,7 +15,7 @@ class EditDialogActions extends StatelessWidget {
|
|||||||
children: [
|
children: [
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () => Navigator.of(context).pop(),
|
onPressed: () => Navigator.of(context).pop(),
|
||||||
child: Text('Cancel'),
|
child: Text(AppLocalizations.of(context)!.cancel),
|
||||||
),
|
),
|
||||||
FloatingActionButton(onPressed: onSavePressed, child: Icon(Icons.save)),
|
FloatingActionButton(onPressed: onSavePressed, child: Icon(Icons.save)),
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import 'package:flutter/material.dart' show TextButton, Theme;
|
import 'package:flutter/material.dart' show TextButton, Theme;
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
|
import '../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
class EditDialogTitle extends StatelessWidget {
|
class EditDialogTitle extends StatelessWidget {
|
||||||
const EditDialogTitle({
|
const EditDialogTitle({
|
||||||
super.key,
|
super.key,
|
||||||
@@ -15,11 +17,10 @@ class EditDialogTitle extends StatelessWidget {
|
|||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
// TODO: Localize
|
|
||||||
if (dialogType == DialogType.bookmark)
|
if (dialogType == DialogType.bookmark)
|
||||||
Text('Create Bookmark')
|
Text(AppLocalizations.of(context)!.createBookmark)
|
||||||
else
|
else
|
||||||
Text('Create Collection'),
|
Text(AppLocalizations.of(context)!.createCollection),
|
||||||
|
|
||||||
if (onDeletePressed != null)
|
if (onDeletePressed != null)
|
||||||
TextButton(
|
TextButton(
|
||||||
@@ -28,7 +29,7 @@ class EditDialogTitle extends StatelessWidget {
|
|||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
child: Text(
|
child: Text(
|
||||||
'Delete',
|
AppLocalizations.of(context)!.delete,
|
||||||
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
style: TextStyle(color: Theme.of(context).colorScheme.error),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -1,16 +1,37 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../l10n/app_localizations.dart';
|
||||||
|
|
||||||
class SearchBarWidget extends StatelessWidget {
|
class SearchBarWidget extends StatelessWidget {
|
||||||
const SearchBarWidget({super.key, required this.onEditingComplete});
|
const SearchBarWidget({
|
||||||
|
super.key,
|
||||||
|
required this.onEditingComplete,
|
||||||
|
required this.onResetSearch,
|
||||||
|
});
|
||||||
|
|
||||||
final Function(String searchString) onEditingComplete;
|
final Function(String searchString) onEditingComplete;
|
||||||
|
final Function() onResetSearch;
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return TextField(onChanged: (text) => onChanged(text, context));
|
|
||||||
}
|
|
||||||
|
|
||||||
void onChanged(String text, BuildContext context) {
|
void onChanged(String text, BuildContext context) {
|
||||||
if (context.mounted) onEditingComplete(text);
|
if (context.mounted) onEditingComplete(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final searchTextController = TextEditingController();
|
||||||
|
return TextField(
|
||||||
|
controller: searchTextController,
|
||||||
|
onChanged: (text) => onChanged(text, context),
|
||||||
|
decoration: InputDecoration(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
searchTextController.clear();
|
||||||
|
onResetSearch();
|
||||||
|
},
|
||||||
|
icon: Icon(Icons.delete_outline_outlined),
|
||||||
|
),
|
||||||
|
labelText: AppLocalizations.of(context)!.search,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
|
|
||||||
|
import '../../l10n/app_localizations.dart';
|
||||||
import '../../model/bookmark.dart';
|
import '../../model/bookmark.dart';
|
||||||
import '../../service/notifying.dart';
|
import '../../service/notifying.dart';
|
||||||
import '../../service/search_provider.dart';
|
import '../../service/search_provider.dart';
|
||||||
@@ -17,6 +18,12 @@ class SearchResultsWidget extends StatefulWidget {
|
|||||||
class _SearchResultsWidgetState extends State<SearchResultsWidget> {
|
class _SearchResultsWidgetState extends State<SearchResultsWidget> {
|
||||||
final List<Bookmark> allBookmarks = Storage.loadBookmarks();
|
final List<Bookmark> allBookmarks = Storage.loadBookmarks();
|
||||||
|
|
||||||
|
@override
|
||||||
|
void deactivate() {
|
||||||
|
context.read<SearchProvider>().removeSearchText(silent: true);
|
||||||
|
super.deactivate();
|
||||||
|
}
|
||||||
|
|
||||||
Widget bookmarkListItemBuilder(BuildContext context, int index) {
|
Widget bookmarkListItemBuilder(BuildContext context, int index) {
|
||||||
final bookmark = filteredBookmarks.elementAt(index);
|
final bookmark = filteredBookmarks.elementAt(index);
|
||||||
return ListTile(
|
return ListTile(
|
||||||
@@ -31,20 +38,21 @@ class _SearchResultsWidgetState extends State<SearchResultsWidget> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
if (filteredBookmarks.isNotEmpty) {
|
|
||||||
return ListView.builder(
|
|
||||||
itemBuilder: bookmarkListItemBuilder,
|
|
||||||
itemCount: filteredBookmarks.length,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return Center(child: Text('Start searching'));
|
|
||||||
}
|
|
||||||
|
|
||||||
Iterable<Bookmark> get filteredBookmarks => allBookmarks.where(
|
Iterable<Bookmark> get filteredBookmarks => allBookmarks.where(
|
||||||
(bookmark) => bookmark.name.toLowerCase().contains(
|
(bookmark) => bookmark.name.toLowerCase().contains(
|
||||||
context.watch<SearchProvider>().searchText.toLowerCase(),
|
context.watch<SearchProvider>().searchText.toLowerCase(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (filteredBookmarks.isNotEmpty) {
|
||||||
|
return ListView.separated(
|
||||||
|
itemBuilder: bookmarkListItemBuilder,
|
||||||
|
itemCount: filteredBookmarks.length,
|
||||||
|
separatorBuilder: (context, index) => SizedBox(height: 10),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return Center(child: Text(AppLocalizations.of(context)!.tipNoResults));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
137
pubspec.lock
137
pubspec.lock
@@ -49,6 +49,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.19.1"
|
version: "1.19.1"
|
||||||
|
cross_file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: cross_file
|
||||||
|
sha256: "701dcfc06da0882883a2657c445103380e53e647060ad8d9dfb710c100996608"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.3.5+1"
|
||||||
csslib:
|
csslib:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -89,6 +97,70 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "7.0.1"
|
version: "7.0.1"
|
||||||
|
file_selector:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: file_selector
|
||||||
|
sha256: bd15e43e9268db636b53eeaca9f56324d1622af30e5c34d6e267649758c84d9a
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.0"
|
||||||
|
file_selector_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_android
|
||||||
|
sha256: "51e8fd0446de75e4b62c065b76db2210c704562d072339d333bd89c57a7f8a7c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.2+4"
|
||||||
|
file_selector_ios:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_ios
|
||||||
|
sha256: e2ecf2885c121691ce13b60db3508f53c01f869fb6e8dc5c1cfa771e4c46aeca
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.3+5"
|
||||||
|
file_selector_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_linux
|
||||||
|
sha256: "2567f398e06ac72dcf2e98a0c95df2a9edd03c2c2e0cacd4780f20cdf56263a0"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.4"
|
||||||
|
file_selector_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_macos
|
||||||
|
sha256: "5e0bbe9c312416f1787a68259ea1505b52f258c587f12920422671807c4d618a"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.5"
|
||||||
|
file_selector_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_platform_interface
|
||||||
|
sha256: "35e0bd61ebcdb91a3505813b055b09b79dfdc7d0aee9c09a7ba59ae4bb13dc85"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "2.7.0"
|
||||||
|
file_selector_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_web
|
||||||
|
sha256: c4c0ea4224d97a60a7067eca0c8fd419e708ff830e0c83b11a48faf566cec3e7
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.4+2"
|
||||||
|
file_selector_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file_selector_windows
|
||||||
|
sha256: "62197474ae75893a62df75939c777763d39c2bc5f73ce5b88497208bc269abfd"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.9.3+5"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -102,6 +174,11 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.0"
|
version: "6.0.0"
|
||||||
|
flutter_localizations:
|
||||||
|
dependency: "direct main"
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
@@ -136,6 +213,14 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.1.2"
|
version: "4.1.2"
|
||||||
|
intl:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: intl
|
||||||
|
sha256: "3df61194eb431efc39c4ceba583b95633a403f46c9fd341e550ce0bfa50e9aa5"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.20.2"
|
||||||
leak_tracker:
|
leak_tracker:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -240,6 +325,54 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.3.0"
|
version: "2.3.0"
|
||||||
|
permission_handler:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: permission_handler
|
||||||
|
sha256: bc917da36261b00137bbc8896bf1482169cd76f866282368948f032c8c1caae1
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "12.0.1"
|
||||||
|
permission_handler_android:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_android
|
||||||
|
sha256: "1e3bc410ca1bf84662104b100eb126e066cb55791b7451307f9708d4007350e6"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "13.0.1"
|
||||||
|
permission_handler_apple:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_apple
|
||||||
|
sha256: f000131e755c54cf4d84a5d8bd6e4149e262cc31c5a8b1d698de1ac85fa41023
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "9.4.7"
|
||||||
|
permission_handler_html:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_html
|
||||||
|
sha256: "38f000e83355abb3392140f6bc3030660cfaef189e1f87824facb76300b4ff24"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.1.3+5"
|
||||||
|
permission_handler_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_platform_interface
|
||||||
|
sha256: eb99b295153abce5d683cac8c02e22faab63e50679b937fa1bf67d58bb282878
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.3.0"
|
||||||
|
permission_handler_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: permission_handler_windows
|
||||||
|
sha256: "1a790728016f79a41216d88672dbc5df30e686e811ad4e698bfc51f76ad91f1e"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.2.1"
|
||||||
platform:
|
platform:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
@@ -486,5 +619,5 @@ packages:
|
|||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.1.0"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=3.9.2 <4.0.0"
|
dart: ">=3.10.0 <4.0.0"
|
||||||
flutter: ">=3.35.0"
|
flutter: ">=3.38.0"
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ description: "A new way to save google maps bookmarks"
|
|||||||
|
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
version: 1.0.0+1
|
version: 0.0.18
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ^3.9.2
|
sdk: ^3.9.2
|
||||||
@@ -18,6 +18,11 @@ dependencies:
|
|||||||
provider: ^6.1.5+1
|
provider: ^6.1.5+1
|
||||||
metadata_fetch: ^0.4.2
|
metadata_fetch: ^0.4.2
|
||||||
url_launcher: ^6.3.2
|
url_launcher: ^6.3.2
|
||||||
|
flutter_localizations:
|
||||||
|
sdk: flutter
|
||||||
|
intl: any
|
||||||
|
permission_handler: ^12.0.1
|
||||||
|
file_selector: ^1.1.0
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
@@ -26,5 +31,5 @@ dev_dependencies:
|
|||||||
flutter_lints: ^6.0.0
|
flutter_lints: ^6.0.0
|
||||||
|
|
||||||
flutter:
|
flutter:
|
||||||
|
generate: true
|
||||||
uses-material-design: true
|
uses-material-design: true
|
||||||
Reference in New Issue
Block a user