├── .github ├── linters │ └── .jscpd.json └── workflows │ ├── ci.yml │ ├── lint.yml │ └── publish.yml ├── .gitignore ├── .metadata ├── CHANGELOG.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── example ├── .gitignore ├── .metadata ├── README.md ├── analysis_options.yaml ├── lib │ └── main.dart ├── pubspec.lock └── pubspec.yaml ├── images ├── dark.png └── light.png ├── lib ├── adwaita.dart └── src │ ├── theme.dart │ └── utils │ └── colors.dart └── pubspec.yaml /.github/linters/.jscpd.json: -------------------------------------------------------------------------------- 1 | { 2 | "threshold": 0.2 3 | } 4 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | --- 2 | # This is a basic workflow to help you get started with Actions 3 | name: CI 4 | 5 | # Controls when the workflow will run 6 | on: 7 | # Triggers the workflow on push or pull request 8 | # events but only for the main branch 9 | push: 10 | branches: [main] 11 | paths-ignore: 12 | - '**/README.md' 13 | pull_request: 14 | branches: [main] 15 | 16 | # Allows you to run this workflow manually from the Actions tab 17 | workflow_dispatch: 18 | 19 | jobs: 20 | test: 21 | name: Test on ${{ matrix.os }} 22 | runs-on: ${{ matrix.os }} 23 | strategy: 24 | matrix: 25 | os: [ubuntu-latest, windows-latest, macos-latest] 26 | steps: 27 | - uses: actions/checkout@v2 28 | - uses: actions/setup-java@v2 29 | with: 30 | distribution: 'zulu' 31 | java-version: '11' 32 | - uses: subosito/flutter-action@v1 33 | with: 34 | channel: 'stable' 35 | - run: dart --version 36 | - run: flutter --version 37 | - run: flutter analyze 38 | - name: Build (Linux) 39 | run: | 40 | sudo apt-get update -y && sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev 41 | flutter config --enable-linux-desktop 42 | cd example 43 | flutter create --platforms=linux . 44 | flutter build linux 45 | if: matrix.os == 'ubuntu-latest' 46 | - name: Build (Mac) 47 | run: | 48 | flutter config --enable-macos-desktop 49 | cd example 50 | flutter create --platforms=macos . 51 | flutter doctor 52 | flutter build macos 53 | if: matrix.os == 'macos-latest' 54 | - name: Build (Windows) 55 | run: | 56 | flutter config --enable-windows-desktop 57 | cd example 58 | flutter create --platforms=windows . 59 | flutter doctor 60 | flutter build windows 61 | if: matrix.os == 'windows-latest' 62 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | --- 2 | ################################# 3 | ################################# 4 | ## Super Linter GitHub Actions ## 5 | ################################# 6 | ################################# 7 | name: Lint Code Base 8 | 9 | # 10 | # Documentation: 11 | # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions 12 | # 13 | 14 | ############################# 15 | # Start the job on all push # 16 | ############################# 17 | on: 18 | push: 19 | pull_request: 20 | branches: [main] 21 | 22 | ############### 23 | # Set the Job # 24 | ############### 25 | jobs: 26 | build: 27 | # Name the Job 28 | name: Lint Code Base 29 | # Set the agent to run on 30 | runs-on: ubuntu-latest 31 | 32 | ################## 33 | # Load all steps # 34 | ################## 35 | steps: 36 | ########################## 37 | # Checkout the code base # 38 | ########################## 39 | - name: Checkout Code 40 | uses: actions/checkout@v2 41 | with: 42 | # Full git history is needed to get a proper list of changed files within `super-linter` 43 | fetch-depth: 0 44 | 45 | ################################ 46 | # Run Linter against code base # 47 | ################################ 48 | - name: Lint Code Base 49 | uses: github/super-linter@v4 50 | env: 51 | VALIDATE_ALL_CODEBASE: false 52 | VALIDATE_DART: false 53 | DEFAULT_BRANCH: main 54 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Package 2 | 3 | on: 4 | push: 5 | tags: 6 | - 'v[0-9]+.[0-9]+.[0-9]+*' 7 | 8 | jobs: 9 | publish: 10 | uses: dart-lang/ecosystem/.github/workflows/publish.yaml@main -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 25 | /pubspec.lock 26 | **/doc/api/ 27 | .dart_tool/ 28 | .packages 29 | build/ 30 | linux/ 31 | example/linux/ 32 | credentials.json -------------------------------------------------------------------------------- /.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled and should not be manually edited. 5 | 6 | version: 7 | revision: a31e0a4336832f9d48c03823cdcc0bb4c0bfe62d 8 | channel: master 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## 1.1.0 4 | 5 | * Fix compilation with Flutter 3.13.0 6 | 7 | ## 1.0.1 8 | 9 | * Fix divider theme color 10 | 11 | ## 1.0.0 12 | 13 | * Requires Flutter v3 and newer 14 | * Make it compatible with Material 3.0 15 | * Fix very_good_analysis version solving failed 16 | 17 | ## 0.5.2 18 | 19 | * Relicense under MPL-2.0 20 | 21 | ## 0.5.1 22 | 23 | * Fix AppBar title font style 24 | * Improve example 25 | 26 | ## 0.5.0 27 | 28 | * Match Typography with libadwaita 29 | * Add border in light dialog theme 30 | * No Splash for Ink widgets 31 | 32 | ## 0.2.0 33 | 34 | * Add fontFamily parameter in light and dark theme 35 | 36 | ## 0.1.0 37 | 38 | * Add very_good_analysis 39 | * Update dialog theme 40 | 41 | ## 0.0.5 42 | 43 | * Update README. 44 | 45 | ## 0.0.4 46 | 47 | * Add full color palette. 48 | * Improves documentation. 49 | 50 | ## 0.0.3 51 | 52 | * Change GitHub repository name. 53 | * Update TextField and TextButton theme to fit adwaita. 54 | 55 | ## 0.0.1 56 | 57 | * First release of theme 58 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 13 | 14 | # Adwaita Theme 15 | 16 | ![CI](https://github.com/gtk-flutter/adwaita/actions/workflows/ci.yml/badge.svg) 17 | [![GitHub Super-Linter](https://github.com/gtk-flutter/adwaita/workflows/Lint%20Code%20Base/badge.svg)](https://github.com/marketplace/actions/super-linter) 18 | 19 | Implementation of the adwaita color scheme found in [libadwaita](https://gitlab.gnome.org/GNOME/libadwaita). 20 | 21 | Inspired by the [yaru theme](https://github.com/ubuntu/yaru.dart) for flutter. 22 | 23 | 24 | ## Usage 25 | 26 | ```dart 27 | import 'package:flutter/material.dart'; 28 | import 'package:adwaita/adwaita.dart'; 29 | 30 | void main() => runApp(MyApp()); 31 | 32 | class MyApp extends StatelessWidget { 33 | final ValueNotifier themeNotifier = ValueNotifier(ThemeMode.light); 34 | 35 | MyApp({Key? key}) : super(key: key); 36 | 37 | @override 38 | Widget build(BuildContext context) { 39 | return ValueListenableBuilder( 40 | valueListenable: themeNotifier, 41 | builder: (_, ThemeMode currentMode, __) { 42 | return MaterialApp( 43 | theme: AdwaitaThemeData.light(), 44 | darkTheme: AdwaitaThemeData.dark(), 45 | debugShowCheckedModeBanner: false, 46 | home: MyHomePage(themeNotifier: themeNotifier), 47 | themeMode: currentMode); 48 | }); 49 | } 50 | } 51 | ``` 52 | 53 | ## Examples 54 | 55 | ![light_theme](https://raw.githubusercontent.com/gtk-flutter/adwaita/main/images/light.png) 56 | 57 | ![dark_theme](https://raw.githubusercontent.com/gtk-flutter/adwaita/main/images/dark.png) 58 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:very_good_analysis/analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | public_member_api_docs: false 6 | library_private_types_in_public_api: false 7 | avoid_setters_without_getters: false 8 | 9 | # Additional information about this file can be found at 10 | # https://dart.dev/guides/language/analysis-options -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | 12 | # IntelliJ related 13 | *.iml 14 | *.ipr 15 | *.iws 16 | .idea/ 17 | 18 | # The .vscode folder contains launch configuration and tasks you configure in 19 | # VS Code which you may wish to be included in version control, so this line 20 | # is commented out by default. 21 | #.vscode/ 22 | 23 | # Flutter/Dart/Pub related 24 | **/doc/api/ 25 | **/ios/Flutter/.last_build_id 26 | .dart_tool/ 27 | .flutter-plugins 28 | .flutter-plugins-dependencies 29 | .packages 30 | .pub-cache/ 31 | .pub/ 32 | /build/ 33 | 34 | # Web related 35 | lib/generated_plugin_registrant.dart 36 | 37 | # Symbolication related 38 | app.*.symbols 39 | 40 | # Obfuscation related 41 | app.*.map.json 42 | 43 | # Android Studio will place build artifacts here 44 | /android/app/debug 45 | /android/app/profile 46 | /android/app/release 47 | web -------------------------------------------------------------------------------- /example/.metadata: -------------------------------------------------------------------------------- 1 | # This file tracks properties of this Flutter project. 2 | # Used by Flutter tool to assess capabilities and perform upgrades etc. 3 | # 4 | # This file should be version controlled. 5 | 6 | version: 7 | revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 8 | channel: stable 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 17 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 18 | - platform: linux 19 | create_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 20 | base_revision: 84a1e904f44f9b0e9c4510138010edcc653163f8 21 | 22 | # User provided section 23 | 24 | # List of Local paths (relative to this file) that should be 25 | # ignored by the migrate tool. 26 | # 27 | # Files that are not part of the templates will be ignored by default. 28 | unmanaged_files: 29 | - 'lib/main.dart' 30 | - 'ios/Runner.xcodeproj/project.pbxproj' 31 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | # yaru_test 2 | 3 | Demonstrates Yaru theming. 4 | 5 | -------------------------------------------------------------------------------- /example/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:very_good_analysis/analysis_options.yaml 2 | 3 | linter: 4 | rules: 5 | public_member_api_docs: false 6 | library_private_types_in_public_api: false 7 | avoid_setters_without_getters: false 8 | 9 | # Additional information about this file can be found at 10 | # https://dart.dev/guides/language/analysis-options -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:adwaita/adwaita.dart'; 2 | import 'package:flutter/cupertino.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | void main() => runApp(MyApp()); 6 | 7 | class MyApp extends StatelessWidget { 8 | MyApp({Key? key}) : super(key: key); 9 | 10 | final ValueNotifier themeNotifier = ValueNotifier(ThemeMode.light); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return ValueListenableBuilder( 15 | valueListenable: themeNotifier, 16 | builder: (_, ThemeMode currentMode, __) { 17 | return MaterialApp( 18 | theme: AdwaitaThemeData.light(), 19 | darkTheme: AdwaitaThemeData.dark(), 20 | debugShowCheckedModeBanner: false, 21 | home: MyHomePage(themeNotifier: themeNotifier), 22 | themeMode: currentMode, 23 | ); 24 | }, 25 | ); 26 | } 27 | } 28 | 29 | class MyHomePage extends StatefulWidget { 30 | const MyHomePage({required this.themeNotifier, Key? key}) : super(key: key); 31 | 32 | final ValueNotifier themeNotifier; 33 | 34 | @override 35 | State createState() => _MyHomePageState(); 36 | } 37 | 38 | class _MyHomePageState extends State { 39 | @override 40 | Widget build(BuildContext context) { 41 | return Scaffold( 42 | appBar: AppBar( 43 | title: const Text('Dark mode'), 44 | actions: [ 45 | SizedBox( 46 | height: 30, 47 | child: CupertinoSwitch( 48 | activeColor: AdwaitaColors.blue3, 49 | trackColor: AdwaitaColors.warmGrey, 50 | value: widget.themeNotifier.value != ThemeMode.light, 51 | onChanged: (value) { 52 | widget.themeNotifier.value = 53 | widget.themeNotifier.value == ThemeMode.light 54 | ? ThemeMode.dark 55 | : ThemeMode.light; 56 | }, 57 | ), 58 | ), 59 | ], 60 | ), 61 | body: Column( 62 | children: [ 63 | Column( 64 | children: [ 65 | Card( 66 | child: Column( 67 | mainAxisSize: MainAxisSize.min, 68 | children: [ 69 | const ListTile( 70 | leading: Icon(Icons.album), 71 | title: Text('The Enchanted Nightingale'), 72 | subtitle: 73 | Text('Music by Julie Gable. Lyrics by Sidney Stein.'), 74 | ), 75 | Row( 76 | mainAxisAlignment: MainAxisAlignment.end, 77 | children: [ 78 | TextButton( 79 | child: const Text('BUY TICKETS'), 80 | onPressed: () {/* ... */}, 81 | ), 82 | const SizedBox(width: 8), 83 | TextButton( 84 | child: const Text('LISTEN'), 85 | onPressed: () {/* ... */}, 86 | ), 87 | const SizedBox(width: 8), 88 | ], 89 | ), 90 | ], 91 | ), 92 | ), 93 | ], 94 | ), 95 | Expanded( 96 | child: Center( 97 | child: SizedBox( 98 | width: 300, 99 | child: Column( 100 | mainAxisAlignment: MainAxisAlignment.center, 101 | children: [ 102 | Row( 103 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 104 | children: [ 105 | Text( 106 | 'Title 1', 107 | style: Theme.of(context).textTheme.displayLarge, 108 | ), 109 | Text( 110 | 'Heading', 111 | style: Theme.of(context).textTheme.headlineSmall, 112 | ), 113 | ], 114 | ), 115 | Row( 116 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 117 | children: [ 118 | Text( 119 | 'Title 2', 120 | style: Theme.of(context).textTheme.displayMedium, 121 | ), 122 | Text( 123 | 'Body', 124 | style: Theme.of(context).textTheme.bodyLarge, 125 | ), 126 | ], 127 | ), 128 | Row( 129 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 130 | children: [ 131 | Text( 132 | 'Title 3', 133 | style: Theme.of(context).textTheme.displaySmall, 134 | ), 135 | Text( 136 | 'Caption Heading', 137 | style: Theme.of(context).textTheme.titleLarge, 138 | ), 139 | ], 140 | ), 141 | Row( 142 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 143 | children: [ 144 | Text( 145 | 'Title 4', 146 | style: Theme.of(context).textTheme.headlineMedium, 147 | ), 148 | Text( 149 | 'Caption', 150 | style: Theme.of(context).textTheme.bodySmall, 151 | ), 152 | ], 153 | ), 154 | ] 155 | .map( 156 | (e) => Padding( 157 | padding: const EdgeInsets.all(12), 158 | child: e, 159 | ), 160 | ) 161 | .toList(), 162 | ), 163 | ), 164 | ), 165 | ), 166 | ], 167 | ), 168 | ); 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | adwaita: 5 | dependency: "direct main" 6 | description: 7 | path: ".." 8 | relative: true 9 | source: path 10 | version: "1.0.1" 11 | async: 12 | dependency: transitive 13 | description: 14 | name: async 15 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 16 | url: "https://pub.dev" 17 | source: hosted 18 | version: "2.11.0" 19 | boolean_selector: 20 | dependency: transitive 21 | description: 22 | name: boolean_selector 23 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 24 | url: "https://pub.dev" 25 | source: hosted 26 | version: "2.1.1" 27 | characters: 28 | dependency: transitive 29 | description: 30 | name: characters 31 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 32 | url: "https://pub.dev" 33 | source: hosted 34 | version: "1.3.0" 35 | clock: 36 | dependency: transitive 37 | description: 38 | name: clock 39 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 40 | url: "https://pub.dev" 41 | source: hosted 42 | version: "1.1.1" 43 | collection: 44 | dependency: transitive 45 | description: 46 | name: collection 47 | sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 48 | url: "https://pub.dev" 49 | source: hosted 50 | version: "1.17.2" 51 | fake_async: 52 | dependency: transitive 53 | description: 54 | name: fake_async 55 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 56 | url: "https://pub.dev" 57 | source: hosted 58 | version: "1.3.1" 59 | flutter: 60 | dependency: "direct main" 61 | description: flutter 62 | source: sdk 63 | version: "0.0.0" 64 | flutter_test: 65 | dependency: "direct dev" 66 | description: flutter 67 | source: sdk 68 | version: "0.0.0" 69 | matcher: 70 | dependency: transitive 71 | description: 72 | name: matcher 73 | sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" 74 | url: "https://pub.dev" 75 | source: hosted 76 | version: "0.12.16" 77 | material_color_utilities: 78 | dependency: transitive 79 | description: 80 | name: material_color_utilities 81 | sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" 82 | url: "https://pub.dev" 83 | source: hosted 84 | version: "0.5.0" 85 | meta: 86 | dependency: transitive 87 | description: 88 | name: meta 89 | sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" 90 | url: "https://pub.dev" 91 | source: hosted 92 | version: "1.9.1" 93 | path: 94 | dependency: transitive 95 | description: 96 | name: path 97 | sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" 98 | url: "https://pub.dev" 99 | source: hosted 100 | version: "1.8.3" 101 | sky_engine: 102 | dependency: transitive 103 | description: flutter 104 | source: sdk 105 | version: "0.0.99" 106 | source_span: 107 | dependency: transitive 108 | description: 109 | name: source_span 110 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 111 | url: "https://pub.dev" 112 | source: hosted 113 | version: "1.10.0" 114 | stack_trace: 115 | dependency: transitive 116 | description: 117 | name: stack_trace 118 | sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 119 | url: "https://pub.dev" 120 | source: hosted 121 | version: "1.11.0" 122 | stream_channel: 123 | dependency: transitive 124 | description: 125 | name: stream_channel 126 | sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" 127 | url: "https://pub.dev" 128 | source: hosted 129 | version: "2.1.1" 130 | string_scanner: 131 | dependency: transitive 132 | description: 133 | name: string_scanner 134 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 135 | url: "https://pub.dev" 136 | source: hosted 137 | version: "1.2.0" 138 | term_glyph: 139 | dependency: transitive 140 | description: 141 | name: term_glyph 142 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 143 | url: "https://pub.dev" 144 | source: hosted 145 | version: "1.2.1" 146 | test_api: 147 | dependency: transitive 148 | description: 149 | name: test_api 150 | sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" 151 | url: "https://pub.dev" 152 | source: hosted 153 | version: "0.6.0" 154 | vector_math: 155 | dependency: transitive 156 | description: 157 | name: vector_math 158 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "2.1.4" 162 | very_good_analysis: 163 | dependency: "direct dev" 164 | description: 165 | name: very_good_analysis 166 | sha256: "5e4ea72d2a9188630f0dd8f120a541de730090ef8863243fedca8267a84508b8" 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "5.0.0+1" 170 | web: 171 | dependency: transitive 172 | description: 173 | name: web 174 | sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "0.1.4-beta" 178 | sdks: 179 | dart: ">=3.1.0-185.0.dev <4.0.0" 180 | flutter: ">=3.0.0" 181 | -------------------------------------------------------------------------------- /example/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: adwaita_example 2 | description: Demonstrates Adwaita theming 3 | publish_to: none 4 | version: 4.0.0+1 5 | 6 | environment: 7 | sdk: ">=2.12.0 <4.0.0" 8 | 9 | dependencies: 10 | adwaita: 11 | path: ../ 12 | flutter: 13 | sdk: flutter 14 | 15 | dev_dependencies: 16 | flutter_test: 17 | sdk: flutter 18 | very_good_analysis: ^5.0.0 19 | 20 | flutter: 21 | uses-material-design: true 22 | -------------------------------------------------------------------------------- /images/dark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtk-flutter/adwaita/d0789a527e1e5b1d1e4e7b177dcaa71ad51debb3/images/dark.png -------------------------------------------------------------------------------- /images/light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gtk-flutter/adwaita/d0789a527e1e5b1d1e4e7b177dcaa71ad51debb3/images/light.png -------------------------------------------------------------------------------- /lib/adwaita.dart: -------------------------------------------------------------------------------- 1 | /// Library providing the Adwaita theme for Flutter applications. 2 | library adwaita; 3 | 4 | export 'package:adwaita/src/theme.dart'; 5 | export 'package:adwaita/src/utils/colors.dart'; 6 | -------------------------------------------------------------------------------- /lib/src/theme.dart: -------------------------------------------------------------------------------- 1 | import 'package:adwaita/src/utils/colors.dart'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart' show SystemUiOverlayStyle; 5 | 6 | /// Generate Adwaita light and dark theme. 7 | class AdwaitaThemeData { 8 | const AdwaitaThemeData._(); 9 | 10 | static final _lightColorScheme = ColorScheme.fromSwatch( 11 | // NOTE(robert-ancell): Light shades from 'Tint' on website, dark shades 12 | // calculated. 13 | primarySwatch: AdwaitaColors.primarySwatchColor, 14 | accentColor: AdwaitaColors.blueAccent, 15 | cardColor: AdwaitaColors.cardBackground, 16 | backgroundColor: AdwaitaColors.backgroundColor, 17 | errorColor: AdwaitaColors.red5, 18 | ); 19 | 20 | static final _darkColorScheme = ColorScheme.fromSwatch( 21 | // NOTE(robert-ancell): Light shades from 'Tint' on website, dark shades 22 | // calculated. 23 | primarySwatch: AdwaitaColors.primarySwatchColor, 24 | accentColor: AdwaitaColors.blueAccent, 25 | cardColor: AdwaitaColors.darkCardBackground, 26 | backgroundColor: AdwaitaColors.darkBackgroundColor, 27 | errorColor: AdwaitaColors.red5, 28 | brightness: Brightness.dark, 29 | ); 30 | 31 | static ShapeBorder getDialogShape([Color color = Colors.white]) => 32 | RoundedRectangleBorder( 33 | borderRadius: BorderRadius.circular(6), 34 | side: BorderSide(color: color.withOpacity(0.2)), 35 | ); 36 | 37 | static TextTheme getTextTheme([Brightness brightness = Brightness.light]) { 38 | final color = brightness == Brightness.light ? Colors.black : Colors.white; 39 | return TextTheme( 40 | displayLarge: TextStyle( 41 | fontSize: 26, 42 | color: color, 43 | fontWeight: FontWeight.bold, 44 | ), 45 | displayMedium: TextStyle( 46 | fontSize: 21, 47 | color: color, 48 | fontWeight: FontWeight.bold, 49 | ), 50 | displaySmall: TextStyle( 51 | fontSize: 20, 52 | color: color, 53 | fontWeight: FontWeight.bold, 54 | ), 55 | headlineMedium: TextStyle( 56 | fontSize: 17, 57 | color: color, 58 | fontWeight: FontWeight.bold, 59 | ), 60 | headlineSmall: TextStyle( 61 | fontSize: 15, 62 | color: color, 63 | fontWeight: FontWeight.bold, 64 | ), 65 | titleLarge: TextStyle( 66 | fontSize: 13, 67 | color: color, 68 | fontWeight: FontWeight.w600, 69 | ), 70 | bodyLarge: TextStyle( 71 | fontSize: 15, 72 | color: color, 73 | ), 74 | bodySmall: TextStyle( 75 | fontSize: 13, 76 | color: color, 77 | fontWeight: FontWeight.w400, 78 | ), 79 | ); 80 | } 81 | 82 | /// A default light theme. 83 | static ThemeData light({String? fontFamily}) => ThemeData( 84 | fontFamily: fontFamily, 85 | tabBarTheme: TabBarTheme(labelColor: _lightColorScheme.onSurface), 86 | brightness: Brightness.light, 87 | splashFactory: NoSplash.splashFactory, 88 | primaryColor: _lightColorScheme.primary, 89 | canvasColor: _lightColorScheme.background, 90 | scaffoldBackgroundColor: _lightColorScheme.background, 91 | cardColor: _lightColorScheme.surface, 92 | dividerTheme: DividerThemeData( 93 | color: _lightColorScheme.onSurface.withOpacity(0.12), 94 | ), 95 | dialogBackgroundColor: _lightColorScheme.background, 96 | dialogTheme: DialogTheme( 97 | backgroundColor: _lightColorScheme.background, 98 | shape: getDialogShape(Colors.black), 99 | ), 100 | textTheme: getTextTheme(), 101 | indicatorColor: _lightColorScheme.secondary, 102 | applyElevationOverlayColor: false, 103 | buttonTheme: _buttonThemeData, 104 | elevatedButtonTheme: _getElevatedButtonThemeData(Brightness.light), 105 | outlinedButtonTheme: _outlinedButtonThemeData, 106 | textButtonTheme: _textButtonThemeData, 107 | switchTheme: _switchStyleLight, 108 | checkboxTheme: _checkStyleLight, 109 | radioTheme: _radioStyleLight, 110 | appBarTheme: _appBarLightTheme, 111 | floatingActionButtonTheme: const FloatingActionButtonThemeData( 112 | backgroundColor: AdwaitaColors.blueAccent, 113 | ), 114 | bottomNavigationBarTheme: BottomNavigationBarThemeData( 115 | selectedItemColor: _lightColorScheme.primary, 116 | unselectedItemColor: AdwaitaColors.dark3, 117 | ), 118 | inputDecorationTheme: InputDecorationTheme( 119 | filled: true, 120 | fillColor: AdwaitaColors.button, 121 | enabledBorder: const OutlineInputBorder( 122 | borderRadius: BorderRadius.all(Radius.circular(8)), 123 | borderSide: BorderSide(color: Colors.transparent), 124 | ), 125 | focusedBorder: const OutlineInputBorder( 126 | borderRadius: BorderRadius.all( 127 | Radius.circular(8), 128 | ), 129 | borderSide: BorderSide( 130 | color: AdwaitaColors.blueAccent, 131 | ), 132 | ), 133 | ), 134 | bottomAppBarTheme: BottomAppBarTheme(color: _lightColorScheme.surface), 135 | colorScheme: _lightColorScheme 136 | .copyWith( 137 | background: _lightColorScheme.background, 138 | ) 139 | .copyWith(error: _lightColorScheme.error), 140 | ); 141 | 142 | /// A default dark theme. 143 | static ThemeData dark({String? fontFamily}) => ThemeData( 144 | fontFamily: fontFamily, 145 | tabBarTheme: TabBarTheme(labelColor: _darkColorScheme.onBackground), 146 | brightness: Brightness.dark, 147 | splashFactory: NoSplash.splashFactory, 148 | primaryColor: _darkColorScheme.primary, 149 | canvasColor: _darkColorScheme.background, 150 | scaffoldBackgroundColor: _darkColorScheme.background, 151 | cardColor: _darkColorScheme.surface, 152 | dividerTheme: DividerThemeData( 153 | color: _darkColorScheme.onSurface.withOpacity(0.12), 154 | ), 155 | dialogBackgroundColor: _darkColorScheme.background, 156 | dialogTheme: DialogTheme( 157 | backgroundColor: _darkColorScheme.background, 158 | shape: getDialogShape(), 159 | ), 160 | textTheme: getTextTheme(Brightness.dark), 161 | indicatorColor: _darkColorScheme.secondary, 162 | applyElevationOverlayColor: true, 163 | buttonTheme: _buttonThemeData, 164 | textButtonTheme: _darkTextButtonThemeData, 165 | elevatedButtonTheme: _getElevatedButtonThemeData(Brightness.dark), 166 | outlinedButtonTheme: _darkOutlinedButtonThemeData, 167 | switchTheme: _switchStyleDark, 168 | checkboxTheme: _checkStyleDark, 169 | radioTheme: _radioStyleDark, 170 | primaryColorDark: AdwaitaColors.blueAccent, 171 | appBarTheme: _appBarDarkTheme, 172 | floatingActionButtonTheme: const FloatingActionButtonThemeData( 173 | backgroundColor: AdwaitaColors.blueAccent, 174 | ), 175 | bottomNavigationBarTheme: BottomNavigationBarThemeData( 176 | selectedItemColor: _darkColorScheme.primary, 177 | unselectedItemColor: AdwaitaColors.warmGrey.shade300, 178 | ), 179 | inputDecorationTheme: InputDecorationTheme( 180 | filled: true, 181 | fillColor: AdwaitaColors.darkButton, 182 | enabledBorder: const OutlineInputBorder( 183 | borderRadius: BorderRadius.all(Radius.circular(8)), 184 | borderSide: BorderSide(color: Colors.transparent), 185 | ), 186 | focusedBorder: const OutlineInputBorder( 187 | borderRadius: BorderRadius.all( 188 | Radius.circular(8), 189 | ), 190 | borderSide: BorderSide(color: AdwaitaColors.blueAccent), 191 | ), 192 | ), 193 | bottomAppBarTheme: BottomAppBarTheme(color: _darkColorScheme.surface), 194 | colorScheme: _darkColorScheme 195 | .copyWith(background: _darkColorScheme.background) 196 | .copyWith(error: _darkColorScheme.error), 197 | ); 198 | 199 | // Special casing some widgets to get the desired Adwaita look 200 | // Buttons 201 | 202 | static final _commonButtonStyle = ButtonStyle( 203 | visualDensity: VisualDensity.standard, 204 | backgroundColor: MaterialStateProperty.resolveWith((states) { 205 | if (states.contains(MaterialState.pressed)) { 206 | return AdwaitaColors.light4; 207 | } 208 | return AdwaitaColors.light2; // Use the component's default. 209 | }), 210 | ); 211 | 212 | static final _darkCommonButtonStyle = ButtonStyle( 213 | visualDensity: VisualDensity.standard, 214 | backgroundColor: MaterialStateProperty.resolveWith((states) { 215 | if (states.contains(MaterialState.pressed)) { 216 | return AdwaitaColors.dark5; 217 | } 218 | return AdwaitaColors.dark2; // Use the component's default. 219 | }), 220 | ); 221 | 222 | static final _buttonThemeData = ButtonThemeData( 223 | shape: RoundedRectangleBorder( 224 | borderRadius: BorderRadius.circular(4), 225 | ), 226 | ); 227 | 228 | static final _outlinedButtonThemeData = OutlinedButtonThemeData( 229 | style: OutlinedButton.styleFrom( 230 | foregroundColor: AdwaitaColors.dark4, 231 | visualDensity: _commonButtonStyle.visualDensity, 232 | shape: const RoundedRectangleBorder( 233 | borderRadius: BorderRadius.all(Radius.circular(5)), 234 | ), 235 | ), 236 | ); 237 | 238 | static final _darkOutlinedButtonThemeData = OutlinedButtonThemeData( 239 | style: OutlinedButton.styleFrom( 240 | foregroundColor: Colors.white, 241 | visualDensity: _commonButtonStyle.visualDensity, 242 | shape: RoundedRectangleBorder( 243 | borderRadius: const BorderRadius.all(Radius.circular(20)), 244 | side: BorderSide(color: Colors.black.withOpacity(0.75)), 245 | ), 246 | ), 247 | ); 248 | 249 | static final _textButtonThemeData = TextButtonThemeData( 250 | style: TextButton.styleFrom( 251 | foregroundColor: AdwaitaColors.dark4, 252 | visualDensity: _commonButtonStyle.visualDensity, 253 | backgroundColor: AdwaitaColors.button, 254 | shape: const RoundedRectangleBorder( 255 | borderRadius: BorderRadius.all(Radius.circular(8)), 256 | side: BorderSide(color: Colors.transparent), 257 | ), 258 | ), 259 | ); 260 | 261 | static final _darkTextButtonThemeData = TextButtonThemeData( 262 | style: TextButton.styleFrom( 263 | foregroundColor: Colors.white, 264 | visualDensity: _darkCommonButtonStyle.visualDensity, 265 | backgroundColor: AdwaitaColors.darkButton, 266 | shape: const RoundedRectangleBorder( 267 | borderRadius: BorderRadius.all(Radius.circular(8)), 268 | side: BorderSide(color: Colors.transparent), 269 | ), 270 | ), 271 | ); 272 | 273 | static ElevatedButtonThemeData _getElevatedButtonThemeData( 274 | Brightness brightness, 275 | ) { 276 | if (brightness == Brightness.light) { 277 | return ElevatedButtonThemeData(style: _commonButtonStyle); 278 | } 279 | return ElevatedButtonThemeData(style: _darkCommonButtonStyle); 280 | } 281 | 282 | // Switches 283 | static Color _getSwitchThumbColorDark(Set states) { 284 | if (states.contains(MaterialState.disabled)) { 285 | return AdwaitaColors.dark2; 286 | } else { 287 | if (states.contains(MaterialState.selected)) { 288 | return AdwaitaColors.blueAccent; 289 | } else { 290 | return AdwaitaColors.warmGrey; 291 | } 292 | } 293 | } 294 | 295 | static Color _getSwitchTrackColorDark(Set states) { 296 | if (states.contains(MaterialState.disabled)) { 297 | return AdwaitaColors.dark2.withAlpha(120); 298 | } else { 299 | if (states.contains(MaterialState.selected)) { 300 | return AdwaitaColors.blueAccent.withAlpha(160); 301 | } else { 302 | return AdwaitaColors.warmGrey.withAlpha(80); 303 | } 304 | } 305 | } 306 | 307 | static final _switchStyleDark = SwitchThemeData( 308 | thumbColor: MaterialStateProperty.resolveWith(_getSwitchThumbColorDark), 309 | trackColor: MaterialStateProperty.resolveWith(_getSwitchTrackColorDark), 310 | ); 311 | 312 | static Color _getSwitchThumbColorLight(Set states) { 313 | if (states.contains(MaterialState.disabled)) { 314 | return AdwaitaColors.warmGrey.shade200; 315 | } else { 316 | if (states.contains(MaterialState.selected)) { 317 | return AdwaitaColors.blueAccent; 318 | } else { 319 | return Colors.white; 320 | } 321 | } 322 | } 323 | 324 | static Color _getSwitchTrackColorLight(Set states) { 325 | if (states.contains(MaterialState.disabled)) { 326 | return AdwaitaColors.warmGrey.shade200; 327 | } else { 328 | if (states.contains(MaterialState.selected)) { 329 | return AdwaitaColors.blueAccent.withAlpha(180); 330 | } else { 331 | return AdwaitaColors.warmGrey.shade300; 332 | } 333 | } 334 | } 335 | 336 | static final _switchStyleLight = SwitchThemeData( 337 | thumbColor: MaterialStateProperty.resolveWith(_getSwitchThumbColorLight), 338 | trackColor: MaterialStateProperty.resolveWith(_getSwitchTrackColorLight), 339 | ); 340 | 341 | // Checks 342 | static Color _getCheckFillColorDark(Set states) { 343 | if (!states.contains(MaterialState.disabled)) { 344 | if (states.contains(MaterialState.selected)) { 345 | return AdwaitaColors.blueAccent; 346 | } 347 | return AdwaitaColors.warmGrey.shade400; 348 | } 349 | return AdwaitaColors.warmGrey.withOpacity(0.4); 350 | } 351 | 352 | static Color _getCheckColorDark(Set states) { 353 | if (!states.contains(MaterialState.disabled)) { 354 | return Colors.white; 355 | } 356 | return AdwaitaColors.warmGrey; 357 | } 358 | 359 | static final _checkStyleDark = CheckboxThemeData( 360 | shape: RoundedRectangleBorder( 361 | borderRadius: BorderRadius.circular(2), 362 | ), 363 | fillColor: MaterialStateProperty.resolveWith(_getCheckFillColorDark), 364 | checkColor: MaterialStateProperty.resolveWith(_getCheckColorDark), 365 | ); 366 | 367 | static Color _getCheckFillColorLight(Set states) { 368 | if (!states.contains(MaterialState.disabled)) { 369 | if (states.contains(MaterialState.selected)) { 370 | return AdwaitaColors.blueAccent; 371 | } 372 | return AdwaitaColors.warmGrey; 373 | } 374 | return AdwaitaColors.warmGrey.shade300; 375 | } 376 | 377 | static Color _getCheckColorLight(Set states) { 378 | if (!states.contains(MaterialState.disabled)) { 379 | return Colors.white; 380 | } 381 | return AdwaitaColors.warmGrey; 382 | } 383 | 384 | static final _checkStyleLight = CheckboxThemeData( 385 | shape: RoundedRectangleBorder( 386 | borderRadius: BorderRadius.circular(2), 387 | ), 388 | fillColor: MaterialStateProperty.resolveWith(_getCheckFillColorLight), 389 | checkColor: MaterialStateProperty.resolveWith(_getCheckColorLight), 390 | ); 391 | 392 | // Radios 393 | static final _radioStyleDark = RadioThemeData( 394 | fillColor: MaterialStateProperty.resolveWith(_getCheckFillColorDark), 395 | ); 396 | 397 | static final _radioStyleLight = RadioThemeData( 398 | fillColor: MaterialStateProperty.resolveWith(_getCheckFillColorLight), 399 | ); 400 | 401 | static final _appBarLightTheme = AppBarTheme( 402 | elevation: 1, 403 | titleTextStyle: getTextTheme().headlineSmall, 404 | systemOverlayStyle: SystemUiOverlayStyle.light, 405 | backgroundColor: AdwaitaColors.headerBarBackground, 406 | foregroundColor: AdwaitaColors.headerBarForeground, 407 | iconTheme: const IconThemeData(color: AdwaitaColors.dark3), 408 | actionsIconTheme: const IconThemeData(color: AdwaitaColors.dark3), 409 | ); 410 | 411 | static final _appBarDarkTheme = AppBarTheme( 412 | elevation: 1, 413 | titleTextStyle: getTextTheme(Brightness.dark).headlineSmall, 414 | systemOverlayStyle: SystemUiOverlayStyle.dark, 415 | backgroundColor: AdwaitaColors.darkHeaderBarBackground, 416 | foregroundColor: AdwaitaColors.darkHeaderBarForeground, 417 | ); 418 | } 419 | -------------------------------------------------------------------------------- /lib/src/utils/colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart' show Color, MaterialColor; 2 | 3 | // see https://developer.gnome.org/hig/reference/palette.html 4 | // and https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/stylesheet/_palette.scss 5 | // and https://gitlab.gnome.org/Teams/Design/brand/-/blob/master/brand-book.pdf 6 | 7 | /// The Adwaita color palette 8 | class AdwaitaColors { 9 | const AdwaitaColors._(); 10 | 11 | ///Default accent color 12 | static const Color blueAccent = Color(0xFF4a86cf); 13 | 14 | ///Blue shades 15 | static const Color blue1 = Color(0xFF99C1F1); 16 | static const Color blue2 = Color(0xFF62a0ea); 17 | static const Color blue3 = Color(0xFF3584e4); 18 | static const Color blue4 = Color(0xFF1c71d8); 19 | static const Color blue5 = Color(0xFF1a5fb4); 20 | 21 | ///Green shades 22 | static const Color green1 = Color(0xFF8ff0a4); 23 | static const Color green2 = Color(0xFF57e389); 24 | static const Color green3 = Color(0xFF33d17a); 25 | static const Color green4 = Color(0xFF2ec27e); 26 | static const Color green5 = Color(0xFF26a269); 27 | 28 | ///Yellow shades 29 | static const Color yellow1 = Color(0xFFf9f06b); 30 | static const Color yellow2 = Color(0xFFf8e45c); 31 | static const Color yellow3 = Color(0xFFf6d32d); 32 | static const Color yellow4 = Color(0xFFf5c211); 33 | static const Color yellow5 = Color(0xFFe5a50a); 34 | 35 | ///Orange shades 36 | static const Color orange1 = Color(0xFFffbe6f); 37 | static const Color orange2 = Color(0xFFffa348); 38 | static const Color orange3 = Color(0xFFff7800); 39 | static const Color orange4 = Color(0xFFe66100); 40 | static const Color orange5 = Color(0xFFc64600); 41 | 42 | ///Red shades 43 | static const Color red1 = Color(0xFFf66151); 44 | static const Color red2 = Color(0xFFed333b); 45 | static const Color red3 = Color(0xFFe01b24); 46 | static const Color red4 = Color(0xFFc01c28); 47 | static const Color red5 = Color(0xFFa51d2d); 48 | 49 | ///Purple shades 50 | static const Color purple1 = Color(0xFFdc8add); 51 | static const Color purple2 = Color(0xFFc061cb); 52 | static const Color purple3 = Color(0xFF9141ac); 53 | static const Color purple4 = Color(0xFF813d9c); 54 | static const Color purple5 = Color(0xFF613583); 55 | 56 | ///Brown shades 57 | static const Color brown1 = Color(0xFFcdab8f); 58 | static const Color brown2 = Color(0xFFb5835a); 59 | static const Color brown3 = Color(0xFF986a44); 60 | static const Color brown4 = Color(0xFF865e3c); 61 | static const Color brown5 = Color(0xFF63452c); 62 | 63 | ///Light shades 64 | static const Color light1 = Color(0xFFffffff); 65 | static const Color light2 = Color(0xFFf6f5f4); 66 | static const Color light3 = Color(0xFFdeddda); 67 | static const Color light4 = Color(0xFFc0bfbc); 68 | static const Color light5 = Color(0xFF9a9996); 69 | 70 | ///Dark shades 71 | static const Color dark1 = Color(0xFF77767b); 72 | static const Color dark2 = Color(0xFF5e5c64); 73 | static const Color dark3 = Color(0xFF3d3846); 74 | static const Color dark4 = Color(0xFF241f31); 75 | static const Color dark5 = Color(0xFF000000); 76 | 77 | // Defined in https://gitlab.gnome.org/GNOME/libadwaita/-/blob/main/src/stylesheet/_defaults.scss 78 | ///Background color 79 | static const Color backgroundColor = Color(0xFFfafafa); 80 | 81 | ///Background dark color 82 | static const Color darkBackgroundColor = Color(0xFF242424); 83 | 84 | ///Card background color 85 | static const Color cardBackground = Color(0xFFFFFFFF); 86 | 87 | ///Card dark background color 88 | static const Color darkCardBackground = Color(0xFF383838); 89 | 90 | ///Header bar background color 91 | static const Color headerBarBackground = Color(0xFFebebeb); 92 | 93 | ///Header bar foreground color 94 | static const Color headerBarForeground = Color(0x52000000); 95 | 96 | ///Header bar dark background color 97 | static const Color darkHeaderBarBackground = Color(0xFF303030); 98 | 99 | ///Header bar dark foreground color 100 | static const Color darkHeaderBarForeground = Color(0xFFFFFFFF); 101 | 102 | ///view foreground color 103 | static const Color viewForeground = Color(0xFF000000); 104 | 105 | ///View dark color 106 | static const Color darkViewForeground = Color(0xFFffffff); 107 | 108 | ///Button color 109 | static Color button = viewForeground.withAlpha(25); 110 | 111 | ///Button dark color 112 | static Color darkButton = darkViewForeground.withAlpha(25); 113 | 114 | ///Border color 115 | static Color border = dark5.withOpacity(0.18); 116 | 117 | ///Button dark color 118 | static Color darkBorder = dark5.withOpacity(0.75); 119 | 120 | static MaterialColor _createMaterialColor(Color color) { 121 | final strengths = [.05]; 122 | final swatch = {}; 123 | final r = color.red; 124 | final g = color.green; 125 | final b = color.blue; 126 | 127 | for (var i = 1; i < 10; i++) { 128 | strengths.add(0.1 * i); 129 | } 130 | for (final strength in strengths) { 131 | final ds = 0.5 - strength; 132 | swatch[(strength * 1000).round()] = Color.fromRGBO( 133 | r + ((ds < 0 ? r : (255 - r)) * ds).round(), 134 | g + ((ds < 0 ? g : (255 - g)) * ds).round(), 135 | b + ((ds < 0 ? b : (255 - b)) * ds).round(), 136 | 1, 137 | ); 138 | } 139 | return MaterialColor(color.value, swatch); 140 | } 141 | 142 | /// Default accent swatch color 143 | static MaterialColor primarySwatchColor = _createMaterialColor(blueAccent); 144 | 145 | /// Adwaita grey swatch color 146 | static MaterialColor warmGrey = _createMaterialColor(light4); 147 | } 148 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: adwaita 2 | description: Adwaita style - The default theme for GTK+ for your Flutter app. 3 | version: 1.1.0 4 | homepage: https://github.com/gtk-flutter/adwaita 5 | 6 | environment: 7 | sdk: ">=2.12.0 <4.0.0" 8 | flutter: ">=3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | 14 | dev_dependencies: 15 | very_good_analysis: ^4.0.0 16 | 17 | flutter: 18 | --------------------------------------------------------------------------------