37 Commits

Author SHA1 Message Date
cfc810a6a0 Allow editing the name of library lists 2026-02-24 18:37:34 +09:00
0bf0764f91 screens/changelog: fix listing 2026-02-24 14:55:37 +09:00
656069964f Remove redundant import 2026-02-24 14:39:31 +09:00
b7518b0c64 Switch out \ThemeBloc\ for material theme with extensions 2026-02-24 14:38:39 +09:00
56d872b508 assets/licenses: licenses for kanjivg and jonathan waller jlpt 2026-02-24 11:46:10 +09:00
43ea9bf621 assets/licenses: add edrdg license 2026-02-24 02:14:25 +09:00
6339c1619f models/library_list: add function for renaming lists 2026-02-24 02:04:06 +09:00
4b80b906ec Add keys to the items of a few lists 2026-02-24 01:25:30 +09:00
ec0252ed77 pubspec.yaml: sort deps 2026-02-23 23:28:40 +09:00
ddad387351 Fix two instances of deprecated function usage 2026-02-23 21:24:24 +09:00
3cdd857dd2 search_card: long press to copy content 2026-02-23 21:18:38 +09:00
31f6a37689 library_list: long press to copy content (kanji only) 2026-02-23 21:18:34 +09:00
4faaf235a5 history: long press to copy searchword 2026-02-23 21:17:57 +09:00
8ad248724b kanji_search/radical_list: show all enabled radicals at top of list 2026-02-23 13:53:31 +09:00
764a3ab20d kanji_result: fetch example words (again) 2026-02-23 13:25:17 +09:00
b98dec9588 Use kanimaji to render kanji stroke order animations 2026-02-22 23:01:11 +09:00
fef467544d Retrieve fonts through google fonts package, add more fonts 2026-02-21 01:40:40 +09:00
6b0a0a3b04 pubspec.{yaml,lock}: update deps 2026-02-21 01:04:14 +09:00
b9af589236 database: fix migration handling 2026-02-21 01:03:55 +09:00
60d177577c history: fix "no entries" case 2026-02-21 01:03:25 +09:00
40846558aa flake.lock: bump, pubspec.lock: update inputs 2026-02-20 15:39:51 +09:00
116d15db1c Fix a few lints 2026-02-20 15:33:33 +09:00
14b8fe604d flake.lock: bump, pubspec.lock: update inputs 2026-02-09 15:03:58 +09:00
55fa81dfa8 Add script for automating publishing 2025-12-19 13:10:04 +09:00
c39bf9df87 Prepare v0.5.0 release 2025-12-19 12:15:33 +09:00
f89b233893 history: fix missing date dividers
bug introduced in 4a7b28ad68
2025-12-19 12:04:16 +09:00
8a98f28ff4 pubspec.lock: update deps 2025-12-19 11:47:10 +09:00
1619451191 Update android environment 2025-12-19 11:46:56 +09:00
3f7d1e916d flake.nix: pin flutter version 2025-12-19 11:19:12 +09:00
815c2f4d44 Update flutter from 3.27 -> 3.35, update deps 2025-11-13 16:16:15 +09:00
e489a24a96 word_search_result: add search term to appbar 2025-07-30 01:42:21 +02:00
c09b82f90b pubspec.{yaml,lock}: update deps, jadb: don't transliterate onyomi 2025-07-30 01:38:07 +02:00
b5ec27a90b screens/word_search: provide preceding chars to kanji drawing model 2025-07-30 01:31:25 +02:00
9278a74219 screens/word_search_result: show search timestamp list on click 2025-07-30 01:30:55 +02:00
37ea8448cb Revert "Add support for predictive back"
This reverts commit e1ed7f8ae7.
2025-07-28 21:50:34 +02:00
4a7b28ad68 screens/history: fix off by one error for divider 2025-07-28 21:47:43 +02:00
8db44d98b5 settings: enable autoThemeEnabled by default 2025-07-28 21:38:43 +02:00
70 changed files with 2450 additions and 1502 deletions

3
.gitignore vendored
View File

@@ -14,6 +14,8 @@
/android/app/profile
/android/app/release
/android/build/reports
# -----------------------------
# Nix build results
@@ -22,3 +24,4 @@ result-*
# Database files
*.sqlite
assets/kanjivg

View File

@@ -11,12 +11,12 @@ android {
ndkVersion = flutter.ndkVersion
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
jvmTarget = JavaVersion.VERSION_17
}
defaultConfig {

View File

@@ -1,7 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="@string/app_name"
android:enableOnBackInvokedCallback="true"
/>
<!-- The INTERNET permission is required for development. Specifically,

View File

@@ -2,8 +2,7 @@
<application
android:label="@string/app_name"
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon"
android:enableOnBackInvokedCallback="true">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
@@ -12,7 +11,6 @@
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:enableOnBackInvokedCallback="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

View File

@@ -18,8 +18,8 @@ pluginManagement {
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "8.3.0" apply false
id "org.jetbrains.kotlin.android" version "1.9.20" apply false
id "com.android.application" version "8.13.2" apply false
id "org.jetbrains.kotlin.android" version "2.3.0" apply false
}
include ":app"

Binary file not shown.

View File

@@ -1,4 +1,17 @@
{
"droid-fonts": "assets/licenses/droid-fonts.txt",
"noto-fonts": "assets/licenses/noto-fonts.txt"
}
"JMDICT": "assets/licenses/edrdg.txt",
"KANJIDIC2": "assets/licenses/edrdg.txt",
"RADKFILE/KRADFILE": "assets/licenses/edrdg.txt",
"droid-sans-japanese": "assets/licenses/apache-2.0.txt",
"hina-mincho": "assets/licenses/ofl-1.1.txt",
"ibm-plex-sans-japanese": "assets/licenses/ofl-1.1.txt",
"jonathan-waller-jlpt": "assets/licenses/cc-by-4.0.txt",
"kanjivg": "assets/licenses/cc-by-sa-3.0.txt",
"klee-one": "assets/licenses/ofl-1.1.txt",
"kosugi": "assets/licenses/apache-2.0.txt",
"m-plus-2": "assets/licenses/ofl-1.1.txt",
"m-plus-rounded-1c": "assets/licenses/ofl-1.1.txt",
"noto-sans-japanese": "assets/licenses/ofl-1.1.txt",
"noto-serif-japanese": "assets/licenses/ofl-1.1.txt",
"zen-kurenaido": "assets/licenses/ofl-1.1.txt"
}

View File

@@ -0,0 +1,395 @@
Attribution 4.0 International
=======================================================================
Creative Commons Corporation ("Creative Commons") is not a law firm and
does not provide legal services or legal advice. Distribution of
Creative Commons public licenses does not create a lawyer-client or
other relationship. Creative Commons makes its licenses and related
information available on an "as-is" basis. Creative Commons gives no
warranties regarding its licenses, any material licensed under their
terms and conditions, or any related information. Creative Commons
disclaims all liability for damages resulting from their use to the
fullest extent possible.
Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and
conditions that creators and other rights holders may use to share
original works of authorship and other material subject to copyright
and certain other rights specified in the public license below. The
following considerations are for informational purposes only, are not
exhaustive, and do not form part of our licenses.
Considerations for licensors: Our public licenses are
intended for use by those authorized to give the public
permission to use material in ways otherwise restricted by
copyright and certain other rights. Our licenses are
irrevocable. Licensors should read and understand the terms
and conditions of the license they choose before applying it.
Licensors should also secure all rights necessary before
applying our licenses so that the public can reuse the
material as expected. Licensors should clearly mark any
material not subject to the license. This includes other CC-
licensed material, or material used under an exception or
limitation to copyright. More considerations for licensors:
wiki.creativecommons.org/Considerations_for_licensors
Considerations for the public: By using one of our public
licenses, a licensor grants the public permission to use the
licensed material under specified terms and conditions. If
the licensor's permission is not necessary for any reason--for
example, because of any applicable exception or limitation to
copyright--then that use is not regulated by the license. Our
licenses grant only permissions under copyright and certain
other rights that a licensor has authority to grant. Use of
the licensed material may still be restricted for other
reasons, including because others have copyright or other
rights in the material. A licensor may make special requests,
such as asking that all changes be marked or described.
Although not required by our licenses, you are encouraged to
respect those requests where reasonable. More considerations
for the public:
wiki.creativecommons.org/Considerations_for_licensees
=======================================================================
Creative Commons Attribution 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree
to be bound by the terms and conditions of this Creative Commons
Attribution 4.0 International Public License ("Public License"). To the
extent this Public License may be interpreted as a contract, You are
granted the Licensed Rights in consideration of Your acceptance of
these terms and conditions, and the Licensor grants You such rights in
consideration of benefits the Licensor receives from making the
Licensed Material available under these terms and conditions.
Section 1 -- Definitions.
a. Adapted Material means material subject to Copyright and Similar
Rights that is derived from or based upon the Licensed Material
and in which the Licensed Material is translated, altered,
arranged, transformed, or otherwise modified in a manner requiring
permission under the Copyright and Similar Rights held by the
Licensor. For purposes of this Public License, where the Licensed
Material is a musical work, performance, or sound recording,
Adapted Material is always produced where the Licensed Material is
synched in timed relation with a moving image.
b. Adapter's License means the license You apply to Your Copyright
and Similar Rights in Your contributions to Adapted Material in
accordance with the terms and conditions of this Public License.
c. Copyright and Similar Rights means copyright and/or similar rights
closely related to copyright including, without limitation,
performance, broadcast, sound recording, and Sui Generis Database
Rights, without regard to how the rights are labeled or
categorized. For purposes of this Public License, the rights
specified in Section 2(b)(1)-(2) are not Copyright and Similar
Rights.
d. Effective Technological Measures means those measures that, in the
absence of proper authority, may not be circumvented under laws
fulfilling obligations under Article 11 of the WIPO Copyright
Treaty adopted on December 20, 1996, and/or similar international
agreements.
e. Exceptions and Limitations means fair use, fair dealing, and/or
any other exception or limitation to Copyright and Similar Rights
that applies to Your use of the Licensed Material.
f. Licensed Material means the artistic or literary work, database,
or other material to which the Licensor applied this Public
License.
g. Licensed Rights means the rights granted to You subject to the
terms and conditions of this Public License, which are limited to
all Copyright and Similar Rights that apply to Your use of the
Licensed Material and that the Licensor has authority to license.
h. Licensor means the individual(s) or entity(ies) granting rights
under this Public License.
i. Share means to provide material to the public by any means or
process that requires permission under the Licensed Rights, such
as reproduction, public display, public performance, distribution,
dissemination, communication, or importation, and to make material
available to the public including in ways that members of the
public may access the material from a place and at a time
individually chosen by them.
j. Sui Generis Database Rights means rights other than copyright
resulting from Directive 96/9/EC of the European Parliament and of
the Council of 11 March 1996 on the legal protection of databases,
as amended and/or succeeded, as well as other essentially
equivalent rights anywhere in the world.
k. You means the individual or entity exercising the Licensed Rights
under this Public License. Your has a corresponding meaning.
Section 2 -- Scope.
a. License grant.
1. Subject to the terms and conditions of this Public License,
the Licensor hereby grants You a worldwide, royalty-free,
non-sublicensable, non-exclusive, irrevocable license to
exercise the Licensed Rights in the Licensed Material to:
a. reproduce and Share the Licensed Material, in whole or
in part; and
b. produce, reproduce, and Share Adapted Material.
2. Exceptions and Limitations. For the avoidance of doubt, where
Exceptions and Limitations apply to Your use, this Public
License does not apply, and You do not need to comply with
its terms and conditions.
3. Term. The term of this Public License is specified in Section
6(a).
4. Media and formats; technical modifications allowed. The
Licensor authorizes You to exercise the Licensed Rights in
all media and formats whether now known or hereafter created,
and to make technical modifications necessary to do so. The
Licensor waives and/or agrees not to assert any right or
authority to forbid You from making technical modifications
necessary to exercise the Licensed Rights, including
technical modifications necessary to circumvent Effective
Technological Measures. For purposes of this Public License,
simply making modifications authorized by this Section 2(a)
(4) never produces Adapted Material.
5. Downstream recipients.
a. Offer from the Licensor -- Licensed Material. Every
recipient of the Licensed Material automatically
receives an offer from the Licensor to exercise the
Licensed Rights under the terms and conditions of this
Public License.
b. No downstream restrictions. You may not offer or impose
any additional or different terms or conditions on, or
apply any Effective Technological Measures to, the
Licensed Material if doing so restricts exercise of the
Licensed Rights by any recipient of the Licensed
Material.
6. No endorsement. Nothing in this Public License constitutes or
may be construed as permission to assert or imply that You
are, or that Your use of the Licensed Material is, connected
with, or sponsored, endorsed, or granted official status by,
the Licensor or others designated to receive attribution as
provided in Section 3(a)(1)(A)(i).
b. Other rights.
1. Moral rights, such as the right of integrity, are not
licensed under this Public License, nor are publicity,
privacy, and/or other similar personality rights; however, to
the extent possible, the Licensor waives and/or agrees not to
assert any such rights held by the Licensor to the limited
extent necessary to allow You to exercise the Licensed
Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this
Public License.
3. To the extent possible, the Licensor waives any right to
collect royalties from You for the exercise of the Licensed
Rights, whether directly or through a collecting society
under any voluntary or waivable statutory or compulsory
licensing scheme. In all other cases the Licensor expressly
reserves any right to collect such royalties.
Section 3 -- License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the
following conditions.
a. Attribution.
1. If You Share the Licensed Material (including in modified
form), You must:
a. retain the following if it is supplied by the Licensor
with the Licensed Material:
i. identification of the creator(s) of the Licensed
Material and any others designated to receive
attribution, in any reasonable manner requested by
the Licensor (including by pseudonym if
designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of
warranties;
v. a URI or hyperlink to the Licensed Material to the
extent reasonably practicable;
b. indicate if You modified the Licensed Material and
retain an indication of any previous modifications; and
c. indicate the Licensed Material is licensed under this
Public License, and include the text of, or the URI or
hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any
reasonable manner based on the medium, means, and context in
which You Share the Licensed Material. For example, it may be
reasonable to satisfy the conditions by providing a URI or
hyperlink to a resource that includes the required
information.
3. If requested by the Licensor, You must remove any of the
information required by Section 3(a)(1)(A) to the extent
reasonably practicable.
4. If You Share Adapted Material You produce, the Adapter's
License You apply must not prevent recipients of the Adapted
Material from complying with this Public License.
Section 4 -- Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that
apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right
to extract, reuse, reproduce, and Share all or a substantial
portion of the contents of the database;
b. if You include all or a substantial portion of the database
contents in a database in which You have Sui Generis Database
Rights, then the database in which You have Sui Generis Database
Rights (but not its individual contents) is Adapted Material; and
c. You must comply with the conditions in Section 3(a) if You Share
all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not
replace Your obligations under this Public License where the Licensed
Rights include other Copyright and Similar Rights.
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR, TO THE
EXTENT POSSIBLE, THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS
AND AS-AVAILABLE, AND MAKES NO REPRESENTATIONS OR WARRANTIES OF
ANY KIND CONCERNING THE LICENSED MATERIAL, WHETHER EXPRESS,
IMPLIED, STATUTORY, OR OTHER. THIS INCLUDES, WITHOUT LIMITATION,
WARRANTIES OF TITLE, MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE, NON-INFRINGEMENT, ABSENCE OF LATENT OR OTHER DEFECTS,
ACCURACY, OR THE PRESENCE OR ABSENCE OF ERRORS, WHETHER OR NOT
KNOWN OR DISCOVERABLE. WHERE DISCLAIMERS OF WARRANTIES ARE NOT
ALLOWED IN FULL OR IN PART, THIS DISCLAIMER MAY NOT APPLY TO YOU.
b. TO THE EXTENT POSSIBLE, IN NO EVENT WILL THE LICENSOR BE LIABLE
TO YOU ON ANY LEGAL THEORY (INCLUDING, WITHOUT LIMITATION,
NEGLIGENCE) OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT,
INCIDENTAL, CONSEQUENTIAL, PUNITIVE, EXEMPLARY, OR OTHER LOSSES,
COSTS, EXPENSES, OR DAMAGES ARISING OUT OF THIS PUBLIC LICENSE OR
USE OF THE LICENSED MATERIAL, EVEN IF THE LICENSOR HAS BEEN
ADVISED OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR
DAMAGES. WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR
IN PART, THIS LIMITATION MAY NOT APPLY TO YOU.
c. The disclaimer of warranties and limitation of liability provided
above shall be interpreted in a manner that, to the extent
possible, most closely approximates an absolute disclaimer and
waiver of all liability.
Section 6 -- Term and Termination.
a. This Public License applies for the term of the Copyright and
Similar Rights licensed here. However, if You fail to comply with
this Public License, then Your rights under this Public License
terminate automatically.
b. Where Your right to use the Licensed Material has terminated under
Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided
it is cured within 30 days of Your discovery of the
violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any
right the Licensor may have to seek remedies for Your violations
of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the
Licensed Material under separate terms or conditions or stop
distributing the Licensed Material at any time; however, doing so
will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public
License.
Section 7 -- Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different
terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the
Licensed Material not stated herein are separate from and
independent of the terms and conditions of this Public License.
Section 8 -- Interpretation.
a. For the avoidance of doubt, this Public License does not, and
shall not be interpreted to, reduce, limit, restrict, or impose
conditions on any use of the Licensed Material that could lawfully
be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is
deemed unenforceable, it shall be automatically reformed to the
minimum extent necessary to make it enforceable. If the provision
cannot be reformed, it shall be severed from this Public License
without affecting the enforceability of the remaining terms and
conditions.
c. No term or condition of this Public License will be waived and no
failure to comply consented to unless expressly agreed to by the
Licensor.
d. Nothing in this Public License constitutes or may be interpreted
as a limitation upon, or waiver of, any privileges and immunities
that apply to the Licensor or You, including from the legal
processes of any jurisdiction or authority.
=======================================================================
Creative Commons is not a party to its public licenses.
Notwithstanding, Creative Commons may elect to apply one of its public
licenses to material it publishes and in those instances will be
considered the “Licensor.” The text of the Creative Commons public
licenses is dedicated to the public domain under the CC0 Public Domain
Dedication. Except for the limited purpose of indicating that material
is shared under a Creative Commons public license or as otherwise
permitted by the Creative Commons policies published at
creativecommons.org/policies, Creative Commons does not authorize the
use of the trademark "Creative Commons" or any other trademark or logo
of Creative Commons without its prior written consent including,
without limitation, in connection with any unauthorized modifications
to any of its public licenses or any other arrangements,
understandings, or agreements concerning use of licensed material. For
the avoidance of doubt, this paragraph does not form part of the public
licenses.
Creative Commons may be contacted at creativecommons.org.

View File

@@ -0,0 +1,66 @@
License
THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS PROHIBITED.
BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
1. Definitions
"Adaptation" means a work based upon the Work, or upon the Work and other pre-existing works, such as a translation, adaptation, derivative work, arrangement of music or other alterations of a literary or artistic work, or phonogram or performance and includes cinematographic adaptations or any other form in which the Work may be recast, transformed, or adapted including in any form recognizably derived from the original, except that a work that constitutes a Collection will not be considered an Adaptation for the purpose of this License. For the avoidance of doubt, where the Work is a musical work, performance or phonogram, the synchronization of the Work in timed-relation with a moving image ("synching") will be considered an Adaptation for the purpose of this License.
"Collection" means a collection of literary or artistic works, such as encyclopedias and anthologies, or performances, phonograms or broadcasts, or other works or subject matter other than works listed in Section 1(f) below, which, by reason of the selection and arrangement of their contents, constitute intellectual creations, in which the Work is included in its entirety in unmodified form along with one or more other contributions, each constituting separate and independent works in themselves, which together are assembled into a collective whole. A work that constitutes a Collection will not be considered an Adaptation (as defined below) for the purposes of this License.
"Creative Commons Compatible License" means a license that is listed at http://creativecommons.org/compatiblelicenses that has been approved by Creative Commons as being essentially equivalent to this License, including, at a minimum, because that license: (i) contains terms that have the same purpose, meaning and effect as the License Elements of this License; and, (ii) explicitly permits the relicensing of adaptations of works made available under that license under this License or a Creative Commons jurisdiction license with the same License Elements as this License.
"Distribute" means to make available to the public the original and copies of the Work or Adaptation, as appropriate, through sale or other transfer of ownership.
"License Elements" means the following high-level license attributes as selected by Licensor and indicated in the title of this License: Attribution, ShareAlike.
"Licensor" means the individual, individuals, entity or entities that offer(s) the Work under the terms of this License.
"Original Author" means, in the case of a literary or artistic work, the individual, individuals, entity or entities who created the Work or if no individual or entity can be identified, the publisher; and in addition (i) in the case of a performance the actors, singers, musicians, dancers, and other persons who act, sing, deliver, declaim, play in, interpret or otherwise perform literary or artistic works or expressions of folklore; (ii) in the case of a phonogram the producer being the person or legal entity who first fixes the sounds of a performance or other sounds; and, (iii) in the case of broadcasts, the organization that transmits the broadcast.
"Work" means the literary and/or artistic work offered under the terms of this License including without limitation any production in the literary, scientific and artistic domain, whatever may be the mode or form of its expression including digital form, such as a book, pamphlet and other writing; a lecture, address, sermon or other work of the same nature; a dramatic or dramatico-musical work; a choreographic work or entertainment in dumb show; a musical composition with or without words; a cinematographic work to which are assimilated works expressed by a process analogous to cinematography; a work of drawing, painting, architecture, sculpture, engraving or lithography; a photographic work to which are assimilated works expressed by a process analogous to photography; a work of applied art; an illustration, map, plan, sketch or three-dimensional work relative to geography, topography, architecture or science; a performance; a broadcast; a phonogram; a compilation of data to the extent it is protected as a copyrightable work; or a work performed by a variety or circus performer to the extent it is not otherwise considered a literary or artistic work.
"You" means an individual or entity exercising rights under this License who has not previously violated the terms of this License with respect to the Work, or who has received express permission from the Licensor to exercise rights under this License despite a previous violation.
"Publicly Perform" means to perform public recitations of the Work and to communicate to the public those public recitations, by any means or process, including by wire or wireless means or public digital performances; to make available to the public Works in such a way that members of the public may access these Works from a place and at a place individually chosen by them; to perform the Work to the public by any means or process and the communication to the public of the performances of the Work, including by public digital performance; to broadcast and rebroadcast the Work by any means including signs, sounds or images.
"Reproduce" means to make copies of the Work by any means including without limitation by sound or visual recordings and the right of fixation and reproducing fixations of the Work, including storage of a protected performance or phonogram in digital form or other electronic medium.
2. Fair Dealing Rights. Nothing in this License is intended to reduce, limit, or restrict any uses free from copyright or rights arising from limitations or exceptions that are provided for in connection with the copyright protection under copyright law or other applicable laws.
3. License Grant. Subject to the terms and conditions of this License, Licensor hereby grants You a worldwide, royalty-free, non-exclusive, perpetual (for the duration of the applicable copyright) license to exercise the rights in the Work as stated below:
to Reproduce the Work, to incorporate the Work into one or more Collections, and to Reproduce the Work as incorporated in the Collections;
to create and Reproduce Adaptations provided that any such Adaptation, including any translation in any medium, takes reasonable steps to clearly label, demarcate or otherwise identify that changes were made to the original Work. For example, a translation could be marked "The original work was translated from English to Spanish," or a modification could indicate "The original work has been modified.";
to Distribute and Publicly Perform the Work including as incorporated in Collections; and,
to Distribute and Publicly Perform Adaptations.
For the avoidance of doubt:
Non-waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme cannot be waived, the Licensor reserves the exclusive right to collect such royalties for any exercise by You of the rights granted under this License;
Waivable Compulsory License Schemes. In those jurisdictions in which the right to collect royalties through any statutory or compulsory licensing scheme can be waived, the Licensor waives the exclusive right to collect such royalties for any exercise by You of the rights granted under this License; and,
Voluntary License Schemes. The Licensor waives the right to collect royalties, whether individually or, in the event that the Licensor is a member of a collecting society that administers voluntary licensing schemes, via that society, from any exercise by You of the rights granted under this License.
The above rights may be exercised in all media and formats whether now known or hereafter devised. The above rights include the right to make such modifications as are technically necessary to exercise the rights in other media and formats. Subject to Section 8(f), all rights not expressly granted by Licensor are hereby reserved.
4. Restrictions. The license granted in Section 3 above is expressly made subject to and limited by the following restrictions:
You may Distribute or Publicly Perform the Work only under the terms of this License. You must include a copy of, or the Uniform Resource Identifier (URI) for, this License with every copy of the Work You Distribute or Publicly Perform. You may not offer or impose any terms on the Work that restrict the terms of this License or the ability of the recipient of the Work to exercise the rights granted to that recipient under the terms of the License. You may not sublicense the Work. You must keep intact all notices that refer to this License and to the disclaimer of warranties with every copy of the Work You Distribute or Publicly Perform. When You Distribute or Publicly Perform the Work, You may not impose any effective technological measures on the Work that restrict the ability of a recipient of the Work from You to exercise the rights granted to that recipient under the terms of the License. This Section 4(a) applies to the Work as incorporated in a Collection, but this does not require the Collection apart from the Work itself to be made subject to the terms of this License. If You create a Collection, upon notice from any Licensor You must, to the extent practicable, remove from the Collection any credit as required by Section 4(c), as requested. If You create an Adaptation, upon notice from any Licensor You must, to the extent practicable, remove from the Adaptation any credit as required by Section 4(c), as requested.
You may Distribute or Publicly Perform an Adaptation only under the terms of: (i) this License; (ii) a later version of this License with the same License Elements as this License; (iii) a Creative Commons jurisdiction license (either this or a later license version) that contains the same License Elements as this License (e.g., Attribution-ShareAlike 3.0 US)); (iv) a Creative Commons Compatible License. If you license the Adaptation under one of the licenses mentioned in (iv), you must comply with the terms of that license. If you license the Adaptation under the terms of any of the licenses mentioned in (i), (ii) or (iii) (the "Applicable License"), you must comply with the terms of the Applicable License generally and the following provisions: (I) You must include a copy of, or the URI for, the Applicable License with every copy of each Adaptation You Distribute or Publicly Perform; (II) You may not offer or impose any terms on the Adaptation that restrict the terms of the Applicable License or the ability of the recipient of the Adaptation to exercise the rights granted to that recipient under the terms of the Applicable License; (III) You must keep intact all notices that refer to the Applicable License and to the disclaimer of warranties with every copy of the Work as included in the Adaptation You Distribute or Publicly Perform; (IV) when You Distribute or Publicly Perform the Adaptation, You may not impose any effective technological measures on the Adaptation that restrict the ability of a recipient of the Adaptation from You to exercise the rights granted to that recipient under the terms of the Applicable License. This Section 4(b) applies to the Adaptation as incorporated in a Collection, but this does not require the Collection apart from the Adaptation itself to be made subject to the terms of the Applicable License.
If You Distribute, or Publicly Perform the Work or any Adaptations or Collections, You must, unless a request has been made pursuant to Section 4(a), keep intact all copyright notices for the Work and provide, reasonable to the medium or means You are utilizing: (i) the name of the Original Author (or pseudonym, if applicable) if supplied, and/or if the Original Author and/or Licensor designate another party or parties (e.g., a sponsor institute, publishing entity, journal) for attribution ("Attribution Parties") in Licensor's copyright notice, terms of service or by other reasonable means, the name of such party or parties; (ii) the title of the Work if supplied; (iii) to the extent reasonably practicable, the URI, if any, that Licensor specifies to be associated with the Work, unless such URI does not refer to the copyright notice or licensing information for the Work; and (iv) , consistent with Ssection 3(b), in the case of an Adaptation, a credit identifying the use of the Work in the Adaptation (e.g., "French translation of the Work by Original Author," or "Screenplay based on original Work by Original Author"). The credit required by this Section 4(c) may be implemented in any reasonable manner; provided, however, that in the case of a Adaptation or Collection, at a minimum such credit will appear, if a credit for all contributing authors of the Adaptation or Collection appears, then as part of these credits and in a manner at least as prominent as the credits for the other contributing authors. For the avoidance of doubt, You may only use the credit required by this Section for the purpose of attribution in the manner set out above and, by exercising Your rights under this License, You may not implicitly or explicitly assert or imply any connection with, sponsorship or endorsement by the Original Author, Licensor and/or Attribution Parties, as appropriate, of You or Your use of the Work, without the separate, express prior written permission of the Original Author, Licensor and/or Attribution Parties.
Except as otherwise agreed in writing by the Licensor or as may be otherwise permitted by applicable law, if You Reproduce, Distribute or Publicly Perform the Work either by itself or as part of any Adaptations or Collections, You must not distort, mutilate, modify or take other derogatory action in relation to the Work which would be prejudicial to the Original Author's honor or reputation. Licensor agrees that in those jurisdictions (e.g. Japan), in which any exercise of the right granted in Section 3(b) of this License (the right to make Adaptations) would be deemed to be a distortion, mutilation, modification or other derogatory action prejudicial to the Original Author's honor and reputation, the Licensor will waive or not assert, as appropriate, this Section, to the fullest extent permitted by the applicable national law, to enable You to reasonably exercise Your right under Section 3(b) of this License (right to make Adaptations) but not otherwise.
5. Representations, Warranties and Disclaimer
UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, SO SUCH EXCLUSION MAY NOT APPLY TO YOU.
6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
7. Termination
This License and the rights granted hereunder will terminate automatically upon any breach by You of the terms of this License. Individuals or entities who have received Adaptations or Collections from You under this License, however, will not have their licenses terminated provided such individuals or entities remain in full compliance with those licenses. Sections 1, 2, 5, 6, 7, and 8 will survive any termination of this License.
Subject to the above terms and conditions, the license granted here is perpetual (for the duration of the applicable copyright in the Work). Notwithstanding the above, Licensor reserves the right to release the Work under different license terms or to stop distributing the Work at any time; provided, however that any such election will not serve to withdraw this License (or any other license that has been, or is required to be, granted under the terms of this License), and this License will continue in full force and effect unless terminated as stated above.
8. Miscellaneous
Each time You Distribute or Publicly Perform the Work or a Collection, the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
Each time You Distribute or Publicly Perform an Adaptation, Licensor offers to the recipient a license to the original Work on the same terms and conditions as the license granted to You under this License.
If any provision of this License is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this License, and without further action by the parties to this agreement, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable.
No term or provision of this License shall be deemed waived and no breach consented to unless such waiver or consent shall be in writing and signed by the party to be charged with such waiver or consent.
This License constitutes the entire agreement between the parties with respect to the Work licensed here. There are no understandings, agreements or representations with respect to the Work not specified here. Licensor shall not be bound by any additional provisions that may appear in any communication from You. This License may not be modified without the mutual written agreement of the Licensor and You.
The rights granted under, and the subject matter referenced, in this License were drafted utilizing the terminology of the Berne Convention for the Protection of Literary and Artistic Works (as amended on September 28, 1979), the Rome Convention of 1961, the WIPO Copyright Treaty of 1996, the WIPO Performances and Phonograms Treaty of 1996 and the Universal Copyright Convention (as revised on July 24, 1971). These rights and subject matter take effect in the relevant jurisdiction in which the License terms are sought to be enforced according to the corresponding provisions of the implementation of those treaty provisions in the applicable national law. If the standard suite of rights granted under applicable copyright law includes additional rights not granted under this License, such additional rights are deemed to be included in the License; this License is not intended to restrict the license of any rights under applicable law.
Creative Commons Notice
Creative Commons is not a party to this License, and makes no warranty whatsoever in connection with the Work. Creative Commons will not be liable to You or any party on any legal theory for any damages whatsoever, including without limitation any general, special, incidental or consequential damages arising in connection to this license. Notwithstanding the foregoing two (2) sentences, if Creative Commons has expressly identified itself as the Licensor hereunder, it shall have all rights and obligations of Licensor.
Except for the limited purpose of indicating to the public that the Work is licensed under the CCPL, Creative Commons does not authorize the use by either party of the trademark "Creative Commons" or any related trademark or logo of Creative Commons without the prior written consent of Creative Commons. Any permitted use will be in compliance with Creative Commons' then-current trademark usage guidelines, as may be published on its website or otherwise made available upon request from time to time. For the avoidance of doubt, this trademark restriction does not form part of the License.
Creative Commons may be contacted at http://creativecommons.org/.

137
assets/licenses/edrdg.txt Normal file
View File

@@ -0,0 +1,137 @@
EDRDG
ELECTRONIC DICTIONARY RESEARCH AND DEVELOPMENT GROUP
GENERAL DICTIONARY LICENCE STATEMENT
EDRDG Home Page
1. Introduction
In March 2000, James William Breen assigned ownership of the copyright of the dictionary files assembled, coordinated and edited by him to the The Electronic Dictionary Research and Development Group, then at Monash University (hereafter "the Group"), on the understanding that the Group will foster the development of the dictionary files, and will utilize all monies received for use of the files for the further development of the files, and for research into computer lexicography and electronic dictionaries.
This document outlines the licence arrangement put in place by The Group for usage of the files. It replaces all previous copyright and licence statements applying to the files.
2. Application
This licence statement and copyright notice applies to the following dictionary files, the associated documentation files, and any data files which are derived from them.
JMDICT - Japanese-Multilingual Dictionary File - the Japanese and English components (the translational equivalents in other languages, e.g. German, French, Dutch, etc. are covered by separate copyright held by the compilers of that material.)
EDICT - Japanese-English Electronic DICTionary File
ENAMDICT - Japanese Names File
COMPDIC - Japanese-English Computing and Telecommunications Terminology File
KANJIDIC2 - File of Information about the Kanji in JIS X 0208, JIS X 0212 and JIS X 0213 in XML format.
KANJIDIC - File of Information about the 6,355 Kanji in the JIS X 0208 Standard (special conditions apply)
KANJD212 - File of Information about the 5,801 Supplementary Kanji in the JIS X 0212 Standard
EDICT-R - romanized version of the EDICT file. (NB: this file has been withdrawn from circulation, and all sites carrying it are requested to remove their copies.)
RADKFILE/KRADFILE - files relating to the decomposition of the 6,355 kanji in JIS X 0208 into their visible components.
Copyright over the documents covered by this statement is held by James William BREEN and The Electronic Dictionary Research and Development Group.
3. Licence Conditions
The dictionary files are made available under a Creative Commons Attribution-ShareAlike Licence (V4.0). The Licence Deed can be viewed here (https://creativecommons.org/licenses/by-sa/4.0/), and the full Licence Code is here (https://creativecommons.org/licenses/by-sa/4.0/legalcode).
In summary (extract from the Licence Deed):
You are free:
- to Share - to copy, distribute and transmit the work
- to Remix - to adapt the work
Under the following conditions:
- Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work).
- Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible licence.
For attribution of these files, you must:
a. in the case of publishing significant extracts of the files, or material based on significant extracts of the files, e.g. in a published dictionary or in vocabulary lists, clearly acknowledge that you used the files for this purpose;
b. in the case of a software package, WWW server, smartphone app, etc. which uses the files or incorporates data from the files, you must:
i. acknowledge the usage and source of the files in the documentation, publicity material, WWW site of the package/server, etc.;
ii. provide copies of the documentation and licence files (in the case of software packages). Where the application packaging does not provide for the inclusion of such files (e.g. with iPhone applications), it is sufficient to provide links, as per the next point;
iii. provide links to either local copies of the documentation and licence files or to the locations of the files at Monash University or at the EDRDG site.
If a WWW server is providing a dictionary function or an on-screen display of words from the files, the acknowledgement must be made on each screen display, e.g. in the form of a message at the foot of the screen or page. If, however, material from the files is mixed with information from other sources, it is sufficient to provide a general acknowledgement of the sources as described above.
For smartphone and tablet apps, acknowledgement must be made, e.g. on a separate screen accessed from a menu, such as one labelled "About", "Sources", etc. It is not sufficient just to mention it on a start-up/launch page of the app.
For the EDICT, JMdict and KANJIDIC files, the following URLs may be used or quoted:
- https://www.edrdg.org/wiki/index.php/JMdict-EDICT_Dictionary_Project
- https://www.edrdg.org/wiki/index.php/KANJIDIC_Project
See this page (https://www.edrdg.org/edrdg/sample.html) for samples of possible acknowledgement text.
Note that in all cases, the addition of material to the files or to extracts from the files does not remove or in any way diminish the Group's copyright over the files. Users of material from the files must *NOT* claim copyright over that material.
Note also that provided the conditions above are met, there is NO restriction placed on commercial use of the files. The files can be bundled with software and sold for whatever the developer wants to charge. Software using these files does not have to be under any form of open-source licence.
Where use of the files results in a financial return to the user, it is suggested that the user make a donation to the Group to assist with the continued development of the files. The only method currently available is to make a donation via PayPal using a credit or debit card. Simply click on the following button and follow the instructions.
(See the "Donate" button here: https://www.edrdg.org/edrdg/licence.html)
NB: No contract or agreement needs to be signed in order to use the files. By using the files, the user implicitly undertakes to abide by the conditions of this licence.
4. Updating Dictionary Versions
If a software package, WWW server, smartphone app, etc. uses the files or incorporates data from the files, there must be a procedure for regular updating of the data from the most recent versions available. For example, WWW-based dictionary servers should update their dictionary versions at least once a month. Failure to keep the versions up-to-date is a violation of the licence to use the data.
5. Warranty and Liability
While every effort has been made to ensure the accuracy of the information in the files, it is possible that errors may still be included. The files are made available without any warranty whatsoever as to their accuracy or suitability for a particular application.
Any individual or organization making use of the files must agree:
to assume all liability for the use or misuse of the files, and must agree not to hold the Group liable for any actions or events resulting from use of the files.
to refrain from bringing action or suit or claim against the Group or any of the Group's members on the basis of the use of the files, or any information included in the files.
to indemnify the Group or its members in the case of action by a third party on the basis of the use of the files, or any information included in the files.
6. Copyright
Every effort has been made in the compilation of these files to ensure that the copyright of other compilers of dictionaries and lexicographic material has not been infringed. The Group asserts its intention to rectify immediately any breach of copyright brought to its attention.
Any individual or organization in possession of copies of the files, upon becoming aware that a possible copyright infringement may be present in the files, must undertake to contact the Group immediately with details of the possible infringement.
7. Prior Permission
All permissions for use of the files granted by James William Breen prior to March 2000 will be honoured and maintained, however the placing of the KANJD212 and EDICTH files under the GNU GPL has been withdrawn as of 25 March 2000.
8. Special Conditions for the KANJIDIC, KANJD212 and KANJIDIC2 Files
In addition to licensing arrangements described above, the following additional conditions apply to the KANJIDIC, KANJD212 and KANJIDIC2 files.
The following people have granted permission for material for which they hold copyright to be included in the files, and distributed under the above conditions, while retaining their copyright over that material:
Jack HALPERN: The SKIP codes.
Note that the SKIP codes are under their own similar Creative Common licence. See Jack Halpern's conditions of use page (http://www.kanji.org/kanji/dictionaries/skip_permission.htm).
Christian WITTERN and Koichi YASUOKA: The Pinyin information.
Urs APP: the Four Corner codes and the Morohashi information.
Mark SPAHN and Wolfgang HADAMITZKY: the kanji descriptors from their dictionary.
Charles MULLER: the Korean readings.
Joseph DE ROO: the De Roo codes.
9. Enquiries
All enquiries to:
The Electronic Dictionary Research and Development Group
Attn: Dr Jim Breen
(jimbreen@gmail.com)

View File

@@ -1,8 +1,6 @@
Copyright 2018 The Noto Project Authors (github.com/googlei18n/noto-fonts)
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
Copyright (c) [year] [fullname] ([email])
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
@@ -12,10 +10,10 @@ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
@@ -23,8 +21,8 @@ fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
@@ -34,25 +32,25 @@ include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
PERMISSION AND CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
@@ -62,9 +60,9 @@ in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
@@ -75,8 +73,8 @@ permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
@@ -91,4 +89,4 @@ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@@ -0,0 +1,20 @@
# v0.5.0 - 2025-12-19
A relatively small update, pushing out some features that have been laying ready on the main branch for a while.
## New features ✨
- Added search count bubbles to the history entries.
- Added the search term to the appbar when viewing search results.
## Changes 🔧
- Enable automatic theme by default, following system settings.
- Use hiragana for both kunyomi and onyomi in kanji search results.
- Provide the existing content from the searchbar as context to the kanji drawing recognition model, likely improving suggestions.
- Removed [Predictive Back](https://developer.android.com/design/ui/mobile/guides/patterns/predictive-back) support, due to weird "go to the previous page" behaviour on some devices.
## Other 📝
- Updated flutter: `3.32` -> `3.35`
- Updated dictionary data

6
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1752480373,
"narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=",
"lastModified": 1771369470,
"narHash": "sha256-0NBlEBKkN3lufyvFegY4TYv5mCNHbi5OmBDrzihbBMQ=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08",
"rev": "0182a361324364ae3f436a63005877674cf45efb",
"type": "github"
},
"original": {

View File

@@ -16,40 +16,36 @@
android_sdk.accept_license = true;
allowUnfree = true;
};
overlays = [
# https://github.com/NixOS/nixpkgs/issues/425323
(final: prev: {
jdk8 = prev.jdk8.overrideAttrs {
separateDebugInfo = false;
__structuredAttrs = false;
};
})
];
};
androidSdk = (pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [ "33.0.1" "34.0.0" ];
platformVersions = [ "35" "34" ];
androidPkgs = (pkgs.androidenv.composeAndroidPackages {
buildToolsVersions = [ "35.0.0" "36.1.0" ];
platformVersions = [ "35" "36" ];
abiVersions = [ "armeabi-v7a" "arm64-v8a" ];
cmakeVersions = [ "3.22.1" ];
includeNDK = true;
ndkVersions = [ "26.3.11579264" ];
}).androidsdk;
in f system pkgs androidSdk);
ndkVersions = [ "28.2.13676358" ];
});
in f system pkgs androidPkgs);
in {
devShells = forAllSystems (_: pkgs: androidSdk: {
devShells = forAllSystems (_: pkgs: androidPkgs: {
default = let
flutter' = pkgs.flutter;
jdk' = pkgs.jdk17;
flutter' = pkgs.flutter341;
jdk' = pkgs.jdk21;
in pkgs.mkShell {
packages = [
flutter'
pkgs.sqlite-interactive
androidSdk
androidPkgs.androidsdk
jdk'
];
env = {
ANDROID_SDK_ROOT = "${androidSdk}/libexec/android-sdk";
GRADLE_OPTS = "-Dorg.gradle.project.android.aapt2FromMavenOverride=${androidSdk}/libexec/android-sdk/build-tools/34.0.0/aapt2";
ANDROID_SDK_ROOT = "${androidPkgs.androidsdk}/libexec/android-sdk";
GRADLE_OPTS = let
buildToolsVersion = (lib.head androidPkgs.build-tools).version;
buildToolsDir = "${androidPkgs.androidsdk}/libexec/android-sdk/build-tools/${buildToolsVersion}";
in lib.concatStringsSep " " [
"-Dorg.gradle.project.android.aapt2FromMavenOverride=${buildToolsDir}/aapt2"
];
FLUTTER_SDK = "${flutter'}";
JAVA_HOME = "${jdk'}/lib/openjdk";
LIBSQLITE_PATH = "${pkgs.sqlite.out}/lib/libsqlite3.so";

View File

@@ -1,28 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../models/themes/theme.dart';
import '../../settings.dart';
part 'theme_event.dart';
part 'theme_state.dart';
class ThemeBloc extends Bloc<ThemeEvent, ThemeState> {
ThemeBloc() : super(const LightThemeState()) {
on<SetTheme>(
(event, emit) => emit(
event.themeIsDark ? const DarkThemeState() : const LightThemeState(),
),
);
final bool autoThemeIsDark =
SchedulerBinding.instance.window.platformBrightness == Brightness.dark;
add(
SetTheme(
themeIsDark: autoThemeEnabled ? autoThemeIsDark : darkThemeEnabled,
),
);
}
}

View File

@@ -1,12 +0,0 @@
part of 'theme_bloc.dart';
@immutable
abstract class ThemeEvent {
const ThemeEvent();
}
class SetTheme extends ThemeEvent {
final bool themeIsDark;
const SetTheme({required this.themeIsDark});
}

View File

@@ -1,22 +0,0 @@
part of 'theme_bloc.dart';
@immutable
abstract class ThemeState {
const ThemeState();
AppTheme get theme;
}
class LightThemeState extends ThemeState {
const LightThemeState();
@override
AppTheme get theme => const LightTheme();
}
class DarkThemeState extends ThemeState {
const DarkThemeState();
@override
AppTheme get theme => const DarkTheme();
}

View File

@@ -0,0 +1,64 @@
import 'package:async/async.dart';
import 'package:flutter/material.dart';
class AsyncTextFormField extends StatefulWidget {
final Future<String?> Function(String?) asyncValidator;
final TextEditingController controller;
final String? labelText;
final String? hintText;
const AsyncTextFormField({
super.key,
required this.asyncValidator,
required this.controller,
this.labelText,
this.hintText,
});
@override
AsyncTextFormFieldState createState() => AsyncTextFormFieldState();
}
class AsyncTextFormFieldState extends State<AsyncTextFormField> {
String? errorText;
CancelableOperation? currentValidation;
Future<void> validate(String text) async {
currentValidation?.cancel();
setState(() {
errorText = null;
currentValidation = CancelableOperation.fromFuture(
widget.asyncValidator(text).then((newErrorText) {
if (!mounted) return;
setState(() {
errorText = newErrorText;
currentValidation = null;
});
}),
);
});
}
@override
Widget build(BuildContext context) {
print('Building AsyncTextFormField with errorText: $errorText and currentValidation: $currentValidation');
return TextFormField(
key: widget.key,
controller: widget.controller,
autovalidateMode: AutovalidateMode.onUserInteraction,
decoration: InputDecoration(
labelText: widget.labelText,
hintText: widget.hintText,
errorText: errorText,
// TODO: add a small timer, so that this doesn't flicker if the user is typing quickly and the validation is fast
suffixIcon: currentValidation != null
? CircularProgressIndicator(strokeWidth: 2)
: errorText != null
? const Icon(Icons.error, color: Colors.red)
: const Icon(Icons.check, color: Colors.green),
),
onChanged: validate,
forceErrorText: errorText,
);
}
}

View File

@@ -1,9 +1,8 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../bloc/theme/theme_bloc.dart';
import '../../settings.dart';
/// The ratio is defined as 'the amount of space the text should take'
@@ -134,44 +133,43 @@ class KanjiBox extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final calculatedForeground =
foreground ?? state.theme.menuGreyLight.foreground;
final calculatedBackground =
background ?? state.theme.menuGreyLight.background;
return LayoutBuilder(
builder: (context, constraints) {
final sizeConstraint = min(
constraints.maxHeight,
constraints.maxWidth,
);
final calculatedFontSize =
fontSize ?? sizeConstraint * fontSizeFactor;
final calculatedPadding =
oneSidePadding ?? (sizeConstraint * paddingSizeFactor) / 2;
final calculatedForeground =
foreground ??
Theme.of(
context,
).extension<MenuGreyLightThemeExtension>()!.foregroundColor;
final calculatedBackground =
background ??
Theme.of(
context,
).extension<MenuGreyLightThemeExtension>()!.backgroundColor;
return Container(
padding: EdgeInsets.all(calculatedPadding),
alignment: Alignment.center,
width: size,
height: size,
decoration: BoxDecoration(
color: calculatedBackground,
borderRadius: BorderRadius.circular(borderRadius),
),
child: FittedBox(
child: Text(
kanji,
textScaler: TextScaler.linear(1),
style: TextStyle(
color: calculatedForeground,
fontSize: calculatedFontSize,
).merge(japaneseFont.textStyle),
),
),
);
},
return LayoutBuilder(
builder: (context, constraints) {
final sizeConstraint = min(constraints.maxHeight, constraints.maxWidth);
final calculatedFontSize = fontSize ?? sizeConstraint * fontSizeFactor;
final calculatedPadding =
oneSidePadding ?? (sizeConstraint * paddingSizeFactor) / 2;
return Container(
padding: EdgeInsets.all(calculatedPadding),
alignment: Alignment.center,
width: size,
height: size,
decoration: BoxDecoration(
color: calculatedBackground,
borderRadius: BorderRadius.circular(borderRadius),
),
child: FittedBox(
child: Text(
kanji,
textScaler: TextScaler.linear(1),
style: TextStyle(
color: calculatedForeground,
fontSize: calculatedFontSize,
).merge(japaneseFont.textStyle),
),
),
);
},
);

View File

@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import '../../models/themes/theme.dart';
import 'package:mugiten/theme.dart';
class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});
@@ -8,7 +7,7 @@ class SplashScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
decoration: BoxDecoration(color: AppTheme.mugitenWheat.background),
decoration: BoxDecoration(color: mugitenWheatBackground),
child: const Center(
child: Image(image: AssetImage('assets/images/logo/mugi.png')),
),

View File

@@ -1,17 +1,16 @@
import 'package:flutter/material.dart' hide Ink;
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:google_mlkit_digital_ink_recognition/google_mlkit_digital_ink_recognition.dart';
import 'package:jadb/search.dart';
import 'package:mugiten/models/themes/theme.dart';
import 'package:mugiten/theme.dart';
import 'package:signature/signature.dart';
import 'package:sqflite/sqflite.dart';
import '../../bloc/theme/theme_bloc.dart';
import '../../settings.dart';
class DrawingBoard extends StatefulWidget {
final Function(String)? onSuggestionChosen;
final String? precedingText;
final bool onlyOneCharacterSuggestions;
final bool allowKanji;
final bool allowHiragana;
@@ -20,6 +19,7 @@ class DrawingBoard extends StatefulWidget {
const DrawingBoard({
this.onSuggestionChosen,
this.precedingText,
this.onlyOneCharacterSuggestions = false,
this.allowKanji = true,
this.allowHiragana = false,
@@ -44,15 +44,15 @@ class _DrawingBoardState extends State<DrawingBoard> {
static const double fontSize = 30;
static const double suggestionCirclePadding = 13;
late ColorSet panelColor = BlocProvider.of<ThemeBloc>(
late final panelColor = Theme.of(
context,
).state.theme.menuGreyLight;
late ColorSet barColor = BlocProvider.of<ThemeBloc>(
).extension<MenuGreyLightThemeExtension>()!;
late final barColor = Theme.of(
context,
).state.theme.menuGreyNormal;
).extension<MenuGreyNormalThemeExtension>()!;
late final SignatureController controller = SignatureController(
penColor: panelColor.foreground,
penColor: panelColor.foregroundColor!,
onDrawStart: () {
strokes.add([]);
undoQueue.clear();
@@ -72,6 +72,7 @@ class _DrawingBoardState extends State<DrawingBoard> {
final digitalInkRecognizer = DigitalInkRecognizer(languageCode: 'ja');
final context = DigitalInkRecognitionContext(
preContext: widget.precedingText,
writingArea: WritingArea(
height: signatureW.currentContext!.size!.height,
width: signatureW.currentContext!.size!.width,
@@ -119,28 +120,22 @@ class _DrawingBoardState extends State<DrawingBoard> {
Widget kanjiChip(String kanji) => InkWell(
onTap: () => widget.onSuggestionChosen?.call(kanji),
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.menuGreyLight;
return Container(
height: fontSize + 2 * suggestionCirclePadding,
width: fontSize + 2 * suggestionCirclePadding,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Center(
child: Text(
kanji,
style: TextStyle(
fontSize: fontSize,
color: colors.foreground,
).merge(japaneseFont.textStyle),
),
),
);
},
child: Container(
height: fontSize + 2 * suggestionCirclePadding,
width: fontSize + 2 * suggestionCirclePadding,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: panelColor.backgroundColor,
),
child: Center(
child: Text(
kanji,
style: TextStyle(
fontSize: fontSize,
color: panelColor.foregroundColor,
).merge(japaneseFont.textStyle),
),
),
),
);
@@ -154,7 +149,7 @@ class _DrawingBoardState extends State<DrawingBoard> {
(!snapshot.hasError && (snapshot.data?.isEmpty ?? false))) {
return Container(
key: suggestionBarW,
color: barColor.background,
color: barColor.backgroundColor,
alignment: Alignment.center,
padding: padding,
child: const Text('No suggestions'),
@@ -174,7 +169,7 @@ class _DrawingBoardState extends State<DrawingBoard> {
return Container(
key: suggestionBarW,
color: barColor.background,
color: barColor.backgroundColor,
alignment: Alignment.center,
padding: padding,
@@ -199,7 +194,7 @@ class _DrawingBoardState extends State<DrawingBoard> {
}
Widget buttonRow() => Container(
color: panelColor.background,
color: panelColor.backgroundColor,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
@@ -254,7 +249,7 @@ class _DrawingBoardState extends State<DrawingBoard> {
child: Signature(
key: signatureW,
controller: controller,
backgroundColor: panelColor.background,
backgroundColor: panelColor.backgroundColor!,
),
),
buttonRow(),
@@ -273,12 +268,6 @@ class _DrawingBoardState extends State<DrawingBoard> {
@override
Widget build(BuildContext context) {
return BlocListener<ThemeBloc, ThemeState>(
listener: (context, state) => setState(() {
panelColor = state.theme.menuGreyLight;
barColor = state.theme.menuGreyDark;
}),
child: Column(children: [suggestionBar(), drawingPanel()]),
);
return Column(children: [suggestionBar(), drawingPanel()]);
}
}

View File

@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../bloc/theme/theme_bloc.dart';
import 'package:mugiten/theme.dart';
class TextDivider extends StatelessWidget {
final String text;
@@ -9,18 +7,16 @@ class TextDivider extends StatelessWidget {
const TextDivider({super.key, required this.text});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.menuGreyNormal;
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<MenuGreyNormalThemeExtension>()!;
return Container(
decoration: BoxDecoration(color: colors.background),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: DefaultTextStyle.merge(
child: Text(text),
style: TextStyle(color: colors.foreground),
),
);
},
);
return Container(
decoration: BoxDecoration(color: colors.backgroundColor),
padding: const EdgeInsets.symmetric(vertical: 5, horizontal: 10),
child: DefaultTextStyle.merge(
child: Text(text),
style: TextStyle(color: colors.foregroundColor),
),
);
}
}

View File

@@ -1,10 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get_it/get_it.dart';
import 'package:mugiten/bloc/theme/theme_bloc.dart';
import 'package:mugiten/components/search/search_results_body/parts/circle_badge.dart';
import 'package:mugiten/models/history_entry.dart';
import 'package:mugiten/services/clipboard.dart';
import 'package:mugiten/theme.dart';
import 'package:sqflite/sqlite_api.dart';
import '../../routing/routes.dart';
@@ -26,6 +26,7 @@ class HistoryEntryTile extends StatelessWidget {
super.key,
});
/// Perform the search again when the entry is tapped.
void Function() _onTap(BuildContext context) => entry.isKanji
? () => Navigator.pushNamed(
context,
@@ -35,6 +36,11 @@ class HistoryEntryTile extends StatelessWidget {
: () =>
Navigator.pushNamed(context, Routes.search, arguments: entry.word);
/// Copy the kanji/searchword to the clipboard when the entry is long-pressed.
void Function() _onLongPress(BuildContext context) =>
() =>
copyToClipboard(context, entry.isKanji ? entry.kanji! : entry.word!);
MaterialPageRoute get timestamps => MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: const Text('Last searched')),
@@ -68,6 +74,8 @@ class HistoryEntryTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<MenuGreyNormalThemeExtension>()!;
return Slidable(
endActionPane: ActionPane(
motion: const ScrollMotion(),
@@ -77,6 +85,7 @@ class HistoryEntryTile extends StatelessWidget {
padding: const EdgeInsets.symmetric(vertical: 10),
child: ListTile(
onTap: _onTap(context),
onLongPress: _onLongPress(context),
contentPadding: EdgeInsets.zero,
title: Row(
children: [
@@ -94,11 +103,9 @@ class HistoryEntryTile extends StatelessWidget {
if (entry.timestampCount > 1)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, themeState) => CircleBadge(
color: themeState.theme.menuGreyNormal.background,
child: Text('${entry.timestampCount}'),
),
child: CircleBadge(
color: colors.backgroundColor!,
child: Text('${entry.timestampCount}'),
),
),
],

View File

@@ -1,176 +0,0 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jadb/util/romaji_transliteration.dart';
import 'package:mugiten/models/themes/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../routing/routes.dart';
import '../../../settings.dart';
/// An example of a word that contains the kanji in question.
class YomiExample {
/// The original text of the example.
String example;
/// The reading of the example.
String reading;
/// The meaning of the example.
String meaning;
// ignore: public_member_api_docs
YomiExample({
required this.example,
required this.reading,
required this.meaning,
});
// ignore: public_member_api_docs
Map<String, String> toJson() => {
'example': example,
'reading': reading,
'meaning': meaning,
};
}
class Examples extends StatelessWidget {
final List<YomiExample> onyomi;
final List<YomiExample> kunyomi;
const Examples({super.key, required this.onyomi, required this.kunyomi});
@override
Widget build(BuildContext context) {
const textStyle = TextStyle(fontSize: 20);
final yomiWidgets =
onyomi.map((onEx) => _Example(onEx, _KanaType.onyomi)).toList() +
kunyomi.map((kunEx) => _Example(kunEx, _KanaType.kunyomi)).toList();
const noExamplesWidget = Padding(
padding: EdgeInsets.symmetric(vertical: 10),
child: Text('No Examples', style: textStyle),
);
return Column(
children: <Widget>[
Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
alignment: Alignment.centerLeft,
child: const Text('Examples:', style: textStyle),
),
if (onyomi.isEmpty && kunyomi.isEmpty)
noExamplesWidget
else
...yomiWidgets,
],
);
}
}
enum _KanaType { kunyomi, onyomi }
class _Example extends StatelessWidget {
final _KanaType kanaType;
final YomiExample yomiExample;
const _Example(this.yomiExample, this.kanaType);
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final theme = state.theme;
final menuColors = theme.menuGreyNormal;
final kanaColors = kanaType == _KanaType.kunyomi
? theme.kunyomiColor
: theme.onyomiColor;
return Container(
margin: const EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0),
decoration: BoxDecoration(
color: menuColors.background,
borderRadius: BorderRadius.circular(10.0),
),
child: IntrinsicHeight(
child: Row(
children: [
InkWell(
onTap: () => Navigator.pushNamed(
context,
Routes.search,
arguments: yomiExample.example,
),
child: _Kana(colors: kanaColors, example: yomiExample),
),
_ExampleText(colors: menuColors, example: yomiExample),
],
),
),
);
},
);
}
class _Kana extends StatelessWidget {
final ColorSet colors;
final YomiExample example;
const _Kana({required this.colors, required this.example});
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: colors.background,
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(10.0),
bottomLeft: Radius.circular(10.0),
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
romajiEnabled
? transliterateKanaToLatin(example.reading)
: example.reading,
style: TextStyle(
color: colors.foreground,
fontSize: 15.0,
).merge(!romajiEnabled ? japaneseFont.textStyle : null),
),
const SizedBox(height: 5.0),
Text(
example.example,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
).merge(japaneseFont.textStyle),
),
],
),
);
}
}
class _ExampleText extends StatelessWidget {
final ColorSet colors;
final YomiExample example;
const _ExampleText({required this.colors, required this.example});
@override
Widget build(BuildContext context) {
return Expanded(
child: Padding(
padding: const EdgeInsets.all(10),
child: Wrap(
children: [
Text(example.meaning, style: TextStyle(color: colors.foreground)),
],
),
),
);
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../settings.dart';
class Grade extends StatelessWidget {
@@ -11,24 +10,22 @@ class Grade extends StatelessWidget {
const Grade({required this.grade, this.ifNullChar = '', super.key});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<KanjiResultThemeExtension>()!;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: colors.background,
shape: BoxShape.circle,
),
child: Text(
grade ?? ifNullChar,
style: TextStyle(
color: colors.foreground,
fontSize: 20.0,
).merge(japaneseFont.textStyle),
),
);
},
);
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
color: colors.backgroundColor,
shape: BoxShape.circle,
),
child: Text(
grade ?? ifNullChar,
style: TextStyle(
color: colors.foregroundColor,
fontSize: 20.0,
).merge(japaneseFont.textStyle),
),
);
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../settings.dart';
class Header extends StatelessWidget {
@@ -10,27 +9,25 @@ class Header extends StatelessWidget {
const Header({required this.kanji, super.key});
@override
Widget build(BuildContext context) => AspectRatio(
aspectRatio: 1,
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<KanjiResultThemeExtension>()!;
return Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: colors.background,
),
child: Text(
kanji,
style: TextStyle(
fontSize: 70.0,
color: colors.foreground,
).merge(japaneseFont.textStyle),
),
);
},
),
);
return AspectRatio(
aspectRatio: 1,
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: colors.backgroundColor,
),
child: Text(
kanji,
style: TextStyle(
fontSize: 70.0,
color: colors.foregroundColor,
).merge(japaneseFont.textStyle),
),
),
);
}
}

View File

@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../bloc/theme/theme_bloc.dart';
import 'package:mugiten/theme.dart';
class JlptLevel extends StatelessWidget {
final String? jlptLevel;
@@ -10,20 +8,18 @@ class JlptLevel extends StatelessWidget {
const JlptLevel({required this.jlptLevel, this.ifNullChar = '', super.key});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Text(
jlptLevel ?? ifNullChar,
style: TextStyle(color: colors.foreground, fontSize: 20.0),
),
);
},
);
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<KanjiResultThemeExtension>()!;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.backgroundColor,
),
child: Text(
jlptLevel ?? ifNullChar,
style: TextStyle(color: colors.foregroundColor, fontSize: 20.0),
),
);
}
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../routing/routes.dart';
import '../../../settings.dart';
@@ -11,31 +10,29 @@ class Radical extends StatelessWidget {
const Radical({required this.radical, super.key});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<KanjiResultThemeExtension>()!;
return InkWell(
onTap: () => Navigator.pushNamed(
context,
Routes.kanjiSearchRadicals,
arguments: radical,
return InkWell(
onTap: () => Navigator.pushNamed(
context,
Routes.kanjiSearchRadicals,
arguments: radical,
),
child: Container(
padding: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.backgroundColor,
),
child: Container(
padding: const EdgeInsets.all(15.0),
decoration: BoxDecoration(
shape: BoxShape.circle,
color: colors.background,
),
child: Text(
radical,
style: TextStyle(
color: colors.foreground,
fontSize: 40.0,
).merge(japaneseFont.textStyle),
),
child: Text(
radical,
style: TextStyle(
color: colors.foregroundColor,
fontSize: 40.0,
).merge(japaneseFont.textStyle),
),
);
},
);
),
);
}
}

View File

@@ -1,7 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../bloc/theme/theme_bloc.dart';
import 'package:mugiten/theme.dart';
class Rank extends StatelessWidget {
final int? rank;
@@ -10,22 +8,20 @@ class Rank extends StatelessWidget {
const Rank({required this.rank, this.ifNullChar = '', super.key});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.kanjiResultColor;
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<KanjiResultThemeExtension>()!;
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: (rank == null) ? BoxShape.circle : BoxShape.rectangle,
borderRadius: (rank == null) ? null : BorderRadius.circular(10.0),
color: colors.background,
),
child: Text(
rank != null ? '${rank.toString()} / 2500' : ifNullChar,
style: TextStyle(color: colors.foreground, fontSize: 20.0),
),
);
},
);
return Container(
padding: const EdgeInsets.all(10.0),
decoration: BoxDecoration(
shape: (rank == null) ? BoxShape.circle : BoxShape.rectangle,
borderRadius: (rank == null) ? null : BorderRadius.circular(10.0),
color: colors.backgroundColor,
),
child: Text(
rank != null ? '${rank.toString()} / 2500' : ifNullChar,
style: TextStyle(color: colors.foregroundColor, fontSize: 20.0),
),
);
}
}

View File

@@ -1,28 +1,43 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../bloc/theme/theme_bloc.dart';
import 'package:kanimaji/kanimaji.dart';
import 'package:mugiten/theme.dart';
class StrokeOrderGif extends StatelessWidget {
final String uri;
final String kanji;
const StrokeOrderGif({required this.uri, super.key});
const StrokeOrderGif({required this.kanji, super.key});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return Container(
margin: const EdgeInsets.symmetric(vertical: 20.0),
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: state.theme.kanjiResultColor.background,
borderRadius: BorderRadius.circular(15.0),
Widget build(BuildContext context) {
final kanjiResultColors = Theme.of(
context,
).extension<KanjiResultThemeExtension>()!;
final menuGreyLightColors = Theme.of(
context,
).extension<MenuGreyLightThemeExtension>()!;
return Container(
height: MediaQuery.of(context).size.width * 0.40,
width: MediaQuery.of(context).size.width * 0.40,
padding: const EdgeInsets.all(5.0),
decoration: BoxDecoration(
color: menuGreyLightColors.backgroundColor,
borderRadius: BorderRadius.circular(15.0),
border: BoxBorder.all(
color: kanjiResultColors.backgroundColor!,
width: 4.0,
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Image.network(uri),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(10.0),
child: Kanimaji(
kanji: kanji,
strokeColor: kanjiResultColors.foregroundColor!,
strokeUnfilledColor: menuGreyLightColors.foregroundColor!.withAlpha(
0x40,
),
),
);
},
);
),
);
}
}

View File

@@ -1,37 +1,32 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jadb/util/romaji_transliteration.dart';
import 'package:mugiten/models/themes/theme.dart';
import 'package:mugiten/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../routing/routes.dart';
import '../../../settings.dart';
enum YomiType { onyomi, kunyomi, meaning }
extension on YomiType {
String get title {
// String get title {
// switch (this) {
// case YomiType.onyomi:
// return 'Onyomi';
// case YomiType.kunyomi:
// return 'Kunyomi';
// case YomiType.meaning:
// return 'Meanings';
// }
// }
Color getColor(BuildContext context) {
switch (this) {
case YomiType.onyomi:
return 'Onyomi';
return Theme.of(context).extension<YomiThemeExtension>()!.onyomiColor!;
case YomiType.kunyomi:
return 'Kunyomi';
return Theme.of(context).extension<YomiThemeExtension>()!.kunyomiColor!;
case YomiType.meaning:
return 'Meanings';
}
}
ColorSet getColors(BuildContext context) {
// TODO: convert this into a blocbuilder or bloclistener
final theme = BlocProvider.of<ThemeBloc>(context).state.theme;
switch (this) {
case YomiType.onyomi:
return theme.onyomiColor;
case YomiType.kunyomi:
return theme.kunyomiColor;
case YomiType.meaning:
return theme.menuGreyNormal;
return Theme.of(context).colorScheme.primary;
}
}
}
@@ -45,7 +40,7 @@ class YomiChips extends StatelessWidget {
Widget yomiCard({
required BuildContext context,
required String yomi,
required ColorSet colors,
required Color? color,
bool searchable = true,
TextStyle? extraTextStyle,
}) => InkWell(
@@ -56,14 +51,14 @@ class YomiChips extends StatelessWidget {
margin: const EdgeInsets.symmetric(horizontal: 5),
padding: const EdgeInsets.symmetric(vertical: 10.0, horizontal: 10.0),
decoration: BoxDecoration(
color: colors.background,
color: color,
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
yomi,
style: TextStyle(
fontSize: 20.0,
color: colors.foreground,
color: Theme.of(context).colorScheme.onPrimary,
).merge(extraTextStyle),
),
),
@@ -76,7 +71,7 @@ class YomiChips extends StatelessWidget {
(y) => yomiCard(
context: context,
yomi: y,
colors: type.getColors(context),
color: type.getColor(context),
extraTextStyle: type != YomiType.meaning && !romajiEnabled
? japaneseFont.textStyle
: null,
@@ -93,10 +88,7 @@ class YomiChips extends StatelessWidget {
context: context,
yomi: type == YomiType.kunyomi ? 'Kun:' : 'On:',
searchable: false,
colors: ColorSet(
foreground: type.getColors(context).background,
background: Colors.transparent,
),
color: type.getColor(context),
),
...yomiCards,
],

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../routing/routes.dart';
import '../../../settings.dart';
@@ -31,31 +30,28 @@ class _GridItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<MenuGreyLightThemeExtension>()!;
return InkWell(
onTap: () {
Navigator.pushNamed(context, Routes.kanjiSearch, arguments: kanji);
},
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final menuColors = state.theme.menuGreyLight;
return Container(
decoration: BoxDecoration(
color: menuColors.background,
borderRadius: BorderRadius.circular(20.0),
),
child: Container(
margin: const EdgeInsets.all(10.0),
child: FittedBox(
child: Text(
kanji,
style: japaneseFont.textStyle.merge(
TextStyle(color: menuColors.foreground),
),
),
child: Container(
decoration: BoxDecoration(
color: colors.backgroundColor,
borderRadius: BorderRadius.circular(20.0),
),
child: Container(
margin: const EdgeInsets.all(10.0),
child: FittedBox(
child: Text(
kanji,
style: japaneseFont.textStyle.merge(
TextStyle(color: colors.foregroundColor),
),
),
);
},
),
),
),
);
}

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../../bloc/theme/theme_bloc.dart';
import '../../../routing/routes.dart';
class KanjiSearchOptionsBar extends StatelessWidget {
@@ -43,12 +42,12 @@ class _IconButton extends StatelessWidget {
const _IconButton({required this.icon, required this.onPressed});
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) => IconButton(
onPressed: onPressed,
icon: icon,
iconSize: 30,
color: state.theme.menuGreyDark.background,
),
Widget build(BuildContext context) => IconButton(
onPressed: onPressed,
icon: icon,
iconSize: 30,
color: Theme.of(
context,
).extension<MenuGreyDarkThemeExtension>()!.backgroundColor,
);
}

View File

@@ -6,6 +6,7 @@ import 'package:mugiten/models/library_list.dart';
import 'package:sqflite/sqlite_api.dart';
import '../../routing/routes.dart';
import '../../services/clipboard.dart';
import '../../settings.dart';
import '../common/kanji_box.dart';
@@ -75,6 +76,7 @@ class LibraryListEntryTile extends StatelessWidget {
);
onUpdate?.call();
},
onLongPress: () => copyToClipboard(context, kanji),
title: Row(
children: [
SizedBox(width: 15),

View File

@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:get_it/get_it.dart';
import 'package:mugiten/components/common/async_text_form_field.dart';
import 'package:mugiten/models/library_list.dart';
import 'package:sqflite/sqlite_api.dart';
@@ -10,7 +11,7 @@ class LibraryListTile extends StatelessWidget {
final Widget? leading;
final LibraryList library;
final void Function()? onDelete;
final void Function()? onUpdate;
final void Function(String, String)? onRename;
final bool isEditable;
const LibraryListTile({
@@ -18,7 +19,7 @@ class LibraryListTile extends StatelessWidget {
required this.library,
this.leading,
this.onDelete,
this.onUpdate,
this.onRename,
this.isEditable = true,
});
@@ -34,8 +35,23 @@ class LibraryListTile extends StatelessWidget {
backgroundColor: Colors.blue,
icon: Icons.edit,
onPressed: (_) async {
// TODO: update name
onUpdate?.call();
final String oldName = library.name;
final String? newName = await showDialog<String>(
context: context,
barrierDismissible: true,
builder: (_) => _RenameLibraryDialog(oldName: oldName),
);
if (newName == null) {
return;
}
await GetIt.instance.get<Database>().libraryListRenameList(
oldName,
newName,
);
onRename?.call(oldName, newName);
},
),
// TODO: ask for confirmation before deleting
@@ -65,3 +81,55 @@ class LibraryListTile extends StatelessWidget {
);
}
}
class _RenameLibraryDialog extends StatefulWidget {
final String oldName;
const _RenameLibraryDialog({required this.oldName});
@override
State<_RenameLibraryDialog> createState() => _RenameLibraryDialogState();
}
class _RenameLibraryDialogState extends State<_RenameLibraryDialog> {
final controller = TextEditingController();
@override
void initState() {
super.initState();
controller.text = widget.oldName;
}
@override
Widget build(BuildContext context) {
return AlertDialog(
title: const Text('Rename library'),
content: AsyncTextFormField(
controller: controller,
asyncValidator: (value) async {
if (value == null || value.isEmpty) {
return 'Please enter a name';
}
if (value == 'favourites') {
return 'This name is reserved';
}
if (value != widget.oldName &&
await GetIt.instance.get<Database>().libraryListExists(value)) {
return 'A library with this name already exists';
}
return null;
},
),
actions: [
ElevatedButton(
onPressed: () => Navigator.pop(context),
child: const Text('Cancel'),
),
ElevatedButton(
onPressed: () => Navigator.pop(context, controller.text),
child: const Text('Confirm'),
),
],
);
}
}

View File

@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:mugiten/components/drawing_board/drawing_board.dart';
import 'package:mugiten/theme.dart';
import '../../models/themes/theme.dart';
import '../../routing/routes.dart';
import '../../settings.dart';
import 'language_selector.dart';
@@ -37,7 +37,7 @@ class GlobalSearchBar extends StatelessWidget {
topRight: Radius.circular(10.0),
bottomRight: Radius.circular(10.0),
),
color: AppTheme.mugitenWheat.background,
color: mugitenWheatBackground,
child: IconButton(
onPressed: () {
final text = textController.text.trim();
@@ -65,7 +65,14 @@ class GlobalSearchBar extends StatelessWidget {
IconButton(
icon: const Icon(Icons.mode),
onPressed: () async {
final result = await _drawKanji()(context);
final precedingText = textController.selection.isValid
? textController.text.substring(
textController.selection.baseOffset,
)
: null;
final result = await _drawKanji(precedingText)(context);
if (result != null && result.isNotEmpty) {
if (textController.selection.isValid) {
final pos = textController.selection.baseOffset;
@@ -93,7 +100,7 @@ class GlobalSearchBar extends StatelessWidget {
);
}
Future<String?> Function(BuildContext) _drawKanji() {
Future<String?> Function(BuildContext) _drawKanji(String? precedingText) {
final MaterialPageRoute<String> route = MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: const Text('Draw a kanji')),
@@ -102,6 +109,7 @@ class GlobalSearchBar extends StatelessWidget {
children: [
const Expanded(child: Column()),
DrawingBoard(
precedingText: precedingText,
onlyOneCharacterSuggestions: true,
onSuggestionChosen: (suggestion) =>
Navigator.pop(context, suggestion),

View File

@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:mugiten/theme.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../models/themes/theme.dart';
import '../../settings.dart';
class LanguageSelector extends StatefulWidget {
@@ -41,7 +41,7 @@ class _LanguageSelectorState extends State<LanguageSelector> {
@override
Widget build(BuildContext context) {
return ToggleButtons(
selectedColor: AppTheme.mugitenWheat.background,
selectedColor: mugitenWheatBackground,
isSelected: isSelected,
children: [
_languageOption('Auto'),

View File

@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mugiten/theme.dart';
import '../../../../bloc/theme/theme_bloc.dart';
import '../../../../routing/routes.dart';
import '../../../../settings.dart';
@@ -10,35 +9,34 @@ class KanjiRow extends StatelessWidget {
final double fontSize;
const KanjiRow({super.key, required this.kanji, this.fontSize = 20});
Widget _kanjiBox(String kanji) => UnconstrainedBox(
child: IntrinsicHeight(
child: AspectRatio(
aspectRatio: 1,
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final colors = state.theme.menuGreyLight;
return Container(
padding: const EdgeInsets.all(10),
alignment: Alignment.center,
decoration: BoxDecoration(
color: colors.background,
borderRadius: BorderRadius.circular(10),
Widget _kanjiBox(BuildContext context, String kanji) {
final colors = Theme.of(context).extension<MenuGreyLightThemeExtension>()!;
return UnconstrainedBox(
child: IntrinsicHeight(
child: AspectRatio(
aspectRatio: 1,
child: Container(
padding: const EdgeInsets.all(10),
alignment: Alignment.center,
decoration: BoxDecoration(
color: colors.backgroundColor,
borderRadius: BorderRadius.circular(10),
),
child: FittedBox(
child: Text(
kanji,
style: TextStyle(
color: colors.foregroundColor,
fontSize: fontSize,
).merge(japaneseFont.textStyle),
),
child: FittedBox(
child: Text(
kanji,
style: TextStyle(
color: colors.foreground,
fontSize: fontSize,
).merge(japaneseFont.textStyle),
),
),
);
},
),
),
),
),
),
);
);
}
@override
Widget build(BuildContext context) {
@@ -58,7 +56,7 @@ class KanjiRow extends StatelessWidget {
Routes.kanjiSearch,
arguments: k,
),
child: _kanjiBox(k),
child: _kanjiBox(context, k),
),
],
),

View File

@@ -1,14 +1,14 @@
import 'package:flutter/material.dart';
import 'package:jadb/util/romaji_transliteration.dart';
import 'package:mugiten/theme.dart';
import '../../../../models/themes/theme.dart';
import '../../../../settings.dart';
class KanjiKanaBox extends StatelessWidget {
final String baseWord;
final String? furigana;
final bool showRomajiBelow;
final ColorSet colors;
final ForegroundBackgroundThemeExtension colors;
final bool autoTransliterateRomaji;
final bool centerFurigana;
final double? furiganaFontsize;
@@ -20,8 +20,8 @@ class KanjiKanaBox extends StatelessWidget {
super.key,
required this.baseWord,
required this.furigana,
required this.colors,
this.showRomajiBelow = false,
this.colors = LightTheme.defaultMenuGreyNormal,
this.autoTransliterateRomaji = true,
this.centerFurigana = true,
this.furiganaFontsize,
@@ -39,7 +39,7 @@ class KanjiKanaBox extends StatelessWidget {
return Container(
margin: margin,
padding: padding,
color: colors.background,
color: colors.backgroundColor,
child: DefaultTextStyle.merge(
child: Column(
crossAxisAlignment: centerFurigana
@@ -54,7 +54,7 @@ class KanjiKanaBox extends StatelessWidget {
style:
TextStyle(
fontSize: fFontsize,
color: colors.foreground,
color: colors.foregroundColor,
).merge(
romajiEnabled && autoTransliterateRomaji
? null
@@ -78,7 +78,7 @@ class KanjiKanaBox extends StatelessWidget {
Text(transliterateKanaToLatin(furigana ?? baseWord)),
],
),
style: TextStyle(color: colors.foreground),
style: TextStyle(color: colors.foregroundColor),
),
);
}

View File

@@ -1,8 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jadb/models/word_search/word_search_ruby.dart';
import 'package:mugiten/theme.dart';
import '../../../../bloc/theme/theme_bloc.dart';
import 'kanji_kana_box.dart';
class OtherForms extends StatelessWidget {
@@ -11,29 +10,28 @@ class OtherForms extends StatelessWidget {
const OtherForms({required this.forms, super.key});
@override
Widget build(BuildContext context) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: forms.isNotEmpty
? [
const Text(
'Other Forms:',
style: TextStyle(fontWeight: FontWeight.bold),
),
Wrap(
children: [
for (final form in forms)
BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
return KanjiKanaBox(
baseWord: form.base,
furigana: form.furigana,
colors: state.theme.menuGreyLight,
);
},
),
],
),
]
: [],
);
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<MenuGreyLightThemeExtension>()!;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: forms.isNotEmpty
? [
const Text(
'Other Forms:',
style: TextStyle(fontWeight: FontWeight.bold),
),
Wrap(
children: [
for (final form in forms)
KanjiKanaBox(
baseWord: form.base,
furigana: form.furigana,
colors: colors,
),
],
),
]
: [],
);
}
}

View File

@@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:mugiten/models/themes/theme.dart';
import 'package:mugiten/theme.dart';
import 'search_chip.dart';
class EnglishDefinitions extends StatelessWidget {
final List<String> englishDefinitions;
final ColorSet colors;
final ForegroundBackgroundThemeExtension colors;
const EnglishDefinitions({
super.key,
required this.englishDefinitions,
this.colors = LightTheme.defaultMenuGreyNormal,
required this.colors,
});
@override

View File

@@ -1,16 +1,15 @@
import 'package:flutter/material.dart';
import '../../../../../models/themes/theme.dart';
import 'package:mugiten/theme.dart';
class SearchChip extends StatelessWidget {
final String text;
final ColorSet colors;
final ForegroundBackgroundThemeExtension colors;
final TextStyle? extraTextStyle;
const SearchChip({
super.key,
required this.text,
this.colors = LightTheme.defaultMenuGreyNormal,
required this.colors,
this.extraTextStyle,
});
@@ -18,12 +17,12 @@ class SearchChip extends StatelessWidget {
Widget build(BuildContext context) => Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: colors.background,
color: colors.backgroundColor,
borderRadius: BorderRadius.circular(10.0),
),
child: Text(
text,
style: TextStyle(color: colors.foreground).merge(extraTextStyle),
style: TextStyle(color: colors.foregroundColor).merge(extraTextStyle),
),
);
}

View File

@@ -1,10 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:jadb/models/word_search/word_search_sense.dart';
import 'package:mugiten/components/search/search_results_body/search_card.dart';
import 'package:mugiten/theme.dart';
import 'package:sealed_languages/sealed_languages.dart';
import '../../../../../bloc/theme/theme_bloc.dart';
import 'english_definitions.dart';
final Map<String, String> languageNameMap = {
@@ -47,12 +46,18 @@ class Sense extends StatelessWidget {
}
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) => Container(
Widget build(BuildContext context) {
final lightColors = Theme.of(
context,
).extension<MenuGreyLightThemeExtension>()!;
final normalColors = Theme.of(
context,
).extension<MenuGreyNormalThemeExtension>()!;
return Container(
margin: const EdgeInsets.symmetric(vertical: 5),
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: state.theme.menuGreyLight.background,
color: lightColors.backgroundColor,
borderRadius: BorderRadius.circular(10.0),
),
child: Column(
@@ -66,7 +71,7 @@ class Sense extends StatelessWidget {
),
EnglishDefinitions(
englishDefinitions: sense.englishDefinitions,
colors: state.theme.menuGreyNormal,
colors: normalColors,
),
if (_notes().isNotEmpty)
Container(
@@ -119,6 +124,6 @@ class Sense extends StatelessWidget {
)
.toList(),
),
),
);
);
}
}

View File

@@ -5,6 +5,7 @@ import 'package:jadb/models/word_search/word_search_result.dart';
import 'package:jadb/util/text_filtering.dart';
import 'package:mugiten/components/library/add_to_library_dialog.dart';
import 'package:mugiten/models/library_list.dart';
import 'package:mugiten/services/clipboard.dart';
import 'package:sqflite/sqlite_api.dart';
import './parts/common_badge.dart';
@@ -91,40 +92,44 @@ class _SearchResultCardState extends State<SearchResultCard> {
final backgroundColor =
widget.backgroundColor ?? Theme.of(context).scaffoldBackgroundColor;
return Slidable(
endActionPane: ActionPane(
motion: const ScrollMotion(),
children:
widget.slidableActions ??
[
SlidableAction(
backgroundColor: Colors.yellow,
icon: Icons.star,
onPressed: (_) =>
GetIt.instance.get<Database>().libraryListToggleEntry(
'favourites',
jmdictEntryId: widget.result.entryId,
kanji: null,
),
),
SlidableAction(
backgroundColor: Colors.blue,
icon: Icons.bookmark,
onPressed: (context) => showAddToLibraryDialog(
context: context,
jmdictEntryId: widget.result.entryId,
kanji: null,
return GestureDetector(
onLongPress: () =>
copyToClipboard(context, widget.result.japanese.firstOrNull?.base),
child: Slidable(
endActionPane: ActionPane(
motion: const ScrollMotion(),
children:
widget.slidableActions ??
[
SlidableAction(
backgroundColor: Colors.yellow,
icon: Icons.star,
onPressed: (_) =>
GetIt.instance.get<Database>().libraryListToggleEntry(
'favourites',
jmdictEntryId: widget.result.entryId,
kanji: null,
),
),
),
],
),
child: ExpansionTile(
leading: widget.leading,
collapsedBackgroundColor: backgroundColor,
backgroundColor: backgroundColor,
// onExpansionChanged: (b) async { },
title: _header,
children: [_body()],
SlidableAction(
backgroundColor: Colors.blue,
icon: Icons.bookmark,
onPressed: (context) => showAddToLibraryDialog(
context: context,
jmdictEntryId: widget.result.entryId,
kanji: null,
),
),
],
),
child: ExpansionTile(
leading: widget.leading,
collapsedBackgroundColor: backgroundColor,
backgroundColor: backgroundColor,
// onExpansionChanged: (b) async { },
title: _header,
children: [_body()],
),
),
);
}

View File

@@ -1,4 +1,3 @@
import 'dart:convert';
import 'dart:developer';
import 'dart:io';
@@ -73,17 +72,17 @@ class DatabaseMigration {
Future<List<DatabaseMigration>> readMigrationsFromAssets() async {
log('Reading migrations from assets...');
final String assetManifest = await rootBundle.loadString(
'AssetManifest.json',
);
final assetManifest = await AssetManifest.loadFromAssetBundle(rootBundle);
final List<String> migrations =
(jsonDecode(assetManifest) as Map<String, Object?>).keys
.where(
(assetPath) =>
RegExp(r'^migrations\/\d{4}.*\.sql$').hasMatch(assetPath),
)
.toList();
final List<String> migrations = assetManifest
.listAssets()
.where(
(assetPath) =>
RegExp(r'^migrations\/\d{4}.*\.sql$').hasMatch(assetPath),
)
.toList();
assert(migrations.isNotEmpty, 'No migration files found in assets');
migrations.sort();
@@ -191,10 +190,7 @@ Future<void> setupDatabase() async {
final String dbPath = await databasePath();
assert(
File(dbPath).existsSync(),
'Database file should exist at this point',
);
assert(File(dbPath).existsSync(), 'Database file should exist at this point');
final database = await openDatabaseWithoutMigrations(
dbPath,

View File

@@ -1,12 +1,11 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:mugiten/screens/initialization.dart';
import 'package:mugiten/services/initialization/initialization_logic.dart';
import 'package:mugiten/theme.dart';
import 'bloc/theme/theme_bloc.dart';
import 'routing/router.dart';
import 'settings.dart';
void runInitializationScreen(bool deleteDatabase) {
runApp(
@@ -37,7 +36,7 @@ class MyApp extends StatefulWidget {
}
class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
final ThemeBloc themeBloc = ThemeBloc();
final themeController = ThemeController.create();
@override
void initState() {
@@ -47,6 +46,7 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
GetIt.instance.registerSingleton<ThemeController>(themeController);
}
@override
@@ -57,26 +57,24 @@ class _MyAppState extends State<MyApp> with WidgetsBindingObserver {
@override
void didChangePlatformBrightness() {
if (autoThemeEnabled) {
final themeIsDark =
WidgetsBinding.instance.window.platformBrightness == Brightness.dark;
themeBloc.add(SetTheme(themeIsDark: themeIsDark));
}
super.didChangePlatformBrightness();
themeController.updateThemeMode();
}
@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [BlocProvider(create: (context) => themeBloc)],
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, themeState) => MaterialApp(
return ValueListenableBuilder<AppThemeMode>(
valueListenable: themeController.themeMode,
builder: (context, themeMode, _) {
return MaterialApp(
title: '麦典',
theme: themeState.theme.getMaterialTheme(),
theme: themeMode.lightThemeData,
darkTheme: themeMode.darkThemeData,
themeMode: themeMode.themeMode,
initialRoute: '/',
onGenerateRoute: generateRoute,
),
),
);
},
);
}
}

View File

@@ -134,12 +134,7 @@ extension LibraryListExt on DatabaseExecutor {
${page != null ? 'OFFSET ?' : ''}
''',
[
listName,
listName,
?pageSize,
if (page != null) page * pageSize!,
],
[listName, listName, ?pageSize, if (page != null) page * pageSize!],
);
Map<int, WordSearchResult>? wordResults;
@@ -235,6 +230,46 @@ extension LibraryListExt on DatabaseExecutor {
return (result.firstOrNull?['exists'] as int? ?? 0) == 1;
}
Future<void> libraryListRenameList(String oldName, String newName) async {
if (oldName.isEmpty) {
throw ArgumentError('Old library list name must not be empty.');
}
if (newName.isEmpty) {
throw ArgumentError('New library list name must not be empty.');
}
if (oldName == 'favourites') {
throw ArgumentError('Cannot rename the "favourites" list.');
}
if (!await libraryListExists(oldName)) {
throw ArgumentError('Library list "$oldName" does not exist.');
}
if (await libraryListExists(newName)) {
throw ArgumentError('Library list "$newName" already exists.');
}
final b = batch();
b.update(
LibraryListTableNames.libraryList,
{'name': newName},
where: '"name" = ?',
whereArgs: [oldName],
);
b.update(
LibraryListTableNames.libraryListEntry,
{'listName': newName},
where: '"listName" = ?',
whereArgs: [oldName],
);
await b.commit();
}
Future<int> libraryListAmount() async {
final result = await query(
LibraryListTableNames.libraryList,

View File

@@ -1,73 +0,0 @@
part of './theme.dart';
class DarkTheme extends AppTheme {
const DarkTheme() : super();
static const ColorSet defaultKanjiResultColor = ColorSet(
foreground: Colors.white,
background: Colors.green,
);
static const ColorSet defaultOnyomiColor = ColorSet(
foreground: Colors.white,
background: Colors.orange,
);
static const ColorSet defaultKunyomiColor = ColorSet(
foreground: Colors.white,
background: Colors.lightBlue,
);
static const Color defaultForeground = Colors.white;
static const Color defaultBackground = Colors.black;
static final defaultMenuGreyLight = ColorSet(
foreground: Colors.white,
background: Colors.grey.shade700,
);
static const defaultMenuGreyNormal = ColorSet(
foreground: Colors.white,
background: Colors.grey,
);
static final defaultMenuGreyDark = ColorSet(
foreground: Colors.black,
background: Colors.grey.shade300,
);
@override
ColorSet get kanjiResultColor => defaultKanjiResultColor;
@override
ColorSet get onyomiColor => defaultOnyomiColor;
@override
ColorSet get kunyomiColor => defaultKunyomiColor;
@override
Color get foreground => defaultForeground;
@override
Color get background => defaultBackground;
@override
ColorSet get menuGreyLight => defaultMenuGreyLight;
@override
ColorSet get menuGreyNormal => defaultMenuGreyNormal;
@override
ColorSet get menuGreyDark => defaultMenuGreyDark;
@override
ThemeData getMaterialTheme() {
return ThemeData(
brightness: Brightness.dark,
primarySwatch: createMaterialColor(AppTheme.mugitenWheat.background),
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
// Use PredictiveBackPageTransitionsBuilder to get the predictive back route transition!
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
},
),
);
}
}

View File

@@ -1,73 +0,0 @@
part of './theme.dart';
class LightTheme extends AppTheme {
const LightTheme() : super();
static const ColorSet defaultKanjiResultColor = ColorSet(
foreground: Colors.white,
background: Colors.blue,
);
static const ColorSet defaultOnyomiColor = ColorSet(
foreground: Colors.white,
background: Colors.orange,
);
static const ColorSet defaultKunyomiColor = ColorSet(
foreground: Colors.white,
background: Colors.lightBlue,
);
static const Color defaultForeground = Colors.black;
static const Color defaultBackground = Colors.white;
static final defaultMenuGreyLight = ColorSet(
foreground: Colors.black,
background: Colors.grey.shade300,
);
static const defaultMenuGreyNormal = ColorSet(
foreground: Colors.white,
background: Colors.grey,
);
static final defaultMenuGreyDark = ColorSet(
foreground: Colors.white,
background: Colors.grey.shade700,
);
@override
ColorSet get kanjiResultColor => defaultKanjiResultColor;
@override
ColorSet get onyomiColor => defaultOnyomiColor;
@override
ColorSet get kunyomiColor => defaultKunyomiColor;
@override
Color get foreground => defaultForeground;
@override
Color get background => defaultBackground;
@override
ColorSet get menuGreyLight => defaultMenuGreyLight;
@override
ColorSet get menuGreyNormal => defaultMenuGreyNormal;
@override
ColorSet get menuGreyDark => defaultMenuGreyDark;
@override
ThemeData getMaterialTheme() {
return ThemeData(
brightness: Brightness.light,
primarySwatch: createMaterialColor(AppTheme.mugitenWheat.background),
// primarySwatch: Colors.green,
pageTransitionsTheme: const PageTransitionsTheme(
builders: {
// Use PredictiveBackPageTransitionsBuilder to get the predictive back route transition!
TargetPlatform.android: PredictiveBackPageTransitionsBuilder(),
},
),
);
}
}

View File

@@ -1,71 +0,0 @@
import 'package:flutter/material.dart';
part 'light.dart';
part 'dark.dart';
abstract class AppTheme {
const AppTheme();
static const ColorSet mugitenWheat = ColorSet(
foreground: Colors.black,
// background: Color(0xFF3EDD00),
background: Color(0xFFFFE680),
);
static const Color mugitenGrey = Color(0xFF5A5A5B);
static const ColorSet mugitenLabel = ColorSet(
foreground: Colors.white,
background: Color(0xFF909DC0),
);
static const ColorSet mugitenCommonColor = ColorSet(
foreground: Colors.white,
background: Color(0xFF8ABC83),
);
ColorSet get kanjiResultColor;
ColorSet get onyomiColor;
ColorSet get kunyomiColor;
Color get foreground;
Color get background;
ColorSet get menuGreyLight;
ColorSet get menuGreyNormal;
ColorSet get menuGreyDark;
ThemeData getMaterialTheme();
}
class ColorSet {
final Color foreground;
final Color background;
const ColorSet({required this.foreground, required this.background});
}
/// Source: https://blog.usejournal.com/creating-a-custom-color-swatch-in-flutter-554bcdcb27f3
MaterialColor createMaterialColor(Color color) {
final List<double> strengths = [.05];
final swatch = <int, Color>{};
final int r = color.red;
final int g = color.green;
final int b = color.blue;
for (int i = 1; i < 10; i++) {
strengths.add(0.1 * i);
}
for (final strength in strengths) {
final double ds = 0.5 - strength;
swatch[(strength * 1000).round()] = Color.fromRGBO(
r + ((ds < 0 ? r : (255 - r)) * ds).round(),
g + ((ds < 0 ? g : (255 - g)) * ds).round(),
b + ((ds < 0 ? b : (255 - b)) * ds).round(),
1,
);
}
return MaterialColor(color.value, swatch);
}

View File

@@ -76,17 +76,24 @@ class _HistoryViewState extends State<HistoryView> {
fetchNextPage: fetchNextPage,
separatorBuilder: (context, index) {
if (index == 0) {
final firstItemDate =
_pagingController.items![1]!.lastTimestamp;
return _dateDivider(firstItemDate);
if (_pagingController.items == null ||
_pagingController.items!.length < 2) {
// No history entries, or the items has not been loaded yet.
return SizedBox.shrink();
} else {
final firstItemDate =
_pagingController.items![1]!.lastTimestamp;
return _dateDivider(firstItemDate);
}
}
final data = _pagingController.items!;
final HistoryEntry search = data[index]!;
// Previous in the sense of time, but it is the next item in the list.
final HistoryEntry? previousSearch =
data.length >= index + 1 ? data[index + 1] : null;
data.length > index + 1 ? data[index + 1] : null;
if (previousSearch != null &&
!dateIsEqual(

View File

@@ -1,14 +1,12 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:mdi/mdi.dart';
import 'package:mugiten/models/themes/theme.dart';
import 'package:mugiten/screens/search/kanji_search_view.dart';
import 'package:mugiten/screens/search/word_search_view.dart';
import 'package:mugiten/services/snackbar.dart';
import 'package:mugiten/settings.dart';
import 'package:mugiten/theme.dart';
import '../bloc/theme/theme_bloc.dart';
import '../components/common/denshi_jisho_background.dart';
import '../components/library/new_library_dialog.dart';
import 'debug.dart';
@@ -30,35 +28,31 @@ class _HomeState extends State<Home> {
@override
Widget build(BuildContext context) {
return BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, themeState) {
return Scaffold(
appBar: AppBar(
title: Text(page.titleBar),
centerTitle: true,
backgroundColor: AppTheme.mugitenWheat.background,
foregroundColor: AppTheme.mugitenWheat.foreground,
actions: page.actions,
),
body: DenshiJishoBackground(child: page.content),
bottomNavigationBar: BottomNavigationBar(
fixedColor: AppTheme.mugitenWheat.background,
currentIndex: pageNum,
onTap: (index) => setState(() {
pageNum = index;
}),
items: pages
.map(
(p) =>
BottomNavigationBarItem(label: p.titleBar, icon: p.icon),
)
.toList(),
showSelectedLabels: false,
showUnselectedLabels: false,
unselectedItemColor: themeState.theme.menuGreyDark.background,
),
);
},
final colors = Theme.of(context).extension<MenuGreyDarkThemeExtension>()!;
return Scaffold(
appBar: AppBar(
title: Text(page.titleBar),
centerTitle: true,
backgroundColor: mugitenWheatBackground,
foregroundColor: mugitenWheatForeground,
actions: page.actions,
),
body: DenshiJishoBackground(child: page.content),
bottomNavigationBar: BottomNavigationBar(
fixedColor: mugitenWheatBackground,
currentIndex: pageNum,
onTap: (index) => setState(() {
pageNum = index;
}),
items: pages
.map(
(p) => BottomNavigationBarItem(label: p.titleBar, icon: p.icon),
)
.toList(),
showSelectedLabels: false,
showUnselectedLabels: false,
unselectedItemColor: colors.backgroundColor,
),
);
}

View File

@@ -1,5 +1,3 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
@@ -30,22 +28,18 @@ class ChangelogView extends StatelessWidget {
}
Future<List<String>> _fetchChangelogs() async {
final String assetManifest = await rootBundle.loadString(
'AssetManifest.json',
);
final List<String> changelogs =
(jsonDecode(assetManifest) as Map<String, Object?>).keys
.where(
(assetPath) =>
RegExp(r'^docs/changelog/.*\.md$').hasMatch(assetPath),
)
.map(
(assetPath) => assetPath
.replaceFirst('docs/changelog/', '')
.replaceFirst('.md', ''),
)
.toList();
final assetManifest = await AssetManifest.loadFromAssetBundle(rootBundle);
final List<String> changelogs = assetManifest
.listAssets()
.where(
(assetPath) => RegExp(r'^docs/changelog/.*\.md$').hasMatch(assetPath),
)
.map(
(assetPath) => assetPath
.replaceFirst('docs/changelog/', '')
.replaceFirst('.md', ''),
)
.toList();
changelogs.sort((a, b) {
final aVersion = a
@@ -77,6 +71,7 @@ class ChangelogView extends StatelessWidget {
itemBuilder: (context, index) {
final version = versions[index];
return ListTile(
key: ValueKey(version),
title: Text(version),
onTap: () {
Navigator.push(context, _buildChangelogDetailRoute(version));

View File

@@ -95,6 +95,11 @@ class _LibraryContentViewState extends State<LibraryContentView> {
builderDelegate: PagedChildBuilderDelegate<LibraryListEntry>(
invisibleItemsThreshold: invisibleItemsThreshold,
itemBuilder: (context, entry, index) => LibraryListEntryTile(
key: ValueKey(
entry.jmdictEntryId != null
? 'jmdict-${entry.jmdictEntryId}'
: 'kanji-${entry.kanji}',
),
index: index,
entry: entry,
library: widget.library,
@@ -106,7 +111,7 @@ class _LibraryContentViewState extends State<LibraryContentView> {
noItemsFoundIndicatorBuilder: (_) =>
const Center(child: Text('List is empty')),
),
separatorBuilder: (_, __) =>
separatorBuilder: (_, _) =>
const Divider(height: 0, indent: 10, endIndent: 10),
),
),

View File

@@ -33,10 +33,9 @@ class _LibraryViewState extends State<LibraryView> {
return Column(
children: [
LibraryListTile(
key: ValueKey(libraries!.first.name),
library: libraries!.first,
leading: const Icon(Icons.star),
onDelete: getEntriesFromDatabase,
onUpdate: getEntriesFromDatabase,
isEditable: false,
),
Expanded(
@@ -46,9 +45,10 @@ class _LibraryViewState extends State<LibraryView> {
.skip(1)
.map(
(e) => LibraryListTile(
key: ValueKey(e.name),
library: e,
onDelete: getEntriesFromDatabase,
onUpdate: getEntriesFromDatabase,
onRename: (_, _) => getEntriesFromDatabase(),
),
)
.toList(),

View File

@@ -1,9 +1,13 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:jadb/models/kanji_search/kanji_search_result.dart';
import 'package:jadb/models/word_search/word_search_result.dart';
import 'package:jadb/search.dart';
import 'package:jadb/search/word_search/word_search.dart';
import 'package:mdi/mdi.dart';
import 'package:mugiten/components/library/add_to_library_dialog.dart';
import 'package:mugiten/components/search/search_results_body/search_card.dart';
import 'package:mugiten/models/history_entry.dart';
import 'package:mugiten/models/library_list.dart';
import 'package:mugiten/services/snackbar.dart';
@@ -27,10 +31,38 @@ class KanjiSearchResultPage extends StatefulWidget {
State<KanjiSearchResultPage> createState() => _KanjiSearchResultPageState();
}
const int pageSize = 50;
const int invisibleItemsThreshold = 25;
class _KanjiSearchResultPageState extends State<KanjiSearchResultPage> {
bool addedToDatabase = false;
bool isFavourite = false;
late final _pagingController = PagingController<int, WordSearchResult>(
getNextPageKey: (state) =>
state.lastPageIsEmpty ? null : state.nextIntPageKey,
fetchPage: (pageKey) => GetIt.instance
.get<Database>()
.jadbSearchWord(
widget.kanji,
page: pageKey - 1,
pageSize: pageSize,
searchMode: SearchMode.Kanji,
)
.then((page) {
if (pageKey == 1 && page != null && page.isNotEmpty) {
page.insert(0, WordSearchResult.empty());
}
return page ?? <WordSearchResult>[];
}),
);
@override
void dispose() {
_pagingController.dispose();
super.dispose();
}
// TODO: add compart link
Widget _headerRow(KanjiSearchResult result) => Container(
margin: const EdgeInsets.fromLTRB(20.0, 20.0, 20.0, 30.0),
@@ -92,12 +124,30 @@ class _KanjiSearchResultPageState extends State<KanjiSearchResultPage> {
],
);
String _gifUri(String kanji) {
final String charcode = kanji.characters.first.codeUnits
.map((c) => c.toRadixString(16))
.join();
return 'https://raw.githubusercontent.com/mistval/kanji_images/master/gifs/$charcode.gif';
}
Widget _topBody(KanjiSearchResult result) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_headerRow(result),
YomiChips(yomi: result.meanings, type: YomiType.meaning),
if (result.onyomi.isNotEmpty)
YomiChips(yomi: result.onyomi, type: YomiType.onyomi),
if (result.kunyomi.isNotEmpty)
YomiChips(yomi: result.kunyomi, type: YomiType.kunyomi),
const SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
StrokeOrderGif(kanji: result.kanji),
_rankingColumn(result),
],
),
const SizedBox(height: 30),
const Padding(
padding: EdgeInsetsGeometry.symmetric(horizontal: 20.0),
child: Text('Examples:', style: TextStyle(fontSize: 20.0)),
),
],
);
Widget _body(KanjiSearchResult result) {
return Scaffold(
@@ -133,30 +183,43 @@ class _KanjiSearchResultPageState extends State<KanjiSearchResultPage> {
),
],
),
body: ListView(
children: [
_headerRow(result),
YomiChips(yomi: result.meanings, type: YomiType.meaning),
if (result.onyomi.isNotEmpty)
YomiChips(yomi: result.onyomi, type: YomiType.onyomi),
if (result.kunyomi.isNotEmpty)
YomiChips(yomi: result.kunyomi, type: YomiType.kunyomi),
IntrinsicHeight(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
StrokeOrderGif(uri: _gifUri(result.kanji)),
_rankingColumn(result),
],
),
),
body: PagingListener(
controller: _pagingController,
builder: (context, state, fetchNextPage) {
return PagedListView<int, WordSearchResult>.separated(
state: state,
fetchNextPage: fetchNextPage,
builderDelegate: PagedChildBuilderDelegate<WordSearchResult>(
invisibleItemsThreshold: invisibleItemsThreshold,
itemBuilder: (context, entry, index) {
if (index == 0) {
return _topBody(result);
} else {
return SearchResultCard(
result: entry,
key: ValueKey(entry.entryId),
);
}
},
firstPageErrorIndicatorBuilder: (_) => ListView(
children: [
_topBody(result),
ErrorWidget(_pagingController.error!),
],
),
// TODO:
// Examples(
// onyomi: resultData.onyomiExamples,
// kunyomi: resultData.kunyomiExamples,
// ),
],
noItemsFoundIndicatorBuilder: (_) => ListView(
children: [
_topBody(result),
const Center(child: Text('No examples found')),
],
),
),
separatorBuilder: (_, index) => index == 0
? SizedBox.shrink()
: const Divider(height: 0, indent: 10, endIndent: 10),
);
},
),
);
}

View File

@@ -1,9 +1,8 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:jadb/const_data/kanji_grades.dart';
import 'package:mugiten/theme.dart';
// import '../../../../data/grades.dart';
import '../../../../models/themes/theme.dart';
import '../../../../routing/routes.dart';
import '../../../components/common/loading.dart';
import '../../../settings.dart';
@@ -22,9 +21,9 @@ class _GridItem extends StatelessWidget {
@override
Widget build(BuildContext context) {
final color = isNumber
? LightTheme.defaultMenuGreyDark
: LightTheme.defaultMenuGreyNormal;
final ForegroundBackgroundThemeExtension colors = isNumber
? lightTheme.extension<MenuGreyDarkThemeExtension>()!
: lightTheme.extension<MenuGreyNormalThemeExtension>()!;
final onTap = isNumber
? () => ScaffoldMessenger.of(
@@ -41,13 +40,13 @@ class _GridItem extends StatelessWidget {
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(5)),
color: color.background,
color: colors.backgroundColor,
),
alignment: Alignment.center,
child: Text(
text,
style: TextStyle(
color: color.foreground,
color: colors.foregroundColor,
fontSize: 25,
).merge(japaneseFont.textStyle),
),

View File

@@ -1,12 +1,10 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:jadb/const_data/radicals.dart';
import 'package:jadb/search.dart';
import 'package:mugiten/models/themes/theme.dart';
import 'package:mugiten/theme.dart';
import 'package:sqflite/sqflite.dart';
import '../../../../bloc/theme/theme_bloc.dart';
import '../../../../routing/routes.dart';
import '../../../settings.dart';
@@ -85,11 +83,16 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
}
Widget radicalGridElement(String radical, {bool isNumber = false}) {
final color = isNumber
? LightTheme.defaultMenuGreyDark
final foregroundColor = isNumber
? lightTheme.extension<MenuGreyDarkThemeExtension>()!.foregroundColor
: radicalToggles[radical]!
? AppTheme.mugitenWheat
: LightTheme.defaultMenuGreyNormal;
? mugitenWheatForeground
: lightTheme.extension<MenuGreyNormalThemeExtension>()!.foregroundColor;
final backgroundColor = isNumber
? lightTheme.extension<MenuGreyDarkThemeExtension>()!.backgroundColor
: radicalToggles[radical]!
? mugitenWheatBackground
: lightTheme.extension<MenuGreyNormalThemeExtension>()!.backgroundColor;
return InkWell(
onTap: isNumber
@@ -103,11 +106,11 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(5)),
color: color.background,
color: backgroundColor,
),
child: Text(
radical,
style: TextStyle(color: color.foreground, fontSize: fontSize),
style: TextStyle(color: foregroundColor, fontSize: fontSize),
),
),
);
@@ -121,15 +124,20 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
resetAllowedToggles();
}),
icon: const Icon(Icons.restore),
color: AppTheme.mugitenWheat.background,
color: mugitenWheatBackground,
iconSize: fontSize * 1.3,
),
...RADICALS.values
.expand((l) => l)
.where((k) => radicalToggles[k] ?? false)
.map((k) => radicalGridElement(k.toString())),
...RADICALS
.map(
(key, value) => MapEntry(
key,
value
.where((r) => allowedToggles[r]!)
.where((r) => !radicalToggles[r]! && allowedToggles[r]!)
.map((r) => radicalGridElement(r))
.toList()
..insert(0, radicalGridElement(key.toString(), isNumber: true)),
@@ -141,7 +149,8 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
];
Widget kanjiGridElement(String kanji) {
const color = LightTheme.defaultMenuGreyNormal;
// const color = LightTheme.defaultMenuGreyNormal;
final colors = lightTheme.extension<MenuGreyNormalThemeExtension>()!;
return InkWell(
onTap: () => Navigator.popAndPushNamed(
context,
@@ -151,12 +160,12 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
child: Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(5)),
color: color.background,
color: colors.backgroundColor,
),
alignment: Alignment.center,
child: Text(
kanji,
style: TextStyle(color: color.foreground, fontSize: fontSize),
style: TextStyle(color: colors.foregroundColor, fontSize: fontSize),
),
),
);
@@ -164,6 +173,8 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<MenuGreyNormalThemeExtension>()!;
return Scaffold(
appBar: AppBar(title: const Text('Choose by radicals')),
body: DefaultTextStyle.merge(
@@ -173,13 +184,11 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
Expanded(
child: (suggestions.isEmpty)
? Center(
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) => Text(
'Toggle a radical to start',
style: TextStyle(
fontSize: fontSize * 0.8,
color: state.theme.menuGreyNormal.background,
),
child: Text(
'Toggle a radical to start',
style: TextStyle(
fontSize: fontSize * 0.8,
color: colors.backgroundColor,
),
),
)
@@ -194,7 +203,7 @@ class _KanjiRadicalSearchState extends State<KanjiRadicalSearch> {
),
),
Divider(
color: AppTheme.mugitenWheat.background,
color: mugitenWheatBackground,
thickness: 3,
height: 30,
indent: 5,

View File

@@ -1,15 +1,15 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get_it/get_it.dart';
import 'package:infinite_scroll_pagination/infinite_scroll_pagination.dart';
import 'package:jadb/models/word_search/word_search_result.dart';
import 'package:jadb/search.dart' show JaDBConnection;
import 'package:mdi/mdi.dart';
import 'package:mugiten/bloc/theme/theme_bloc.dart';
import 'package:mugiten/components/search/search_results_body/parts/circle_badge.dart';
import 'package:mugiten/models/history_entry.dart';
import 'package:mugiten/services/datetime.dart';
import 'package:mugiten/services/snackbar.dart';
import 'package:mugiten/settings.dart';
import 'package:mugiten/theme.dart';
import 'package:sqflite/sqflite.dart';
import '../../components/search/search_results_body/search_card.dart';
@@ -82,9 +82,10 @@ class _WordSearchResultPageState extends State<WordSearchResultPage> {
@override
Widget build(BuildContext context) {
final colors = Theme.of(context).extension<MenuGreyNormalThemeExtension>()!;
return Scaffold(
appBar: AppBar(
title: Text('Search'),
title: Text('"${widget.searchTerm}"'),
actions: [
if (incognitoModeEnabled)
IconButton(
@@ -95,9 +96,30 @@ class _WordSearchResultPageState extends State<WordSearchResultPage> {
if (historyEntry != null && historyEntry!.timestampCount > 1)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, themeState) => CircleBadge(
color: themeState.theme.menuGreyNormal.background,
child: GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Scaffold(
appBar: AppBar(title: const Text('Last searched')),
body: ListView(
children: historyEntry!.timestamps
.map(
(ts) => ListTile(
title: Text(
'${formatDate(ts)} ${formatTime(ts)}',
),
),
)
.toList(),
),
),
),
);
},
child: CircleBadge(
color: colors.backgroundColor!,
child: Text('${historyEntry!.timestampCount}'),
),
),

View File

@@ -2,20 +2,18 @@ import 'dart:io';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:flutter_settings_ui/flutter_settings_ui.dart';
import 'package:get_it/get_it.dart';
import 'package:mdi/mdi.dart';
import 'package:mugiten/bloc/theme/theme_bloc.dart';
import 'package:mugiten/components/common/denshi_jisho_background.dart';
import 'package:mugiten/database/history/table_names.dart';
import 'package:mugiten/main.dart';
import 'package:mugiten/models/history_entry.dart';
import 'package:mugiten/models/themes/theme.dart';
import 'package:mugiten/routing/routes.dart';
import 'package:mugiten/services/data_export_import.dart';
import 'package:mugiten/services/snackbar.dart';
import 'package:mugiten/settings.dart';
import 'package:mugiten/theme.dart';
import 'package:sqflite/sqlite_api.dart';
import 'package:url_launcher/url_launcher.dart';
@@ -31,26 +29,23 @@ class _SettingsViewState extends State<SettingsView> {
bool dataExportIsLoading = false;
bool dataImportIsLoading = false;
Future<bool> confirm(
BuildContext context, {
required Widget content,
}) async {
Future<bool> confirm(BuildContext context, {required Widget content}) async {
return await showDialog<bool>(
context: context,
builder: (context) => AlertDialog(
content: content,
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Cancel'),
context: context,
builder: (context) => AlertDialog(
content: content,
actions: <Widget>[
TextButton(
onPressed: () => Navigator.pop(context, false),
child: const Text('Cancel'),
),
TextButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('OK'),
),
],
),
TextButton(
onPressed: () => Navigator.pop(context, true),
child: const Text('OK'),
),
],
),
) ??
) ??
false;
}
@@ -76,19 +71,6 @@ class _SettingsViewState extends State<SettingsView> {
showSnackbar(context, 'Cleared history');
}
// ignore: avoid_positional_boolean_parameters
void toggleAutoTheme(bool b) {
final bool newThemeIsDark = b
? WidgetsBinding.instance.window.platformBrightness == Brightness.dark
: darkThemeEnabled;
BlocProvider.of<ThemeBloc>(
context,
).add(SetTheme(themeIsDark: newThemeIsDark));
setState(() => autoThemeEnabled = b);
}
Future<void> changeFont(BuildContext context) async {
final int? i = await _chooseFromList(
list: [for (final font in JapaneseFont.values) font.name],
@@ -187,188 +169,175 @@ class _SettingsViewState extends State<SettingsView> {
);
@override
Widget build(BuildContext context) => BlocBuilder<ThemeBloc, ThemeState>(
builder: (context, state) {
final TextStyle titleTextStyle = TextStyle(
color: state is DarkThemeState
? AppTheme.mugitenWheat.background
: null,
);
return SettingsList(
// backgroundColor: Colors.transparent,
contentPadding: const EdgeInsets.symmetric(vertical: 10),
sections: <SettingsSection>[
SettingsSection(
title: Text('Dictionary', style: titleTextStyle),
// titleTextStyle: _titleTextStyle,
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: const Text('Romaji mode'),
description: const Text(
'Display romaji instead of kana for word readings',
),
leading: const Icon(Mdi.alphabetical),
onToggle: (b) => setState(() => romajiEnabled = b),
initialValue: romajiEnabled,
// theme: theme,
activeSwitchColor: AppTheme.mugitenWheat.background,
),
SettingsTile(
title: const Text('Japanese font'),
leading: const Icon(Icons.format_size),
onPressed: changeFont,
// theme: theme,
trailing: Text(japaneseFont.name),
// subtitle:
// 'Which font to use for japanese text. This might be useful if your phone shows kanji with a Chinese font.',
// subtitleMaxLines: 3,
),
],
),
SettingsSection(
title: Text('Theme', style: titleTextStyle),
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: const Text('Automatic theme'),
description: const Text('Let theme be determined by system'),
leading: const Icon(Icons.brightness_auto),
onToggle: toggleAutoTheme,
initialValue: autoThemeEnabled,
// theme: theme,
activeSwitchColor: AppTheme.mugitenWheat.background,
),
SettingsTile.switchTile(
title: const Text('Dark Theme'),
leading: const Icon(Icons.dark_mode),
onToggle: (b) {
BlocProvider.of<ThemeBloc>(
context,
).add(SetTheme(themeIsDark: b));
setState(() => darkThemeEnabled = b);
},
initialValue: darkThemeEnabled,
enabled: !autoThemeEnabled,
// theme: theme,
activeSwitchColor: AppTheme.mugitenWheat.background,
),
],
),
SettingsSection(
title: Text('Data', style: titleTextStyle),
tiles: <SettingsTile>[
SettingsTile(
enabled: true,
leading: const Icon(Icons.file_upload),
title: const Text('Import Data'),
description: const Text('Import user data from a file'),
onPressed: importHandler,
value: dataImportIsLoading
? const LinearProgressIndicator()
: null,
),
SettingsTile(
enabled: true,
leading: const Icon(Icons.file_download),
title: const Text('Export Data'),
description: const Text('Export user data to a file'),
onPressed: exportHandler,
value: dataExportIsLoading
? const LinearProgressIndicator()
: null,
),
SettingsTile(
enabled: true,
leading: const Icon(Icons.delete),
title: const Text(
'Clear History',
style: TextStyle(color: Colors.red),
),
description: const Text('Delete all search history'),
onPressed: clearHistory,
),
],
),
SettingsSection(
title: Text('Misc', style: titleTextStyle),
tiles: <SettingsTile>[
SettingsTile.switchTile(
leading: const Icon(Mdi.incognito),
title: const Text('Disable history tracking'),
description: const Text(
'Useful for reviewing history for library lists without cluttering the order',
),
onToggle: (b) => setState(() => incognitoModeEnabled = b),
initialValue: incognitoModeEnabled,
activeSwitchColor: AppTheme.mugitenWheat.background,
),
SettingsTile.switchTile(
leading: const Icon(Icons.close_fullscreen),
title: const Text('Shrink kanji drawing board'),
description: const Text(
'Useful if you keep accidentally activating system gestures',
),
onToggle: (b) =>
setState(() => reduceKanjiDrawingBoardSize = b),
initialValue: reduceKanjiDrawingBoardSize,
activeSwitchColor: AppTheme.mugitenWheat.background,
),
SettingsTile(
enabled: true,
leading: const Icon(Icons.cached),
title: const Text(
'Reinitialize application',
style: TextStyle(color: Colors.red),
),
description: const Text(
'Reinstall dictionary data and set up internal workings anew',
),
onPressed: (_) async {
if (!await confirm(
context,
content: const Text(
'Are you sure you want to reinitialize the application?',
),
)) {
return;
}
GetIt.instance.get<Database>().close();
GetIt.instance.reset();
runInitializationScreen(true);
},
),
],
),
SettingsSection(
title: Text('Info', style: titleTextStyle),
tiles: <SettingsTile>[
SettingsTile(
leading: const Icon(Icons.copyright),
title: const Text('About'),
description: const Text(
'Information about Mugiten and licenses used',
),
onPressed: (c) =>
Navigator.pushNamed(context, Routes.aboutLicenses),
),
SettingsTile(
leading: const Icon(Icons.notes),
title: const Text('Changelog'),
onPressed: (c) =>
Navigator.pushNamed(context, Routes.aboutChangelog),
),
SettingsTile(
leading: const Icon(Mdi.git),
title: const Text('Repository'),
description: const Text('https://git.pvv.ntnu.no/mugiten'),
onPressed: (c) =>
launchUrl(Uri.parse('https://git.pvv.ntnu.no/mugiten')),
),
],
),
],
);
},
Widget build(BuildContext context) => SettingsList(
lightTheme: SettingsThemeData(
settingsListBackground: Theme.of(context).scaffoldBackgroundColor,
),
darkTheme: SettingsThemeData(
settingsListBackground: Theme.of(context).scaffoldBackgroundColor,
titleTextColor: mugitenWheatBackground,
),
contentPadding: const EdgeInsets.symmetric(vertical: 10),
sections: _sections(context),
);
List<SettingsSection> _sections(BuildContext context) => [
SettingsSection(
title: const Text('Dictionary'),
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: const Text('Romaji mode'),
description: const Text(
'Display romaji instead of kana for word readings',
),
leading: const Icon(Mdi.alphabetical),
onToggle: (b) => setState(() => romajiEnabled = b),
initialValue: romajiEnabled,
activeSwitchColor: mugitenWheatBackground,
),
SettingsTile(
title: const Text('Japanese font'),
leading: const Icon(Icons.format_size),
onPressed: changeFont,
trailing: Text(japaneseFont.name),
// subtitle:
// 'Which font to use for japanese text. This might be useful if your phone shows kanji with a Chinese font.',
// subtitleMaxLines: 3,
),
],
),
SettingsSection(
title: const Text('Theme'),
tiles: <SettingsTile>[
SettingsTile.switchTile(
title: const Text('Automatic theme'),
description: const Text('Let theme be determined by system'),
leading: const Icon(Icons.brightness_auto),
onToggle: (b) {
setState(() => autoThemeEnabled = b);
GetIt.instance.get<ThemeController>().updateThemeMode();
},
initialValue: autoThemeEnabled,
activeSwitchColor: mugitenWheatBackground,
),
SettingsTile.switchTile(
title: const Text('Dark Theme'),
leading: const Icon(Icons.dark_mode),
onToggle: (b) {
setState(() => darkThemeEnabled = b);
GetIt.instance.get<ThemeController>().updateThemeMode();
},
initialValue: darkThemeEnabled,
enabled: !autoThemeEnabled,
activeSwitchColor: mugitenWheatBackground,
),
],
),
SettingsSection(
title: const Text('Data'),
tiles: <SettingsTile>[
SettingsTile(
enabled: true,
leading: const Icon(Icons.file_upload),
title: const Text('Import Data'),
description: const Text('Import user data from a file'),
onPressed: importHandler,
value: dataImportIsLoading ? const LinearProgressIndicator() : null,
),
SettingsTile(
enabled: true,
leading: const Icon(Icons.file_download),
title: const Text('Export Data'),
description: const Text('Export user data to a file'),
onPressed: exportHandler,
value: dataExportIsLoading ? const LinearProgressIndicator() : null,
),
SettingsTile(
enabled: true,
leading: const Icon(Icons.delete),
title: const Text(
'Clear History',
style: TextStyle(color: Colors.red),
),
description: const Text('Delete all search history'),
onPressed: clearHistory,
),
],
),
SettingsSection(
title: const Text('Misc'),
tiles: <SettingsTile>[
SettingsTile.switchTile(
leading: const Icon(Mdi.incognito),
title: const Text('Disable history tracking'),
description: const Text(
'Useful for reviewing history for library lists without cluttering the order',
),
onToggle: (b) => setState(() => incognitoModeEnabled = b),
initialValue: incognitoModeEnabled,
activeSwitchColor: mugitenWheatBackground,
),
SettingsTile.switchTile(
leading: const Icon(Icons.close_fullscreen),
title: const Text('Shrink kanji drawing board'),
description: const Text(
'Useful if you keep accidentally activating system gestures',
),
onToggle: (b) => setState(() => reduceKanjiDrawingBoardSize = b),
initialValue: reduceKanjiDrawingBoardSize,
activeSwitchColor: mugitenWheatBackground,
),
SettingsTile(
enabled: true,
leading: const Icon(Icons.cached),
title: const Text(
'Reinitialize application',
style: TextStyle(color: Colors.red),
),
description: const Text(
'Reinstall dictionary data and set up internal workings anew',
),
onPressed: (_) async {
if (!await confirm(
context,
content: const Text(
'Are you sure you want to reinitialize the application?',
),
)) {
return;
}
GetIt.instance.get<Database>().close();
GetIt.instance.reset();
runInitializationScreen(true);
},
),
],
),
SettingsSection(
title: const Text('Info'),
tiles: <SettingsTile>[
SettingsTile(
leading: const Icon(Icons.copyright),
title: const Text('About'),
description: const Text(
'Information about Mugiten and licenses used',
),
onPressed: (c) => Navigator.pushNamed(context, Routes.aboutLicenses),
),
SettingsTile(
leading: const Icon(Icons.notes),
title: const Text('Changelog'),
onPressed: (c) => Navigator.pushNamed(context, Routes.aboutChangelog),
),
SettingsTile(
leading: const Icon(Mdi.git),
title: const Text('Repository'),
description: const Text('https://git.pvv.ntnu.no/mugiten'),
onPressed: (c) =>
launchUrl(Uri.parse('https://git.pvv.ntnu.no/mugiten')),
),
],
),
];
}

View File

@@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
void copyToClipboard(BuildContext context, String? clipboardContent) {
if (clipboardContent == null) {
ScaffoldMessenger.of(context).showSnackBar(
const SnackBar(
content: Text('No text to copy'),
duration: Duration(milliseconds: 500),
),
);
return;
}
Clipboard.setData(ClipboardData(text: clipboardContent));
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('Copied \'$clipboardContent\''),
duration: const Duration(milliseconds: 500),
),
);
}

View File

@@ -1,44 +1,73 @@
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:shared_preferences/shared_preferences.dart';
final SharedPreferences _prefs = GetIt.instance.get<SharedPreferences>();
enum JapaneseFont { none, droidSansJapanese, notoSansCJK, notoSerifCJK }
enum JapaneseFont {
system,
droidSansJapanese,
hinaMincho,
ibmPlexSansJP,
kleeOne,
kosugi,
mPlus2,
mPlusRounded1c,
notoSansJapanese,
notoSerifJapanese,
zenKurenaido,
}
extension Methods on JapaneseFont {
TextStyle get textStyle {
String? fontFamily;
switch (this) {
case JapaneseFont.droidSansJapanese:
fontFamily = 'Droid Sans Japanese';
break;
case JapaneseFont.notoSansCJK:
fontFamily = 'Noto Sans CJK';
break;
case JapaneseFont.notoSerifCJK:
fontFamily = 'Noto Serif CJK';
break;
case JapaneseFont.none:
TextStyle(fontFamily: 'Droid Sans Japanese');
case JapaneseFont.notoSansJapanese:
return GoogleFonts.notoSansJp();
case JapaneseFont.notoSerifJapanese:
return GoogleFonts.notoSerifJp();
case JapaneseFont.hinaMincho:
return GoogleFonts.hinaMincho();
case JapaneseFont.ibmPlexSansJP:
return GoogleFonts.ibmPlexSansJp();
case JapaneseFont.kleeOne:
return GoogleFonts.kleeOne();
case JapaneseFont.kosugi:
return GoogleFonts.kosugi();
case JapaneseFont.mPlus2:
return GoogleFonts.mPlus2();
case JapaneseFont.mPlusRounded1c:
return GoogleFonts.mPlusRounded1c();
case JapaneseFont.zenKurenaido:
return GoogleFonts.zenTokyoZoo();
case JapaneseFont.system:
}
return TextStyle(fontFamily: fontFamily);
return const TextStyle();
}
String get name =>
{
JapaneseFont.none: 'Default',
JapaneseFont.droidSansJapanese: 'Droid Sans Japanese',
JapaneseFont.notoSansCJK: 'Noto Sans CJK',
JapaneseFont.notoSerifCJK: 'Noto Serif CJK',
}[this] ??
'';
String get name => switch (this) {
JapaneseFont.system => 'System Default',
JapaneseFont.droidSansJapanese => 'Droid Sans Japanese',
JapaneseFont.notoSansJapanese => 'Noto Sans Japanese',
JapaneseFont.notoSerifJapanese => 'Noto Serif Japanese',
JapaneseFont.hinaMincho => 'Hina Mincho',
JapaneseFont.ibmPlexSansJP => 'IBM Plex Sans JP',
JapaneseFont.kleeOne => 'Klee One',
JapaneseFont.kosugi => 'Kosugi',
JapaneseFont.mPlus2 => 'M PLUS 2',
JapaneseFont.mPlusRounded1c => 'M PLUS Rounded 1c',
JapaneseFont.zenKurenaido => 'Zen Kurenaido',
};
}
const Map<String, dynamic> _defaults = {
'incognitoModeEnabled': false,
'romajiEnabled': false,
'darkThemeEnabled': false,
'autoThemeEnabled': false,
'autoThemeEnabled': true,
'japaneseFont': JapaneseFont.droidSansJapanese,
'reduceKanjiDrawingBoardSize': false,
};

371
lib/theme.dart Normal file
View File

@@ -0,0 +1,371 @@
import 'package:flutter/material.dart';
import 'package:mugiten/settings.dart';
class YomiThemeExtension extends ThemeExtension<YomiThemeExtension> {
final Color? onyomiColor;
final Color? kunyomiColor;
const YomiThemeExtension({this.onyomiColor, this.kunyomiColor});
@override
ThemeExtension<YomiThemeExtension> copyWith({
Color? onyomiColor,
Color? kunyomiColor,
}) => YomiThemeExtension(
onyomiColor: onyomiColor ?? this.onyomiColor,
kunyomiColor: kunyomiColor ?? this.kunyomiColor,
);
@override
ThemeExtension<YomiThemeExtension> lerp(
ThemeExtension<YomiThemeExtension>? other,
double t,
) => other is! YomiThemeExtension
? this
: YomiThemeExtension(
onyomiColor: Color.lerp(onyomiColor, other.onyomiColor, t),
kunyomiColor: Color.lerp(kunyomiColor, other.kunyomiColor, t),
);
}
abstract class ForegroundBackgroundThemeExtension<T extends ThemeExtension<T>>
extends ThemeExtension<T> {
final Color? foregroundColor;
final Color? backgroundColor;
const ForegroundBackgroundThemeExtension({
this.foregroundColor,
this.backgroundColor,
});
@override
ThemeExtension<T> copyWith({Color? foregroundColor, Color? backgroundColor});
@override
ThemeExtension<T> lerp(ThemeExtension<T>? other, double t) =>
other is! ForegroundBackgroundThemeExtension<T>
? this as T
: copyWith(
foregroundColor: Color.lerp(
foregroundColor,
other.foregroundColor,
t,
),
backgroundColor: Color.lerp(
backgroundColor,
other.backgroundColor,
t,
),
)
as T;
}
class KanjiResultThemeExtension
extends ForegroundBackgroundThemeExtension<KanjiResultThemeExtension> {
const KanjiResultThemeExtension({
super.foregroundColor,
super.backgroundColor,
});
@override
ThemeExtension<KanjiResultThemeExtension> copyWith({
Color? foregroundColor,
Color? backgroundColor,
}) => KanjiResultThemeExtension(
foregroundColor: foregroundColor ?? this.foregroundColor,
backgroundColor: backgroundColor ?? this.backgroundColor,
);
}
class MenuGreyLightThemeExtension
extends ForegroundBackgroundThemeExtension<MenuGreyLightThemeExtension> {
const MenuGreyLightThemeExtension({
super.foregroundColor,
super.backgroundColor,
});
@override
ThemeExtension<MenuGreyLightThemeExtension> copyWith({
Color? foregroundColor,
Color? backgroundColor,
}) => MenuGreyLightThemeExtension(
foregroundColor: foregroundColor ?? this.foregroundColor,
backgroundColor: backgroundColor ?? this.backgroundColor,
);
}
class MenuGreyNormalThemeExtension
extends ForegroundBackgroundThemeExtension<MenuGreyNormalThemeExtension> {
const MenuGreyNormalThemeExtension({
super.foregroundColor,
super.backgroundColor,
});
@override
ThemeExtension<MenuGreyNormalThemeExtension> copyWith({
Color? foregroundColor,
Color? backgroundColor,
}) => MenuGreyNormalThemeExtension(
foregroundColor: foregroundColor ?? this.foregroundColor,
backgroundColor: backgroundColor ?? this.backgroundColor,
);
}
class MenuGreyDarkThemeExtension
extends ForegroundBackgroundThemeExtension<MenuGreyDarkThemeExtension> {
const MenuGreyDarkThemeExtension({
super.foregroundColor,
super.backgroundColor,
});
@override
ThemeExtension<MenuGreyDarkThemeExtension> copyWith({
Color? foregroundColor,
Color? backgroundColor,
}) => MenuGreyDarkThemeExtension(
foregroundColor: foregroundColor ?? this.foregroundColor,
backgroundColor: backgroundColor ?? this.backgroundColor,
);
}
const Color mugitenWheatForeground = Colors.black;
const Color mugitenWheatBackground = Color(0xFFFFE680);
const Color mugitenGrey = Color(0xFF5A5A5B);
const Color mugitenLabelForeground = Colors.white;
const Color mugitenLabelBackground = Color(0xFF909DC0);
const Color mugitenCommonForeground = Colors.white;
const Color mugitenCommonBackground = Color(0xFF8ABC83);
/// Source: https://blog.usejournal.com/creating-a-custom-color-swatch-in-flutter-554bcdcb27f3
MaterialColor createMaterialColor(Color color) {
final List<double> strengths = [.05];
final swatch = <int, Color>{};
final int r = (color.r * 255.0).round().clamp(0, 255);
final int g = (color.g * 255.0).round().clamp(0, 255);
final int b = (color.b * 255.0).round().clamp(0, 255);
for (int i = 1; i < 10; i++) {
strengths.add(0.1 * i);
}
for (final strength in strengths) {
final double ds = 0.5 - strength;
swatch[(strength * 1000).round()] = Color.fromRGBO(
r + ((ds < 0 ? r : (255 - r)) * ds).round(),
g + ((ds < 0 ? g : (255 - g)) * ds).round(),
b + ((ds < 0 ? b : (255 - b)) * ds).round(),
1,
);
}
return MaterialColor(color.toARGB32(), swatch);
}
final ThemeData lightTheme = ThemeData(
brightness: Brightness.light,
useMaterial3: true,
primarySwatch: createMaterialColor(mugitenWheatBackground),
// colorScheme: ColorScheme.light(
// surface: Color(0xFFF2E6C9), // Pale Grain
// primary: Color(0xFFD8B25C), // Golden Wheat
// secondary: Color(0xFFC9A44C), // Straw
// error: Color(0xFFB5543C), // Clay Red
// onSurface: Color(0xFF3E3A2F),
// onPrimary: Color(0xFF3E3A2F),
// onSecondary: Color(0xFF3E3A2F),
// onError: Colors.white,
// ),
extensions: <ThemeExtension<dynamic>>[
const YomiThemeExtension(
onyomiColor: Color(0xFFFFA726), // Orange
kunyomiColor: Color(0xFF29B6F6), // Light Blue
),
const KanjiResultThemeExtension(
foregroundColor: Colors.white,
backgroundColor: Colors.blue,
),
MenuGreyLightThemeExtension(
foregroundColor: Colors.black,
backgroundColor: Colors.grey.shade300,
),
const MenuGreyNormalThemeExtension(
foregroundColor: Colors.white,
backgroundColor: Colors.grey,
),
MenuGreyDarkThemeExtension(
foregroundColor: Colors.white,
backgroundColor: Colors.grey.shade700,
),
],
// scaffoldBackgroundColor: const Color(0xFFFAF3E0),
// dividerColor: const Color(0xFFECE7DC), // Light gray (Chaff)
// textTheme: const TextTheme(
// bodyLarge: TextStyle(color: Color(0xFF3E3A2F)),
// bodyMedium: TextStyle(color: Color(0xFF6B6555)),
// labelLarge: TextStyle(color: Color(0xFF3E3A2F)),
// ),
// elevatedButtonTheme: ElevatedButtonThemeData(
// style: ElevatedButton.styleFrom(
// backgroundColor: const Color(0xFFD8B25C),
// foregroundColor: const Color(0xFF3E3A2F),
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
// ),
// ),
);
final ThemeData darkTheme = ThemeData(
brightness: Brightness.dark,
useMaterial3: true,
primarySwatch: createMaterialColor(mugitenWheatBackground),
// colorScheme: const ColorScheme.dark(
// surface: Color(0xFF2A2720), // Loam
// primary: Color(0xFFE3C77A), // Warm Wheat
// secondary: Color(0xFFC6A85A), // Toasted Grain
// error: Color(0xFFB5543C),
// onSurface: Color(0xFFF5EEDC),
// onPrimary: Color(0xFF1E1C17),
// onSecondary: Color(0xFF1E1C17),
// onError: Colors.black,
// ),
extensions: <ThemeExtension<dynamic>>[
const YomiThemeExtension(
onyomiColor: Color(0xFFFFA726),
kunyomiColor: Color(0xFF29B6F6),
),
const KanjiResultThemeExtension(
foregroundColor: Colors.white,
backgroundColor: Colors.green,
),
MenuGreyLightThemeExtension(
foregroundColor: Colors.white,
backgroundColor: Colors.grey.shade700,
),
const MenuGreyNormalThemeExtension(
foregroundColor: Colors.white,
backgroundColor: Colors.grey,
),
MenuGreyDarkThemeExtension(
foregroundColor: Colors.black,
backgroundColor: Colors.grey.shade300,
),
],
// scaffoldBackgroundColor: const Color(0xFF1E1C17),
// dividerColor: const Color(0xFF4A463B), // Dark gray (Charred Husk)
// textTheme: const TextTheme(
// bodyLarge: TextStyle(color: Color(0xFFF5EEDC)),
// bodyMedium: TextStyle(color: Color(0xFFCFC7B2)),
// labelLarge: TextStyle(color: Color(0xFFF5EEDC)),
// ),
// iconTheme: const IconThemeData(
// color: Color(0xFFD6D0C3), // Light gray (Moonlit Chaff)
// ),
// elevatedButtonTheme: ElevatedButtonThemeData(
// style: ElevatedButton.styleFrom(
// backgroundColor: const Color(0xFFE3C77A),
// foregroundColor: const Color(0xFF1E1C17),
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
// ),
// ),
);
enum AppThemeMode {
light,
dark,
system;
String get id => switch (this) {
AppThemeMode.light => 'light',
AppThemeMode.dark => 'dark',
AppThemeMode.system => 'system',
};
factory AppThemeMode.fromId(String id) => switch (id) {
'light' => AppThemeMode.light,
'dark' => AppThemeMode.dark,
'system' => AppThemeMode.system,
_ => throw ArgumentError('Invalid theme mode id: $id'),
};
ThemeData? get lightThemeData => switch (this) {
AppThemeMode.light => lightTheme,
AppThemeMode.dark => darkTheme,
AppThemeMode.system => lightTheme,
};
ThemeData? get darkThemeData => switch (this) {
AppThemeMode.light => lightTheme,
AppThemeMode.dark => darkTheme,
AppThemeMode.system => darkTheme,
};
ThemeMode get themeMode => switch (this) {
AppThemeMode.light => ThemeMode.light,
AppThemeMode.dark => ThemeMode.dark,
AppThemeMode.system => ThemeMode.system,
};
Brightness get brightness => switch (this) {
AppThemeMode.light => Brightness.light,
AppThemeMode.dark => Brightness.dark,
AppThemeMode.system =>
WidgetsBinding.instance.platformDispatcher.platformBrightness,
};
}
class ThemeController {
final ValueNotifier<AppThemeMode> themeMode;
ThemeController(AppThemeMode mode) : themeMode = ValueNotifier(mode);
factory ThemeController.create() {
AppThemeMode initialMode;
if (autoThemeEnabled) {
initialMode = AppThemeMode.system;
} else {
initialMode = darkThemeEnabled ? AppThemeMode.dark : AppThemeMode.light;
}
return ThemeController(initialMode);
}
void setThemeMode(AppThemeMode mode) {
if (mode != themeMode.value) {
if (mode == AppThemeMode.system) {
autoThemeEnabled = true;
} else {
autoThemeEnabled = false;
darkThemeEnabled = mode == AppThemeMode.dark;
}
themeMode.value = mode;
}
}
void updateThemeMode() {
if (autoThemeEnabled) {
final platformBrightness =
WidgetsBinding.instance.platformDispatcher.platformBrightness;
themeMode.value = platformBrightness == Brightness.dark
? AppThemeMode.dark
: AppThemeMode.light;
} else {
themeMode.value = darkThemeEnabled
? AppThemeMode.dark
: AppThemeMode.light;
}
}
}

View File

@@ -21,10 +21,10 @@ packages:
dependency: "direct main"
description:
name: archive
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
sha256: a96e8b390886ee8abb49b7bd3ac8df6f451c621619f52a26e815fdcf568959ff
url: "https://pub.dev"
source: hosted
version: "4.0.7"
version: "4.0.9"
args:
dependency: transitive
description:
@@ -34,21 +34,29 @@ packages:
source: hosted
version: "2.7.0"
async:
dependency: transitive
dependency: "direct main"
description:
name: async
sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb"
url: "https://pub.dev"
source: hosted
version: "2.13.0"
bisection:
dependency: transitive
description:
name: bisection
sha256: "207d68e5168529adb5388c8cbb815a0cb00f51e3efc0c41c8ea91fd38ae6a357"
url: "https://pub.dev"
source: hosted
version: "0.4.3+1"
bloc:
dependency: transitive
description:
name: bloc
sha256: "52c10575f4445c61dd9e0cafcc6356fdd827c4c64dd7945ef3c4105f6b6ac189"
sha256: a48653a82055a900b88cd35f92429f068c5a8057ae9b136d197b3d56c57efb81
url: "https://pub.dev"
source: hosted
version: "9.0.0"
version: "9.2.0"
boolean_selector:
dependency: transitive
description:
@@ -61,10 +69,10 @@ packages:
dependency: transitive
description:
name: characters
sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803
sha256: faf38497bda5ead2a8c7615f4f7939df04333478bf32e4173fcb06d428b5716b
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.4.1"
checked_yaml:
dependency: transitive
description:
@@ -89,6 +97,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.2"
code_assets:
dependency: transitive
description:
name: code_assets
sha256: "83ccdaa064c980b5596c35dd64a8d3ecc68620174ab9b90b6343b753aa721687"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
collection:
dependency: "direct main"
description:
@@ -101,18 +117,18 @@ packages:
dependency: transitive
description:
name: cross_file
sha256: "7caf6a750a0c04effbb52a676dce9a4a592e10ad35c34d6d2d0e4811160d5670"
sha256: "28bb3ae56f117b5aec029d702a90f57d285cd975c3c5c281eaca38dbc47c5937"
url: "https://pub.dev"
source: hosted
version: "0.3.4+2"
version: "0.3.5+2"
crypto:
dependency: transitive
description:
name: crypto
sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855"
sha256: c8ea0233063ba03258fbcf2ca4d6dadfefe14f02fab57702265467a19f27fadf
url: "https://pub.dev"
source: hosted
version: "3.0.6"
version: "3.0.7"
csslib:
dependency: transitive
description:
@@ -125,10 +141,10 @@ packages:
dependency: transitive
description:
name: csv
sha256: c6aa2679b2a18cb57652920f674488d89712efaf4d3fdf2e537215b35fc19d6c
sha256: bef2950f7a753eb82f894a2eabc3072e73cf21c17096296a5a992797e50b1d0d
url: "https://pub.dev"
source: hosted
version: "6.0.0"
version: "7.1.0"
cupertino_icons:
dependency: "direct main"
description:
@@ -137,6 +153,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.8"
dbus:
dependency: transitive
description:
name: dbus
sha256: d0c98dcd4f5169878b6cf8f6e0a52403a9dff371a3e2f019697accbf6f44a270
url: "https://pub.dev"
source: hosted
version: "0.7.12"
division:
dependency: "direct main"
description:
@@ -149,10 +173,10 @@ packages:
dependency: transitive
description:
name: equatable
sha256: "567c64b3cb4cf82397aac55f4f0cbd3ca20d77c6c03bedbc4ceaddc08904aef7"
sha256: "3e0141505477fd8ad55d6eb4e7776d3fe8430be8e497ccb1521370c3f21a3e2b"
url: "https://pub.dev"
source: hosted
version: "2.0.7"
version: "2.0.8"
fake_async:
dependency: transitive
description:
@@ -165,10 +189,10 @@ packages:
dependency: transitive
description:
name: ffi
sha256: "289279317b4b16eb2bb7e271abccd4bf84ec9bdcbe999e278a94b804f5630418"
sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45"
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.2.0"
file:
dependency: transitive
description:
@@ -181,10 +205,10 @@ packages:
dependency: "direct main"
description:
name: file_picker
sha256: ef9908739bdd9c476353d6adff72e88fd00c625f5b959ae23f7567bd5137db0a
sha256: "57d9a1dd5063f85fa3107fb42d1faffda52fdc948cefd5fe5ea85267a5fc7343"
url: "https://pub.dev"
source: hosted
version: "10.2.0"
version: "10.3.10"
fixnum:
dependency: transitive
description:
@@ -234,26 +258,26 @@ packages:
dependency: "direct main"
description:
name: flutter_markdown_plus
sha256: fe74214c5ac2f850d93efda290dcde3f18006e90a87caa9e3e6c13222a5db4de
sha256: "039177906850278e8fb1cd364115ee0a46281135932fa8ecea8455522166d2de"
url: "https://pub.dev"
source: hosted
version: "1.0.3"
version: "1.0.7"
flutter_native_splash:
dependency: "direct dev"
description:
name: flutter_native_splash
sha256: "8321a6d11a8d13977fa780c89de8d257cce3d841eecfb7a4cadffcc4f12d82dc"
sha256: "4fb9f4113350d3a80841ce05ebf1976a36de622af7d19aca0ca9a9911c7ff002"
url: "https://pub.dev"
source: hosted
version: "2.4.6"
version: "2.4.7"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: f948e346c12f8d5480d2825e03de228d0eb8c3a737e4cdaa122267b89c022b5e
sha256: ee8068e0e1cd16c4a82714119918efdeed33b3ba7772c54b5d094ab53f9b7fd1
url: "https://pub.dev"
source: hosted
version: "2.0.28"
version: "2.0.33"
flutter_settings_ui:
dependency: "direct main"
description:
@@ -266,10 +290,10 @@ packages:
dependency: "direct main"
description:
name: flutter_slidable
sha256: ab7dbb16f783307c9d7762ede2593ce32c220ba2ba0fd540a3db8e9a3acba71a
sha256: ea369262929d3cc6ebf9d8a00c196127966f117fe433a5e5cb47fb08008ca203
url: "https://pub.dev"
source: hosted
version: "4.0.0"
version: "4.0.3"
flutter_staggered_grid_view:
dependency: transitive
description:
@@ -282,10 +306,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: cd57f7969b4679317c17af6fd16ee233c1e60a82ed209d8a475c54fd6fd6f845
sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.2.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -300,26 +324,50 @@ packages:
dependency: "direct main"
description:
name: get_it
sha256: f126a3e286b7f5b578bf436d5592968706c4c1de28a228b870ce375d9f743103
sha256: "568d62f0e68666fb5d95519743b3c24a34c7f19d834b0658c46e26d778461f66"
url: "https://pub.dev"
source: hosted
version: "8.0.3"
version: "9.2.1"
glob:
dependency: transitive
description:
name: glob
sha256: c3f1ee72c96f8f78935e18aa8cecced9ab132419e8625dc187e1c2408efc20de
url: "https://pub.dev"
source: hosted
version: "2.1.3"
google_fonts:
dependency: "direct main"
description:
name: google_fonts
sha256: db9df7a5898d894eeda4c78143f35c30a243558be439518972366880b80bf88e
url: "https://pub.dev"
source: hosted
version: "8.0.2"
google_mlkit_commons:
dependency: transitive
description:
name: google_mlkit_commons
sha256: "8f40fbac10685cad4715d11e6a0d86837d9ad7168684dfcad29610282a88e67a"
sha256: "3e69fea4211727732cc385104e675ad1e40b29f12edd492ee52fa108423a6124"
url: "https://pub.dev"
source: hosted
version: "0.11.0"
version: "0.11.1"
google_mlkit_digital_ink_recognition:
dependency: "direct main"
description:
name: google_mlkit_digital_ink_recognition
sha256: "8d2b89401bdeeba97158377167429dbc5cb339ebbd21e0889dca773f1c79a884"
sha256: e841430c7c18e2d82d109914342bccf56084db080b1a997b66b6dac01200ee13
url: "https://pub.dev"
source: hosted
version: "0.14.1"
version: "0.14.2"
hooks:
dependency: transitive
description:
name: hooks
sha256: "7a08a0d684cb3b8fb604b78455d5d352f502b68079f7b80b831c62220ab0a4f6"
url: "https://pub.dev"
source: hosted
version: "1.0.1"
html:
dependency: transitive
description:
@@ -332,10 +380,10 @@ packages:
dependency: "direct main"
description:
name: http
sha256: "2c11f3f94c687ee9bad77c171151672986360b2b001d109814ee7140b2cf261b"
sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412"
url: "https://pub.dev"
source: hosted
version: "1.4.0"
version: "1.6.0"
http_parser:
dependency: transitive
description:
@@ -348,75 +396,92 @@ packages:
dependency: transitive
description:
name: image
sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928"
sha256: f9881ff4998044947ec38d098bc7c8316ae1186fa786eddffdb867b9bc94dfce
url: "https://pub.dev"
source: hosted
version: "4.5.4"
version: "4.8.0"
infinite_scroll_pagination:
dependency: "direct main"
description:
name: infinite_scroll_pagination
sha256: "9b8f95362928a1de835658835194b435c40f2bfc386f6545c1fd706203df0cd4"
sha256: b0d28e37cd8f62490ff6aef63f9db93d4c78b7f11b7c6b26f33c69d8476fda78
url: "https://pub.dev"
source: hosted
version: "5.1.0"
version: "5.1.1"
jadb:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "2803db9c124c05d75f6e352026e26bac8a1ecfb2"
url: "https://git.pvv.ntnu.no/oysteikt/jadb.git"
resolved-ref: "48f50628a1a79689b7eb1bf7272b08c91036d2b3"
url: "https://git.pvv.ntnu.no/mugiten/jadb.git"
source: git
version: "1.0.0"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1"
sha256: cb09e7dac6210041fad964ed7fbee004f14258b4eca4040f72d1234062ace4c8
url: "https://pub.dev"
source: hosted
version: "4.9.0"
version: "4.11.0"
kanimaji:
dependency: "direct main"
description:
path: "."
ref: HEAD
resolved-ref: "89652c401fe6d89348d537bddb52a851d1dbfed5"
url: "https://git.pvv.ntnu.no/mugiten/kanimaji-dart.git"
source: git
version: "0.0.1"
l10n_languages:
dependency: transitive
description:
name: l10n_languages
sha256: "2360da28a5e2d9eaec5ac93151f27b2173338871b5486f757d088fc92a3a2b62"
sha256: "16b0026dc7261a712d3176595e7622138dace92e9cf1efc00989ef45b47725dd"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
version: "2.0.2"
leak_tracker:
dependency: transitive
description:
name: leak_tracker
sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0"
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
url: "https://pub.dev"
source: hosted
version: "10.0.9"
version: "11.0.2"
leak_tracker_flutter_testing:
dependency: transitive
description:
name: leak_tracker_flutter_testing
sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573
sha256: "1dbc140bb5a23c75ea9c4811222756104fbcd1a27173f0c34ca01e16bea473c1"
url: "https://pub.dev"
source: hosted
version: "3.0.9"
version: "3.0.10"
leak_tracker_testing:
dependency: transitive
description:
name: leak_tracker_testing
sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
sha256: "8d5a2d49f4a66b49744b23b018848400d23e54caf9463f4eb20df3eb8acb2eb1"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
lints:
dependency: transitive
description:
name: lints
sha256: a5e2b223cb7c9c8efdc663ef484fdd95bb243bff242ef5b13e26883547fce9a0
sha256: "12f842a479589fea194fe5c5a3095abc7be0c1f2ddfa9a0e76aed1dbd26a87df"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
version: "6.1.0"
logging:
dependency: transitive
description:
name: logging
sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61
url: "https://pub.dev"
source: hosted
version: "1.3.0"
markdown:
dependency: "direct main"
description:
@@ -429,18 +494,18 @@ packages:
dependency: transitive
description:
name: matcher
sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
url: "https://pub.dev"
source: hosted
version: "0.12.17"
version: "0.12.18"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec
sha256: "9c337007e82b1889149c82ed242ed1cb24a66044e30979c44912381e9be4c48b"
url: "https://pub.dev"
source: hosted
version: "0.11.1"
version: "0.13.0"
mdi:
dependency: "direct main"
description:
@@ -453,10 +518,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
url: "https://pub.dev"
source: hosted
version: "1.16.0"
version: "1.17.0"
mime:
dependency: transitive
description:
@@ -465,6 +530,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.0"
native_toolchain_c:
dependency: transitive
description:
name: native_toolchain_c
sha256: "89e83885ba09da5fdf2cdacc8002a712ca238c28b7f717910b34bcd27b0d03ac"
url: "https://pub.dev"
source: hosted
version: "0.17.4"
nested:
dependency: transitive
description:
@@ -473,22 +546,30 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.0"
objective_c:
dependency: transitive
description:
name: objective_c
sha256: "100a1c87616ab6ed41ec263b083c0ef3261ee6cd1dc3b0f35f8ddfa4f996fe52"
url: "https://pub.dev"
source: hosted
version: "9.3.0"
package_info_plus:
dependency: "direct main"
description:
name: package_info_plus
sha256: "7976bfe4c583170d6cdc7077e3237560b364149fcd268b5f53d95a991963b191"
sha256: f69da0d3189a4b4ceaeb1a3defb0f329b3b352517f52bed4290f83d4f06bc08d
url: "https://pub.dev"
source: hosted
version: "8.3.0"
version: "9.0.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "6c935fb612dff8e3cc9632c2b301720c77450a126114126ffaafe28d2e87956c"
sha256: "202a487f08836a592a6bd4f901ac69b3a8f146af552bbd14407b6b41e1c3f086"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "3.2.1"
path:
dependency: "direct main"
description:
@@ -517,18 +598,18 @@ packages:
dependency: transitive
description:
name: path_provider_android
sha256: d0d310befe2c8ab9e7f393288ccbb11b60c019c6b5afc21973eeee4dda2b35e9
sha256: f2c65e21139ce2c3dad46922be8272bb5963516045659e71bb16e151c93b580e
url: "https://pub.dev"
source: hosted
version: "2.2.17"
version: "2.2.22"
path_provider_foundation:
dependency: transitive
description:
name: path_provider_foundation
sha256: "4843174df4d288f5e29185bd6e72a6fbdf5a4a4602717eed565497429f179942"
sha256: "2a376b7d6392d80cd3705782d2caa734ca4727776db0b6ec36ef3f1855197699"
url: "https://pub.dev"
source: hosted
version: "2.4.1"
version: "2.6.0"
path_provider_linux:
dependency: transitive
description:
@@ -557,10 +638,10 @@ packages:
dependency: transitive
description:
name: petitparser
sha256: "07c8f0b1913bcde1ff0d26e57ace2f3012ccbf2b204e070290dad3bb22797646"
sha256: "91bd59303e9f769f108f8df05e371341b15d59e995e6806aefab827b58336675"
url: "https://pub.dev"
source: hosted
version: "6.1.0"
version: "7.0.2"
platform:
dependency: transitive
description:
@@ -581,18 +662,26 @@ packages:
dependency: transitive
description:
name: posix
sha256: "6323a5b0fa688b6a010df4905a56b00181479e6d10534cecfecede2aa55add61"
sha256: "185ef7606574f789b40f289c233efa52e96dead518aed988e040a10737febb07"
url: "https://pub.dev"
source: hosted
version: "6.0.3"
version: "6.5.0"
provider:
dependency: transitive
description:
name: provider
sha256: "4abbd070a04e9ddc287673bf5a030c7ca8b685ff70218720abab8b092f53dd84"
sha256: "4e82183fa20e5ca25703ead7e05de9e4cceed1fbd1eadc1ac3cb6f565a09f272"
url: "https://pub.dev"
source: hosted
version: "6.1.5"
version: "6.1.5+1"
pub_semver:
dependency: transitive
description:
name: pub_semver
sha256: "5bfcf68ca79ef689f8990d1160781b4bad40a3bd5e5218ad4076ddb7f4081585"
url: "https://pub.dev"
source: hosted
version: "2.2.0"
ruby_text:
dependency: "direct main"
description:
@@ -605,50 +694,50 @@ packages:
dependency: "direct main"
description:
name: sealed_languages
sha256: cd8b4b6ee911b00a95a5f760fa51527497e23a35b120f8ed50442b17a4524ec8
sha256: bf7a479389196ae29a074a8451734a71d11282f5380bd72e07d339047b011a29
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "3.0.1"
share_plus:
dependency: "direct main"
description:
name: share_plus
sha256: b2961506569e28948d75ec346c28775bb111986bb69dc6a20754a457e3d97fa0
sha256: "14c8860d4de93d3a7e53af51bff479598c4e999605290756bbbe45cf65b37840"
url: "https://pub.dev"
source: hosted
version: "11.0.0"
version: "12.0.1"
share_plus_platform_interface:
dependency: transitive
description:
name: share_plus_platform_interface
sha256: "1032d392bc5d2095a77447a805aa3f804d2ae6a4d5eef5e6ebb3bd94c1bc19ef"
sha256: "88023e53a13429bd65d8e85e11a9b484f49d4c190abbd96c7932b74d6927cc9a"
url: "https://pub.dev"
source: hosted
version: "6.0.0"
version: "6.1.0"
shared_preferences:
dependency: "direct main"
description:
name: shared_preferences
sha256: "6e8bf70b7fef813df4e9a36f658ac46d107db4b4cfe1048b477d4e453a8159f5"
sha256: "2939ae520c9024cb197fc20dee269cd8cdbf564c8b5746374ec6cacdc5169e64"
url: "https://pub.dev"
source: hosted
version: "2.5.3"
version: "2.5.4"
shared_preferences_android:
dependency: transitive
description:
name: shared_preferences_android
sha256: "20cbd561f743a342c76c151d6ddb93a9ce6005751e7aa458baad3858bfbfb6ac"
sha256: cbc40be9be1c5af4dab4d6e0de4d5d3729e6f3d65b89d21e1815d57705644a6f
url: "https://pub.dev"
source: hosted
version: "2.4.10"
version: "2.4.20"
shared_preferences_foundation:
dependency: transitive
description:
name: shared_preferences_foundation
sha256: "6a52cfcdaeac77cad8c97b539ff688ccfc458c007b4db12be584fbe5c0e49e03"
sha256: "4e7eaffc2b17ba398759f1151415869a34771ba11ebbccd1b0145472a619a64f"
url: "https://pub.dev"
source: hosted
version: "2.5.4"
version: "2.5.6"
shared_preferences_linux:
dependency: transitive
description:
@@ -706,18 +795,10 @@ packages:
dependency: transitive
description:
name: source_span
sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c"
sha256: "56a02f1f4cd1a2d96303c0144c93bd6d909eea6bee6bf5a0e0b685edbd4c47ab"
url: "https://pub.dev"
source: hosted
version: "1.10.1"
sprintf:
dependency: transitive
description:
name: sprintf
sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "1.10.2"
sqflite:
dependency: "direct main"
description:
@@ -730,26 +811,26 @@ packages:
dependency: transitive
description:
name: sqflite_android
sha256: "2b3070c5fa881839f8b402ee4a39c1b4d561704d4ebbbcfb808a119bc2a1701b"
sha256: ecd684501ebc2ae9a83536e8b15731642b9570dc8623e0073d227d0ee2bfea88
url: "https://pub.dev"
source: hosted
version: "2.4.1"
version: "2.4.2+2"
sqflite_common:
dependency: transitive
description:
name: sqflite_common
sha256: "84731e8bfd8303a3389903e01fb2141b6e59b5973cacbb0929021df08dddbe8b"
sha256: "6ef422a4525ecc601db6c0a2233ff448c731307906e92cabc9ba292afaae16a6"
url: "https://pub.dev"
source: hosted
version: "2.5.5"
version: "2.5.6"
sqflite_common_ffi:
dependency: "direct main"
description:
name: sqflite_common_ffi
sha256: "9faa2fedc5385ef238ce772589f7718c24cdddd27419b609bb9c6f703ea27988"
sha256: c59fcdc143839a77581f7a7c4de018e53682408903a0a0800b95ef2dc4033eff
url: "https://pub.dev"
source: hosted
version: "2.3.6"
version: "2.4.0+2"
sqflite_darwin:
dependency: transitive
description:
@@ -767,21 +848,21 @@ packages:
source: hosted
version: "2.4.0"
sqlite3:
dependency: transitive
dependency: "direct main"
description:
name: sqlite3
sha256: "608b56d594e4c8498c972c8f1507209f9fd74939971b948ddbbfbfd1c9cb3c15"
sha256: b7cf6b37667f6a921281797d2499ffc60fb878b161058d422064f0ddc78f6aa6
url: "https://pub.dev"
source: hosted
version: "2.7.7"
version: "3.1.6"
sqlite3_flutter_libs:
dependency: "direct main"
description:
name: sqlite3_flutter_libs
sha256: "8b4bd239bedd20ee628aed587b4c5b387328e85945c9ecbae19a93bdcd171524"
sha256: "3ed7553eee7bb368f8950f58ba29f634e06e813c029aff6a0d60862b96de8454"
url: "https://pub.dev"
source: hosted
version: "0.5.36"
version: "0.6.0+eol"
stack_trace:
dependency: transitive
description:
@@ -826,10 +907,10 @@ packages:
dependency: transitive
description:
name: test_api
sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
url: "https://pub.dev"
source: hosted
version: "0.7.4"
version: "0.7.9"
tuple:
dependency: transitive
description:
@@ -850,10 +931,10 @@ packages:
dependency: transitive
description:
name: universal_io
sha256: "1722b2dcc462b4b2f3ee7d188dad008b6eb4c40bbd03a3de451d82c78bba9aad"
sha256: f63cbc48103236abf48e345e07a03ce5757ea86285ed313a6a032596ed9301e2
url: "https://pub.dev"
source: hosted
version: "2.2.2"
version: "2.3.1"
url_launcher:
dependency: "direct main"
description:
@@ -866,34 +947,34 @@ packages:
dependency: transitive
description:
name: url_launcher_android
sha256: "8582d7f6fe14d2652b4c45c9b6c14c0b678c2af2d083a11b604caeba51930d79"
sha256: "767344bf3063897b5cf0db830e94f904528e6dd50a6dfaf839f0abf509009611"
url: "https://pub.dev"
source: hosted
version: "6.3.16"
version: "6.3.28"
url_launcher_ios:
dependency: transitive
description:
name: url_launcher_ios
sha256: "7f2022359d4c099eea7df3fdf739f7d3d3b9faf3166fb1dd390775176e0b76cb"
sha256: "580fe5dfb51671ae38191d316e027f6b76272b026370708c2d898799750a02b0"
url: "https://pub.dev"
source: hosted
version: "6.3.3"
version: "6.4.1"
url_launcher_linux:
dependency: transitive
description:
name: url_launcher_linux
sha256: "4e9ba368772369e3e08f231d2301b4ef72b9ff87c31192ef471b380ef29a4935"
sha256: d5e14138b3bc193a0f63c10a53c94b91d399df0512b1f29b94a043db7482384a
url: "https://pub.dev"
source: hosted
version: "3.2.1"
version: "3.2.2"
url_launcher_macos:
dependency: transitive
description:
name: url_launcher_macos
sha256: "17ba2000b847f334f16626a574c702b196723af2a289e7a93ffcb79acff855c2"
sha256: "368adf46f71ad3c21b8f06614adb38346f193f3a59ba8fe9a2fd74133070ba18"
url: "https://pub.dev"
source: hosted
version: "3.2.2"
version: "3.2.5"
url_launcher_platform_interface:
dependency: transitive
description:
@@ -906,26 +987,26 @@ packages:
dependency: transitive
description:
name: url_launcher_web
sha256: "4bd2b7b4dc4d4d0b94e5babfffbca8eac1a126c7f3d6ecbc1a11013faa3abba2"
sha256: d0412fcf4c6b31ecfdb7762359b7206ffba3bbffd396c6d9f9c4616ece476c1f
url: "https://pub.dev"
source: hosted
version: "2.4.1"
version: "2.4.2"
url_launcher_windows:
dependency: transitive
description:
name: url_launcher_windows
sha256: "3284b6d2ac454cf34f114e1d3319866fdd1e19cdc329999057e44ffe936cfa77"
sha256: "712c70ab1b99744ff066053cbe3e80c73332b38d46e5e945c98689b2e66fc15f"
url: "https://pub.dev"
source: hosted
version: "3.1.4"
version: "3.1.5"
uuid:
dependency: transitive
description:
name: uuid
sha256: a5be9ef6618a7ac1e964353ef476418026db906c4facdedaa299b7a2e71690ff
sha256: "1fef9e8e11e2991bb773070d4656b7bd5d850967a2456cfc83cf47925ba79489"
url: "https://pub.dev"
source: hosted
version: "4.5.1"
version: "4.5.3"
vector_graphics:
dependency: transitive
description:
@@ -946,26 +1027,26 @@ packages:
dependency: transitive
description:
name: vector_graphics_compiler
sha256: "557a315b7d2a6dbb0aaaff84d857967ce6bdc96a63dc6ee2a57ce5a6ee5d3331"
sha256: "5a88dd14c0954a5398af544651c7fb51b457a2a556949bfb25369b210ef73a74"
url: "https://pub.dev"
source: hosted
version: "1.1.17"
version: "1.2.0"
vector_math:
dependency: transitive
description:
name: vector_math
sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
sha256: d530bd74fea330e6e364cda7a85019c434070188383e1cd8d9777ee586914c5b
url: "https://pub.dev"
source: hosted
version: "2.1.4"
version: "2.2.0"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02
sha256: "45caa6c5917fa127b5dbcfbd1fa60b14e583afdc08bfc96dda38886ca252eb60"
url: "https://pub.dev"
source: hosted
version: "15.0.0"
version: "15.0.2"
web:
dependency: transitive
description:
@@ -978,10 +1059,10 @@ packages:
dependency: transitive
description:
name: win32
sha256: "66814138c3562338d05613a6e368ed8cfb237ad6d64a9e9334be3f309acfca03"
sha256: d7cb55e04cd34096cd3a79b3330245f54cb96a370a1c27adb3c84b917de8b08e
url: "https://pub.dev"
source: hosted
version: "5.14.0"
version: "5.15.0"
xdg_directories:
dependency: transitive
description:
@@ -994,10 +1075,10 @@ packages:
dependency: transitive
description:
name: xml
sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226
sha256: "971043b3a0d3da28727e40ed3e0b5d18b742fa5a68665cca88e74b7876d5e025"
url: "https://pub.dev"
source: hosted
version: "6.5.0"
version: "6.6.1"
yaml:
dependency: transitive
description:
@@ -1007,5 +1088,5 @@ packages:
source: hosted
version: "3.1.3"
sdks:
dart: ">=3.8.0 <4.0.0"
flutter: ">=3.27.1"
dart: ">=3.10.8 <4.0.0"
flutter: ">=3.38.4"

View File

@@ -1,53 +1,62 @@
name: mugiten
description: "A new Flutter project."
publish_to: "none" # Remove this line if you wish to publish to pub.dev
version: 0.4.0+1
version: 0.5.0+1
environment:
sdk: ^3.8.0
sdk: ^3.9.0
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.8
jadb:
git:
url: https://git.pvv.ntnu.no/mugiten/jadb.git
kanimaji:
git:
url: https://git.pvv.ntnu.no/mugiten/kanimaji-dart.git
animated_size_and_fade: ^5.1.1
archive: ^4.0.7
async: ^2.13.0
collection: ^1.19.0
cupertino_icons: ^1.0.8
division: ^0.9.0
file_picker: ^10.2.0
flutter_bloc: ^9.1.0
flutter_markdown_plus: ^1.0.3
flutter_settings_ui: ^3.0.1
flutter_slidable: ^4.0.0
flutter_svg: ^2.0.17
get_it: ^8.0.3
get_it: ^9.0.5
google_fonts: ^8.0.2
google_mlkit_digital_ink_recognition: ^0.14.1
http: ^1.3.0
jadb:
git:
url: https://git.pvv.ntnu.no/oysteikt/jadb.git
infinite_scroll_pagination: ^5.1.0
markdown: ^7.3.0
mdi: ^5.0.0-nullsafety.0
package_info_plus: ^9.0.0
path: ^1.9.0
path_provider: ^2.1.5
share_plus: ^11.0.0
ruby_text: ^3.0.3
sealed_languages: ^3.0.0
share_plus: ^12.0.1
shared_preferences: ^2.5.3
signature: ^6.3.0
url_launcher: ^6.3.1
sqflite: ^2.4.1
sqlite3_flutter_libs: ^0.5.32
sqflite_common_ffi: ^2.3.4+4
ruby_text: ^3.0.3
google_mlkit_digital_ink_recognition: ^0.14.1
archive: ^4.0.7
package_info_plus: ^8.3.0
flutter_markdown_plus: ^1.0.3
markdown: ^7.3.0
sealed_languages: ^2.1.0
infinite_scroll_pagination: ^5.1.0
sqlite3: ^3.0.0
sqlite3_flutter_libs: ^0.6.0+eol
url_launcher: ^6.3.1
dev_dependencies:
flutter_test:
sdk: flutter
flutter_launcher_icons: ^0.14.4
flutter_lints: ^6.0.0
flutter_native_splash: ^2.4.6
flutter_launcher_icons: ^0.14.4
flutter:
uses-material-design: true
@@ -59,6 +68,7 @@ flutter:
- assets/images/components/
- assets/images/links/
- assets/images/logo/
- assets/kanjivg/kanji/
- assets/licenses/
- docs/changelog/
- migrations/
@@ -67,11 +77,3 @@ flutter:
- family: Droid Sans Japanese
fonts:
- asset: assets/fonts/DroidSansJapanese.ttf
- family: Noto Sans CJK
fonts:
- asset: assets/fonts/NotoSansCJK-Regular.ttc
- family: Noto Serif CJK
fonts:
- asset: assets/fonts/NotoSerifCJK-Regular.ttc

60
scripts/publish.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env bash
set -euo pipefail
declare -a COMMANDS=(
curl
git
)
for cmd in "${COMMANDS[@]}"; do
if ! command -v "$cmd" &> /dev/null; then
echo "$cmd could not be found" >&2
exit 1
fi
done
if [ -z "${GITEA_USER:-}" ]; then
echo "GITEA_USER is not set" >&2
exit 1
fi
if [ -z "${GITEA_TOKEN:-}" ]; then
echo "GITEA_TOKEN is not set" >&2
exit 1
fi
if [ "$#" -ne 1 ]; then
echo "Usage: $0 <version>" >&2
exit 1
fi
declare -r VERSION="$1"
if [[ ! "$VERSION" =~ ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+$ ]]; then
echo "$VERSION does not look like a valid version name"
exit 1
fi
declare -r PACKAGE_API_ENDPOINT="https://git.pvv.ntnu.no/api/packages/mugiten/generic/mugiten/$VERSION/mugiten.apk"
declare -r PROJECT_ROOT="$(git rev-parse --show-toplevel)"
if [[ ! -f "$PROJECT_ROOT/build/app/outputs/apk/release/app-release.apk" ]]; then
echo "$PROJECT_ROOT/build/app/outputs/apk/release/app-release.apk does not exist"
exit 1
fi
if curl -X GET --silent --head --fail --user "$GITEA_USER:$GITEA_TOKEN" "$PACKAGE_API_ENDPOINT" >/dev/null; then
echo "Version $VERSION seems to already exist"
exit 1
else
echo "Uploading APK for version $VERSION..."
curl \
-X PUT \
--user "$GITEA_USER:$GITEA_TOKEN" \
--progress-bar \
--upload-file "$PROJECT_ROOT/build/app/outputs/apk/release/app-release.apk" \
"$PACKAGE_API_ENDPOINT"
fi

View File

@@ -7,7 +7,6 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:get_it/get_it.dart';
import 'package:mugiten/database/database.dart';
import 'package:mugiten/models/library_list.dart';
import 'package:sqflite/sqflite.dart';
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
import 'package:sqlite3/open.dart';
@@ -21,11 +20,11 @@ Future<Database> createDatabaseCopy({
}
// Make a copy of jadbPath
final random_suffix = Random()
final randomSuffix = Random()
.nextInt((pow(2, 32) - 1) as int)
.toRadixString(16);
final jadbCopyPath = jadbFile.parent.uri
.resolve('jadb_copy_$random_suffix.sqlite')
.resolve('jadb_copy_$randomSuffix.sqlite')
.path;
await jadbFile.copy(jadbCopyPath);
@@ -34,7 +33,7 @@ Future<Database> createDatabaseCopy({
// Initialize FFI
sqfliteFfiInit();
databaseFactory = await createDatabaseFactoryFfi(
databaseFactory = createDatabaseFactoryFfi(
ffiInit: () =>
open.overrideForAll(() => DynamicLibrary.open(libsqlitePath)),
);