├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── config.yml │ └── feature_request.md ├── README.md └── pull_request_template.md ├── .gitignore ├── .vscode └── launch.json ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── analysis_options.yaml ├── lib ├── dahlia_backend.dart └── src │ ├── api │ ├── data_provider.dart │ ├── device_info.dart │ ├── system_calls.dart │ ├── time_date_manager.dart │ └── wm │ │ ├── hierarchy.dart │ │ ├── properties.dart │ │ └── wm.dart │ ├── data │ ├── data_management.dart │ └── feature_flags.dart │ ├── vars │ └── application.dart │ └── widgets │ ├── acrylic.dart │ ├── blur.dart │ ├── box_container.dart │ └── error_window.dart ├── pubspec.yaml └── test └── dahlia_backend_test.dart /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve the desktop 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **What kind of a bug is it?** 14 | Describe what kind of a bug it is. [e.g. Typo, visual, application bug, OS bug] 15 | 16 | **To Reproduce** 17 | Steps to reproduce the behavior: 18 | 1. Go to '...' 19 | 2. Click on '....' 20 | 3. Scroll down to '....' 21 | 4. See error 22 | 23 | **Expected behavior** 24 | A clear and concise description of what you expected to happen. 25 | 26 | **Screenshots** 27 | If applicable, add screenshots to help explain your problem. 28 | 29 | **Desktop (please complete the following information):** 30 | - OS: [e.g. dahliaOS Linux, dahliaOS Zircon] 31 | - Device: [e.g. MacbookPro9,1, QEMU] 32 | 33 | **Smartphone (please complete the following information):** 34 | - Device: [e.g. iPhone6] 35 | - OS: [e.g. Android, dahliaOS Zircon, dahliaOS Linux] 36 | - Execution Method: [e.g. ADB, Zircon tool] 37 | 38 | **dahliaOS build version** 39 | Write what version of dahliaOS you were using. 40 | 41 | **Additional context** 42 | Add any other context about the problem here. 43 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Help 4 | url: https://dahliaos.io/discord 5 | about: 'If you have a question or need help, join our Discord!' 6 | - name: Documentation issue 7 | url: https://github.com/dahliaos/documentation 8 | about: 'For documentation issues, suggest changes on our documentation repository.' 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for Pangolin 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **For which platform is this feature request?** 20 | - Platform: [Linux, Zircon or Mobile] 21 | 22 | **Do you have an idea of how we would add it?** 23 | If you know how we would approach adding this feature, tell us how. 24 | 25 | **Why should we add it?** 26 | Explain to use how our project can benefit of your feature request. 27 | 28 | **Additional context** 29 | Add any other context or screenshots about the feature request here. -------------------------------------------------------------------------------- /.github/README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 |

5 | Website ● 6 | Discord ● 7 | Releases ● 8 | Donate ● 9 | Documentation 10 | 11 | # backend 12 | 13 | 14 | - **Backend** for the Pangolin Desktop 15 | 16 | ## Contribute 17 | 18 | If you're wondering how to contribute to the project, please refer to [CONTRIBUTING.md](../CONTRIBUTING.md) 19 | 20 | ## License 21 | 22 |

23 | 25 | 26 | Copyright @ 2019-2021 The dahliaOS Authors contact@dahliaos.io 27 | 28 | This project is licensed under the [Apache 2.0 license](../LICENSE) 29 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | # Pull request template 2 | 3 | * Please make sure you read and fill this template out entirely 4 | * PRs that don't have the template filled out will be ignored 5 | 6 | ## Description 7 | 8 | - Please include a summary of the change and which issue is fixed 9 | - Please also include relevant motivation and context (Why is this change required? What problem does it solve?) 10 | - List any dependencies that are required for this change 11 | - If it fixes an open issue, plase link to the issue here 12 | 13 | Fixes #(issue) 14 | 15 | ## Screenshots (if appropriate): 16 | 17 | ## Type of change 18 | 19 | Please tick the relevant option by putting an X inside the bracket 20 | 21 | - [ ] Bug fix (non-breaking change which fixes an issue) 22 | - [ ] New feature (non-breaking change which adds functionality) 23 | - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) 24 | - [ ] This change requires a documentation update 25 | 26 | ## Checklist: 27 | 28 | - [ ] My code follows the guidelines of this project 29 | - [ ] I have performed a self-review of my own code 30 | - [ ] I have commented my code, particularly in hard-to-understand areas 31 | - [ ] I have made corresponding changes to the documentation 32 | - [ ] My changes generate no new warnings 33 | - [ ] All current GitHub actions pass 34 | - [ ] Any dependent changes have been merged and published in downstream modules 35 | - [ ] I have checked my code and corrected any misspellings 36 | - [ ] I have read the [CONTRIBUTING](../CONTRIBUTING.md) document 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Files and directories created by pub 2 | .dart_tool/ 3 | .packages 4 | 5 | # Omit commiting pubspec.lock for library packages: 6 | # https://dart.dev/guides/libraries/private-files#pubspeclock 7 | pubspec.lock 8 | 9 | # Conventional directory for build outputs 10 | build/ 11 | 12 | # Directory created by dartdoc 13 | doc/api/ 14 | 15 | # Flutter/Dart/Pub related 16 | **/doc/api/ 17 | **/ios/Flutter/.last_build_id 18 | .dart_tool/ 19 | .flutter-plugins 20 | .flutter-plugins-dependencies 21 | .packages 22 | .pub-cache/ 23 | .pub/ 24 | /build/ -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // Use IntelliSense to learn about possible attributes. 3 | // Hover to view descriptions of existing attributes. 4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "dahlia_backend", 9 | "request": "launch", 10 | "type": "dart", 11 | "program": "../lib/main.dart", 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 1.0.0 2 | 3 | - Initial version, created by Stagehand 4 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # dahliaOS Code of Conduct 2 | 3 | The dahliaOS team is committed to preserving and fostering a 4 | diverse, welcoming community. Below is our community code of conduct, which 5 | applies to our repos and organizations, issue trackers, Discord servers, 6 | blog content, and any other dahliaOS-supported communication group, as 7 | well as any private communication initiated in the context of these 8 | spaces. This code of conduct must be followed by everyone contributing to 9 | the dahliaOS project, regardless of affiliation or position. 10 | 11 | Simply put, community discussions should be 12 | 13 | * respectful and kind; 14 | * about software; 15 | * about features and code, not the individuals involved. 16 | 17 | ## Be respectful and constructive. 18 | 19 | Treat everyone with respect. Build on each other's ideas. Each of us has the 20 | right to enjoy our experience and participate without fear of harassment, 21 | discrimination, or condescension, whether blatant or subtle. Remember that 22 | dahliaOS is a geographically distributed team and that you may not be 23 | communicating with someone in their primary language. We all get frustrated 24 | when working on hard problems, but we cannot allow that frustration to turn 25 | into personal attacks. 26 | 27 | ## Speak up if you see or hear something. 28 | 29 | You are empowered to politely engage when you feel that you or others are 30 | disrespected. The person making you feel uncomfortable may not be aware of what 31 | they are doing - politely bringing their behavior to their attention is 32 | encouraged. 33 | 34 | If you are uncomfortable speaking up, or feel that your concerns are not being 35 | duly considered, you can email the Project Integrity team at integrity@dahliaos.io to request involvement from a moderator. All 36 | concerns shared with community managers will be kept confidential, but you may 37 | also submit an anonymous report [here](dahlia-os.github.io/anon). 38 | Please note that without a way to contact you, an anonymous report may be 39 | difficult to act on. You may also create a throwaway account to report. In 40 | cases where a public response is deemed necessary, the identities of victims 41 | and reporters will remain confidential unless those individuals instruct us 42 | otherwise. 43 | 44 | While all reports will be taken seriously, the Project Integrity Team may 45 | not act on complaints that they feel are not violations of this code of 46 | conduct. 47 | 48 | ## We will not tolerate harassment of any kind, including but not limited to: 49 | 50 | * Harassing comments 51 | * Intimidation 52 | * Arguing over subjective preference, e.g. text editors, nationality, religion, etc. 53 | * Encouraging a person to engage in self-harm. 54 | * Sustained disruption or derailing of threads, channels, lists, etc. 55 | * Offensive or violent comments, jokes or otherwise 56 | * Inappropriate sexual content 57 | * Unwelcome sexual or otherwise aggressive attention 58 | * Continued one-on-one communication after requests to cease 59 | * Distribution or threat of distribution of people's personally identifying 60 | information, AKA “doxing” 61 | 62 | ## Consequences for failing to comply with this policy 63 | 64 | Consequences for failing to comply with this policy may include, at the sole 65 | discretion of the dahliaOS Project Integrity Team: 66 | 67 | * a request for an apology; 68 | * a private or public warning or reprimand; 69 | * a temporary ban from the Discord server, blog, dahlia-os repository or 70 | organization, or other dahliaOS-supported communication group, including 71 | loss of committer status; 72 | * a permanent ban from any of the above, or from all current and future 73 | dahliaOS-supported communities, including loss of 74 | committer status. 75 | 76 | Participants warned to stop any harassing behavior are expected to comply 77 | immediately; failure to do so will result in an escalation of consequences. 78 | 79 | ## Acknowledgements 80 | 81 | This Code of Conduct is adapted from the Chromium Project Code of Conduct. 82 | 83 | ## License 84 | 85 | This Code of Conduct is available for reuse under the Creative Commons Zero 86 | (CC0) license. 87 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | dahliaOS is open to contributions. Any contribution is appreciated, whether it is a documentation update, localization, bug fix or a new feature. Anyone can contribute as long as they follow this guideline and obey the dahliaOS Code of Conduct. 4 | To make sure your contributions go as smooth as possible, here are all the things you need to know. 5 | 6 | ## Table of contents 7 | 8 | 1. **[Communication](#communication)** 9 | 1. **[Code of Conduct](#code-of-conduct)** 10 | 1. **[Contribute](#contribute)** 11 | 1. [Bug report](#bug-report) 12 | 1. [Before submitting a bug report](#before-submitting-a-bug-report) 13 | 1. [Writing a good bug report](#writing-a-good-bug-report) 14 | 1. [Submitting a bug report](#submitting-a-bug-report) 15 | 1. [Feature request](#feature-request) 16 | 1. [Before submitting a feature request](#before-submitting-a-feature-request) 17 | 1. [Submitting a feature request](#submitting-a-feature-request) 18 | 1. [Pull request](#pull-request) 19 | 1. [Before submitting a pull request](#before-submitting-a-pull-request) 20 | 1. [How to submit a proper pull request](#how-to-submit-a-proper-pull-request) 21 | 1. [After submitting a pull request](#after-submitting-a-pull-request) 22 | 1. [Translations](#translations) 23 | 1. [Before making a translation](#before-making-a-translation) 24 | 1. [How to translate](#how-to-translate) 25 | 1. [Code contributions](#code-contributions) 26 | 1. [First code contribution](#first-code-contribution) 27 | 1. [Design contributions](#design-contributions) 28 | 1. [Financial contributions](#financial-contributions) 29 | 1. [Finding tasks](#finding-tasks) 30 | 1. **[License](#license)** 31 | 32 | ## Communication 33 | 34 | Communication with core dahliaOS development team is crucial for any successful participation in dahliaOS development. There are several methods to communicate with the core team: 35 | 36 | * [Discord](https://dahliaos.io/discord) - We use Discord for pinging people, sharing updates, quick and informal discussions, questions and answers, etc. It is OK to discuss your contribution, planned contribution, development idea, localization, documentation updates and similar topics in this server. Anyone interested in the project is welcome to join our Discord server and hang around. 37 | * [Telegram](https://dahliaos.io/telegram) - Same as Discord. 38 | * [Issues / pull requests](https://github.com/dahliaOS) - Most of the work is discussed here, including upgrades and proposals for upgrades, bug fixing and feature requests. For any of these, open an issue in the corresponding repository. If you are proposing code change, open a pull request. 39 | 40 | Each of them is intended for an specific purpose. Please understand that you may be redirected to some other mean if the communication you intend to have is considered to fit better elsewhere. 41 | 42 | ## Code of Conduct 43 | 44 | This project and everyone participating in it is governed by our Code of Conduct and no one is exempt. 45 | By participating, you are expected to respect and value this code. 46 | dahliaOS Code of Conduct can be found [here](CODE_OF_CONDUCT.md). 47 | If you notice any unacceptable behaviour, we encourage you to report it to integrity@dahliaos.io 48 | 49 | ## Contribute 50 | 51 | In this document we've explained how you can contribute to our project, if you'd like to help out in a different way that is not documented here, you're always free to join our Discord and discuss other options you have in mind with our team. 52 | 53 | You can contribute to the project by: 54 | 55 | * Reporting a bug. 56 | * Proposing new features. 57 | * Translating to your native language. 58 | * Submitting a fix. 59 | * Discussing the current state of code. 60 | * Becoming a maintainer. 61 | * Making a financial contribution. 62 | 63 | ### Bug report 64 | 65 | If you've experienced a bug and you'd like to report it, we highly recommend that you read [Before submitting a bug report](#before-submitting-a-bug-report) and [Writing a good bug report](#writing-a-good-bug-report) first, and that you also use our issue template. 66 | 67 | There are 2 ways you can report a bug, either in our Discord server by **opening a ticket** or by **creating an issue** using the **bug report template** on GitHub. 68 | 69 | #### Before submitting a bug report 70 | 71 | Before submitting a bug report, there are a few things you need to take in consideration: 72 | 73 | * Do a bit of research and check if a similar bug has already been reported. 74 | * If it has been reported already, add a comment to the existing one instead of submitting a new one. 75 | 76 | #### Writing a good bug report 77 | 78 | We have a few short tips for you on how to properly write a bug report so the developers can understand it better: 79 | 80 | * Use a clear and descriptive title for the issue. 81 | * Describe the steps to reproduce the bug. 82 | * Describe what behaviour you observed after the bug occurred. 83 | * Explain what behaviour you expected to see instead and why. 84 | * If the problem wasn't triggered by a specific action, describe what you were doing before it happened. 85 | * Include screenshots of the bug. 86 | * Write what version of dahliaOS you were using. 87 | 88 | And the most important of all make sure to fill in as many fields as possible in our bug report template. 89 | 90 | #### Submitting a bug report 91 | 92 | * **GitHub**: 93 | 1. Click the **Issues** tab 94 | 1. Click **New issue** 95 | 1. Select the **Bug report** template 96 | 1. Fill in the fields 97 | * **Discord**: 98 | 1. Go to the **#bug-report** channel 99 | 1. Open a **ticket** and copy the **form** 100 | 1. Paste and fill in the form 101 | 102 | ### Feature request 103 | 104 | If you'd like to see something added to dahliaOS, we highly recommend that you read [Before submitting a feature request](#before-submitting-a-feature-request) and [Submitting a feature request](#submitting-a-feature-request) first, and that you also use our feature request template. 105 | 106 | To submit a feature request, **create an issue** using the **feature request template** on GitHub. 107 | 108 | #### Before submitting a feature request 109 | 110 | Before submitting a feature request, here are a few things you need to know: 111 | 112 | * Make sure the feature isn't already added. 113 | * Don't hesitate to express your knowledge. 114 | * Write a clear and descriptive title for the request. 115 | * Explain how the project could benefit of your request. 116 | 117 | #### Submitting a feature request 118 | 119 | * **GitHub**: 120 | 1. Click the **Issues** tab 121 | 1. Click **New issue** 122 | 1. Select the **Feature request** template 123 | 1. Fill in the fields 124 | 125 | ### Pull request 126 | 127 | Pull requests to our repositories are always welcome and can be a quick way to get your fix or improvement slated for the next release. In general, pull requests should: 128 | 129 | * Fix an existing issue or add a new feature. 130 | * Be accompanied by a complete pull request template (loaded automatically when a pull request is created). 131 | 132 | For changes that address core functionality or would require breaking changes (e.g. a major release), it's best to open an issue to discuss your proposal first. This is not required but can save time creating and reviewing changes. 133 | 134 | #### Before submitting a pull request 135 | 136 | To make sure that the pull request you want to submit is up to our standards, we've written a few dos and don'ts: 137 | 138 | **Dos**: 139 | 140 | * Provide a meaningful commit message. 141 | * The first line of the commit message should have the format "Category: Brief description of what's being changed". The "category" can be a subdirectory, but also something like "POSIX compliance" or "ClassName". 142 | * Write your commit messages in proper English, with care and punctuation. 143 | * Use the present tense ("Add feature" not "Added feature") 144 | * Use the imperative mood ("Move cursor to..." not "Moves cursor to...") 145 | * Limit the first line to 72 characters or less 146 | * You may want to create a topic branch for larger contributions. 147 | * Split your changes into separate commits. 148 | 149 | **Don'ts**: 150 | 151 | * Touch anything outside the stated scope of the pull request. 152 | * Use weasel-words like "refactor" or "fix" to avoid explaining what's being changed. 153 | 154 | #### How to submit a proper pull request 155 | 156 | 1. **Fork** the repository to your own GitHub account 157 | 1. **Clone** the project to your machine 158 | 1. Make your **changes** 159 | 1. **Push** changes to your fork 160 | 1. **Open a pull request** in our repository and **fill** in the pull request template 161 | 162 | #### After submitting a pull request 163 | 164 | We kindly ask everyone who has submitted a pull request to be patient, we notice every new pull request so don't worry about it being ignored, we'll be on it as soon as possible. 165 | 166 | ### Translations 167 | 168 | We aim to provide our software in as many languages as possible so everyone could experience it in their own native language. 169 | For submitting translations, we use Crowdin so please do not edit the files found in the repositories. 170 | If you're interesting in translating our project, click [here](https://translate.dahliaos.io). 171 | **Note**: If the language you're looking to translate to is not added, let us know and we'll add it right away. 172 | 173 | #### Before making a translation 174 | 175 | Before making a translation, please make sure that: 176 | 177 | * You're fluent in the language you're translating to. 178 | * You pay close attention to grammar. 179 | * You read the context (comments) some strings have. 180 | * You used the same punctuation as the source strings. 181 | 182 | #### How to translate 183 | 184 | 1. Create a **Crowdin** account (if you already don't have one) 185 | 1. Join our **workspace** 186 | 1. Pick a **project** to translate 187 | 1. Apply translations to the available strings 188 | 189 | ### Code contributions 190 | 191 | To make sure that the code you want to contribute is up to our standards, we've written a few dos and don'ts: 192 | 193 | **Dos**: 194 | 195 | * Choose expressive variable, function and class names, make it as obvious as possible of what the code is doing. 196 | 197 | **Don'ts**: 198 | 199 | * Submit code that's incompatible with the project license (Apache 2.0). 200 | * Include commented-out code. 201 | 202 | #### First code contribution 203 | 204 | If you're not yet familiar with the development of dahliaOS, you can tackle tasks labeled with the "good first issue" label on our GitHub as they are more suited for newcomers looking to gain some experience. 205 | 206 | ### Design contributions 207 | 208 | Apart from code contributions, we also accept various kinds of design contributions. 209 | 210 | Here are a few repositories where you can contribute designs: 211 | 212 | * [wallpapers](https://github.com/dahliaos/wallpapers) 213 | * Contribute your own wallpapers made for dahliaOS. 214 | * [icons](https://github.com/dahliaos/icons) 215 | * Contribute/propose new or modified icons for dahliaOS. 216 | * [brand](https://github.com/dahliaos/brand) 217 | * Contribute/propose new or modified logos of our brand. 218 | * [press-kit](https://github.com/dahliaos/press-kit) 219 | * Contribute mockups, screenshots, graphics, marketing material and such for dahliaOS. 220 | 221 | We love seeing concepts and designs, feel free to share them with us on our social media! 222 | 223 | ### Financial contributions 224 | 225 | dahliaOS is an Apache 2.0-licensed free open source project that financially relies mainly on donations. 226 | Donations helps us pay the bills (web hosts, domains, software/hardware, etc.) to keep this project on its feet as long as possible. 227 | If you're interested in sending a donation to dahliaOS, click [here](https://dahliaos.io/donate) to find out where you can do so. Another way you can find donation links is by clicking the Sponsors button in most of our GitHub repositories. 228 | 229 | ### Finding tasks 230 | 231 | If you're interested in contributing to dahliaOS but don't know what you can assist us with, you can find available tasks by: 232 | 233 | * Peeking at GitHub issues / projects 234 | * Asking in our Discord or Telegram 235 | 236 | ## License 237 | 238 | By contributing to dahliaOS, you agree that your contributions will be licensed under the [Apache 2.0](LICENSE) license. 239 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | A library for Dart developers. 2 | 3 | Created from templates made available by Stagehand under a BSD-style 4 | [license](https://github.com/dart-lang/stagehand/blob/master/LICENSE). 5 | 6 | ## Usage 7 | 8 | A simple usage example: 9 | 10 | ```dart 11 | import 'package:dahlia_backend/dahlia_backend.dart'; 12 | 13 | main() { 14 | var awesome = new Awesome(); 15 | } 16 | ``` 17 | 18 | ## Features and bugs 19 | 20 | Please file feature requests and bugs at the [issue tracker][tracker]. 21 | 22 | [tracker]: http://example.com/issues/replaceme 23 | -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # Defines a default set of lint rules enforced for 2 | # projects at Google. For details and rationale, 3 | # see https://github.com/dart-lang/pedantic#enabled-lints. 4 | include: package:pedantic/analysis_options.yaml 5 | 6 | # For lint rules and documentation, see http://dart-lang.github.io/linter/lints. 7 | # Uncomment to specify additional rules. 8 | # linter: 9 | # rules: 10 | # - prefer_single_quotes 11 | 12 | analyzer: 13 | errors: 14 | prefer_single_quotes: ignore 15 | unnecessary_this: ignore 16 | unused_local_variable: ignore 17 | omit_local_variable_types: ignore 18 | # exclude: 19 | # - path/to/excluded/files/** 20 | -------------------------------------------------------------------------------- /lib/dahlia_backend.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | library dahlia_backend; 17 | 18 | export 'src/api/data_provider.dart'; 19 | export 'src/data/data_management.dart'; 20 | export 'src/api/time_date_manager.dart'; 21 | export 'src/widgets/box_container.dart'; 22 | export 'src/vars/application.dart'; 23 | export 'src/api/system_calls.dart'; 24 | export 'src/data/feature_flags.dart'; 25 | export 'src/api/device_info.dart'; 26 | export 'src/api/wm/wm.dart'; 27 | 28 | // TODO: Export any libraries intended for clients of this package. 29 | -------------------------------------------------------------------------------- /lib/src/api/data_provider.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'dart:io'; 17 | 18 | /*Stream dataStream(String path) { 19 | Directory dir = Directory("/home/lars/Desktop"); 20 | return dir.watch(); 21 | } 22 | */ 23 | class DataProvider { 24 | final String path = ""; 25 | 26 | const DataProvider(path); 27 | 28 | Stream? get getDataStream { 29 | Directory dir = Directory(path); 30 | } 31 | 32 | Stream get getData { 33 | Directory dir = Directory(path); 34 | return dir.list(recursive: false).asBroadcastStream(); 35 | } 36 | } 37 | 38 | 39 | /* 40 | void main() { 41 | Directory("/home/lars/Desktop") 42 | .list(recursive: false) 43 | .asBroadcastStream() 44 | .listen((event) { 45 | print("${event.toString()} "); 46 | }); 47 | } 48 | 49 | Future> dirContents(Directory dir) { 50 | var files = []; 51 | var completer = Completer>(); 52 | var lister = dir.list(recursive: false); 53 | lister.listen((file) => files.add(file), 54 | onDone: () => completer.complete(files)); 55 | return completer.future; 56 | } 57 | 58 | Stream test() { 59 | Directory dir = Directory("/home/lars/Desktop"); 60 | return dir.list(recursive: false).asBroadcastStream(); 61 | } 62 | */ -------------------------------------------------------------------------------- /lib/src/api/device_info.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | /* import 'package:battery_plus/battery_plus.dart'; 18 | 19 | var battery = Battery(); 20 | 21 | class DeviceInfo { 22 | static Future get batteryPercantage => battery.batteryLevel; 23 | static Stream get onBatteryStateChanged => 24 | battery.onBatteryStateChanged; 25 | } */ 26 | -------------------------------------------------------------------------------- /lib/src/api/system_calls.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'dart:io'; 17 | 18 | class SystemCalls { 19 | const SystemCalls(); 20 | void powerOff() { 21 | Process.run("poweroff", []); 22 | } 23 | 24 | void restart() { 25 | Process.run("reboot", []); 26 | } 27 | 28 | void sleep() { 29 | Process.run("sleep N", []); 30 | } 31 | 32 | void terminal() { 33 | Process.run("killall", ["pangolin_desktop"]); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /lib/src/api/time_date_manager.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'dart:async'; 17 | import 'package:dahlia_backend/dahlia_backend.dart'; 18 | import 'package:flutter/material.dart'; 19 | import 'package:intl/intl.dart'; 20 | 21 | class DateTimeManager { 22 | /// Current time [ValueNotifier] 23 | /// 24 | /// Notifies about the current time according to the [DateFormat] 25 | static ValueNotifier? _timeNotifier; 26 | 27 | /// Current date [ValueNotifier] 28 | /// 29 | /// Notifies about the current date according to the [DateFormat] 30 | static ValueNotifier? _dateNotifier; 31 | 32 | static String? _time; 33 | static String? _date; 34 | 35 | static void initialiseScheduler() async { 36 | //TODO create an initalisation for the default format 37 | //setTimeFormat('12h+S'); 38 | setDateFormat("dd.MM.yyyy"); 39 | 40 | _timeNotifier = ValueNotifier(_getTimeFormat().format(DateTime.now())); 41 | 42 | _dateNotifier = ValueNotifier( 43 | DateFormat(DatabaseManager.get('dateFormat')).format(DateTime.now())); 44 | 45 | while (true) { 46 | formatTime(); 47 | formatDate(); 48 | await Future.delayed(Duration(seconds: 1)); 49 | } 50 | } 51 | 52 | static ValueNotifier? getTimeNotifier() => _timeNotifier; 53 | 54 | static ValueNotifier? getDateNotifier() => _dateNotifier; 55 | 56 | /// Returns the Time with the selected format 57 | /// 58 | /// eg. 11:30 am | 16:20 59 | /// Note: To get realtime time updates use [getTimeNotifier] 60 | static String? getTime() => _time; 61 | 62 | /// Returns the Date with the selected format 63 | /// 64 | /// eg. 24.12.2021 | 12/24/2021 65 | /// Note: To get realtime date updates use [getDateNotifier] 66 | static String? getDate() => _date; 67 | 68 | /// Format the Date 69 | static void formatDate() { 70 | _date = 71 | DateFormat(DatabaseManager.get('dateFormat')).format(DateTime.now()); 72 | _dateNotifier!.value = _date!; 73 | } 74 | 75 | /// Get the [DateFormat] 76 | static DateFormat _getTimeFormat() { 77 | DateFormat _format; 78 | switch (DatabaseManager.get('timeFormat')) { 79 | case '12h': 80 | _format = DateFormat.jm(); 81 | break; 82 | case '24h': 83 | _format = DateFormat.Hm(); 84 | break; 85 | case '12h+s': 86 | _format = DateFormat.jms(); 87 | break; 88 | case '24h+s': 89 | _format = DateFormat.Hms(); 90 | break; 91 | default: 92 | _format = DateFormat.Hms(); 93 | break; 94 | } 95 | return _format; 96 | } 97 | 98 | /// Format the time 99 | static void formatTime() { 100 | _time = _getTimeFormat().format(DateTime.now()); 101 | _timeNotifier!.value = _time!; 102 | } 103 | 104 | /// Sets the Time Format 105 | /// Choose the time format: 106 | /// am/pm: "12h" 107 | /// 24hr: "24h" 108 | /// am/pm with seconds: "12h+s" 109 | /// 24hr with seconds: "24h+s" 110 | static void setTimeFormat(String format) { 111 | DatabaseManager.set('timeFormat', format.toLowerCase()); 112 | } 113 | 114 | /// Sets the Date Format 115 | /// Choose a time format 116 | /// More information: https://pub.dev/documentation/intl/latest/intl/DateFormat-class.html 117 | static void setDateFormat(String format) { 118 | DatabaseManager.set('dateFormat', format); 119 | } 120 | } 121 | -------------------------------------------------------------------------------- /lib/src/api/wm/hierarchy.dart: -------------------------------------------------------------------------------- 1 | import 'package:dahlia_backend/src/api/wm/wm.dart'; 2 | 3 | extension ExtraWindowHierarchyController on WindowHierarchyController { 4 | void removeFromStableId(String stableId) { 5 | for (final LiveWindowEntry entry in entriesByFocus) { 6 | final String? entryStableId = 7 | entry.registry.maybeGet(WindowExtras.stableId); 8 | 9 | if (entryStableId != null && entryStableId == stableId) { 10 | removeWindowEntry(entry.registry.info.id); 11 | } 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /lib/src/api/wm/properties.dart: -------------------------------------------------------------------------------- 1 | import 'package:dahlia_backend/src/api/wm/wm.dart'; 2 | 3 | class WindowExtras { 4 | static const WindowPropertyKey stableId = 5 | WindowPropertyKey("window.stableId", null, readonly: true); 6 | } 7 | 8 | class ExtraWindowProperties { 9 | final WindowPropertyRegistry _registry; 10 | 11 | const ExtraWindowProperties.mapFrom(this._registry); 12 | 13 | String get stableId => _registry.get(WindowExtras.stableId)!; 14 | 15 | set stableId(String value) => _registry.set(WindowExtras.stableId, value); 16 | } 17 | 18 | extension ExtraRegistryUtils on WindowPropertyRegistry { 19 | ExtraWindowProperties get extra => ExtraWindowProperties.mapFrom(this); 20 | } 21 | -------------------------------------------------------------------------------- /lib/src/api/wm/wm.dart: -------------------------------------------------------------------------------- 1 | export 'package:utopia_wm/wm_new.dart'; 2 | export 'hierarchy.dart'; 3 | export 'properties.dart'; 4 | -------------------------------------------------------------------------------- /lib/src/data/data_management.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import 'package:flutter/material.dart'; 18 | import 'package:hive_flutter/hive_flutter.dart'; 19 | import 'package:flutter/foundation.dart' show kIsWeb; 20 | 21 | class DatabaseManager { 22 | static late Box _hivedb; 23 | static Future initialseDatabase() async { 24 | //final _dir = await getApplicationDocumentsDirectory(); 25 | await Hive.initFlutter(); 26 | //Hive.init(_dir.path); 27 | _hivedb = await Hive.openBox('settings'); 28 | } 29 | 30 | //get 31 | ///Get the Value of a Key 32 | static dynamic get(String key) => _hivedb.get(key); 33 | 34 | //set 35 | ///Set the Value of a Key 36 | static void set(String key, dynamic value) async => 37 | await _hivedb.put(key, value); 38 | 39 | //new entry 40 | ///Checks if the Database already contains the entry and creates a new one if it doesn't 41 | static void newEntry(String key, dynamic value) { 42 | if (!(_hivedb.containsKey(key))) { 43 | set(key, value); 44 | } 45 | } 46 | 47 | //get DatabaseEntry 48 | ///returns the Hive Box 49 | static Box? get getHiveBox => _hivedb; 50 | } 51 | 52 | class PreferenceProvider extends ChangeNotifier { 53 | PreferenceProvider() { 54 | loadData(); 55 | } 56 | 57 | //initial values 58 | double _blur = 25.0; 59 | double _borderRadius = 1.0; 60 | double _themeOpacity = 0.7; 61 | bool _darkMode = false; 62 | List _packages = List.empty(); 63 | String _iconPack = "io.dahlia.icons.default"; 64 | String _wallpaper = "assets/images/wallpapers/Three_Bubbles.png"; 65 | bool _centerTaskbar = true; 66 | bool _enableBlur = true; 67 | bool _randomWallpaper = false; 68 | int _accentColor = Colors.deepOrangeAccent.value; 69 | bool _enableDevOptions = false; 70 | bool _enableAutoTime = true; 71 | bool _showSeconds = false; 72 | bool _enable24h = true; 73 | String _keyboardLayoutName = "en_US"; 74 | double _volumeLevel = 0.5; 75 | bool _enableBluelightFilter = false; 76 | double _brightness = 1.0; 77 | bool _wifi = true; 78 | bool _bluetooth = false; 79 | String _fontFamily = "Roboto"; 80 | bool _useCustomAccentColor = false; 81 | bool _useColoredTitleBar = false; 82 | List _pinnedApps = List.from( 83 | kIsWeb 84 | ? [ 85 | "io.dahlia.calculator", 86 | "io.dahlia.settings", 87 | ] 88 | : [ 89 | "io.dahlia.calculator", 90 | "io.dahlia.terminal", 91 | "io.dahlia.settings", 92 | "io.dahlia.files" 93 | ], 94 | growable: true); 95 | List _recentWallpapers = List.from([], growable: true); 96 | double _taskbarPosition = 2; 97 | int _launcherIcon = Icons.apps.codePoint; 98 | List _recentSearchResults = List.from([], growable: true); 99 | 100 | //getter 101 | double get blur => _blur; 102 | double get borderRadius => _borderRadius; 103 | double get themeOpacity => _themeOpacity; 104 | bool get darkMode => _darkMode; 105 | List get packages => _packages; 106 | String get iconPack => _iconPack; 107 | String get wallpaper => _wallpaper; 108 | bool get centerTaskbar => _centerTaskbar; 109 | bool get enableBlur => _enableBlur; 110 | bool get randomWallpaper => _randomWallpaper; 111 | int get accentColor => _accentColor; 112 | bool get enableDevOptions => _enableDevOptions; 113 | bool get enableAutoTime => _enableAutoTime; 114 | bool get showSeconds => _showSeconds; 115 | bool get enable24h => _enable24h; 116 | String get keyboardLayoutName => _keyboardLayoutName; 117 | double get volumeLevel => _volumeLevel; 118 | bool get enableBluelightFilter => _enableBluelightFilter; 119 | double get brightness => _brightness; 120 | bool get wifi => _wifi; 121 | bool get bluetooth => _bluetooth; 122 | String get fontFamily => _fontFamily; 123 | bool get useCustomAccentColor => _useCustomAccentColor; 124 | bool get useColoredTitlebar => _useColoredTitleBar; 125 | List get pinnedApps => _pinnedApps; 126 | List get recentWallpapers => _recentWallpapers; 127 | double get taskbarPosition => _taskbarPosition; 128 | int get launcherIcon => _launcherIcon; 129 | List get recentSearchResults => _recentSearchResults; 130 | 131 | //setter 132 | set blur(double blur) { 133 | _blur = blur; 134 | notifyListeners(); 135 | DatabaseManager.set("blur", blur); 136 | } 137 | 138 | set borderRadius(double borderRadius) { 139 | _borderRadius = borderRadius; 140 | notifyListeners(); 141 | DatabaseManager.set("borderRadius", borderRadius); 142 | } 143 | 144 | set themeOpacity(double opacity) { 145 | _themeOpacity = opacity; 146 | notifyListeners(); 147 | DatabaseManager.set("themeOpacity", opacity); 148 | } 149 | 150 | set darkMode(bool darkMode) { 151 | _darkMode = darkMode; 152 | notifyListeners(); 153 | DatabaseManager.set("darkMode", darkMode); 154 | } 155 | 156 | set packages(List packages) { 157 | _packages = packages; 158 | notifyListeners(); 159 | DatabaseManager.set("packages", packages); 160 | } 161 | 162 | set iconPack(String iconPack) { 163 | _iconPack = iconPack; 164 | notifyListeners(); 165 | DatabaseManager.set("iconPack", iconPack); 166 | } 167 | 168 | set wallpaper(String path) { 169 | _wallpaper = path; 170 | notifyListeners(); 171 | DatabaseManager.set("wallpaper", path); 172 | } 173 | 174 | set centerTaskbar(bool value) { 175 | _centerTaskbar = value; 176 | notifyListeners(); 177 | DatabaseManager.set("centerTaskbar", value); 178 | } 179 | 180 | set enableBlur(bool value) { 181 | _enableBlur = value; 182 | notifyListeners(); 183 | DatabaseManager.set("enableBlur", value); 184 | } 185 | 186 | set randomWallpaper(bool value) { 187 | _randomWallpaper = value; 188 | notifyListeners(); 189 | DatabaseManager.set("randomWallpaper", value); 190 | } 191 | 192 | set accentColor(int value) { 193 | _accentColor = value; 194 | notifyListeners(); 195 | DatabaseManager.set("accentColor", value); 196 | } 197 | 198 | set enableDevOptions(bool value) { 199 | _enableDevOptions = value; 200 | notifyListeners(); 201 | DatabaseManager.set("enableDeveloperOptions", value); 202 | } 203 | 204 | set enableAutoTime(bool value) { 205 | _enableAutoTime = value; 206 | notifyListeners(); 207 | DatabaseManager.set("enableAutoTime", value); 208 | } 209 | 210 | set showSeconds(bool value) { 211 | _showSeconds = value; 212 | notifyListeners(); 213 | DatabaseManager.set("showSeconds", value); 214 | } 215 | 216 | set enable24h(bool value) { 217 | _enable24h = value; 218 | notifyListeners(); 219 | DatabaseManager.set("enable24h", value); 220 | } 221 | 222 | set keyboardLayoutName(String value) { 223 | _keyboardLayoutName = value; 224 | notifyListeners(); 225 | DatabaseManager.set("keyboardLayoutName", value); 226 | } 227 | 228 | set volumeLevel(double value) { 229 | _volumeLevel = value; 230 | notifyListeners(); 231 | DatabaseManager.set("volumeLevel", value); 232 | } 233 | 234 | set enableBluelightFilter(bool value) { 235 | _enableBluelightFilter = value; 236 | notifyListeners(); 237 | DatabaseManager.set("enableBluelightFilter", value); 238 | } 239 | 240 | set brightness(double value) { 241 | _brightness = value; 242 | notifyListeners(); 243 | DatabaseManager.set("brightness", value); 244 | } 245 | 246 | set wifi(bool value) { 247 | _wifi = value; 248 | notifyListeners(); 249 | DatabaseManager.set("wifi", value); 250 | } 251 | 252 | set bluetooth(bool value) { 253 | _bluetooth = value; 254 | notifyListeners(); 255 | DatabaseManager.set("bluetooth", value); 256 | } 257 | 258 | set fontFamily(String font) { 259 | _fontFamily = font; 260 | notifyListeners(); 261 | DatabaseManager.set("fontFamily", font); 262 | } 263 | 264 | set useCustomAccentColor(bool val) { 265 | _useCustomAccentColor = val; 266 | notifyListeners(); 267 | DatabaseManager.set("useCustomAccentColor", val); 268 | } 269 | 270 | set useColoredTitlebar(bool val) { 271 | _useColoredTitleBar = val; 272 | notifyListeners(); 273 | DatabaseManager.set("useColoredTitlebar", val); 274 | } 275 | 276 | void togglePinnedApp(String packageName) { 277 | !_pinnedApps.contains(packageName) 278 | ? _pinnedApps.add(packageName) 279 | : _pinnedApps.remove(packageName); 280 | notifyListeners(); 281 | DatabaseManager.set("pinnedApps", _pinnedApps); 282 | } 283 | 284 | void addRecentWallpaper(String ref) { 285 | if (!_recentWallpapers.contains(ref)) { 286 | _recentWallpapers.add(ref); 287 | notifyListeners(); 288 | DatabaseManager.set("recentWallpapers", _recentWallpapers); 289 | } 290 | } 291 | 292 | set taskbarPosition(double value) { 293 | _taskbarPosition = value; 294 | notifyListeners(); 295 | DatabaseManager.set("taskbarPosition", value); 296 | } 297 | 298 | set launcherIcon(int codePoint) { 299 | _launcherIcon = codePoint; 300 | notifyListeners(); 301 | DatabaseManager.set("launcherIcon", codePoint); 302 | } 303 | 304 | void addRecentSearchResult(String value) { 305 | _recentSearchResults.add(value); 306 | notifyListeners(); 307 | DatabaseManager.set("recentSearchResults", _recentSearchResults); 308 | } 309 | 310 | //load from Database 311 | void loadData() { 312 | blur = DatabaseManager.get("blur") ?? blur; 313 | borderRadius = DatabaseManager.get("borderRadius") ?? borderRadius; 314 | themeOpacity = DatabaseManager.get("themeOpacity") ?? themeOpacity; 315 | darkMode = DatabaseManager.get("darkMode") ?? darkMode; 316 | packages = DatabaseManager.get("packages") ?? packages; 317 | iconPack = DatabaseManager.get("iconPack") ?? iconPack; 318 | wallpaper = DatabaseManager.get("wallpaper") ?? wallpaper; 319 | centerTaskbar = DatabaseManager.get("centerTaskbar") ?? centerTaskbar; 320 | enableBlur = DatabaseManager.get("enableBlur") ?? enableBlur; 321 | randomWallpaper = DatabaseManager.get("randomWallpaper") ?? randomWallpaper; 322 | accentColor = DatabaseManager.get("accentColor") ?? accentColor; 323 | enableDevOptions = 324 | DatabaseManager.get("enableDeveloperOptions") ?? enableDevOptions; 325 | enableAutoTime = DatabaseManager.get("enableAutoTme") ?? enableAutoTime; 326 | showSeconds = DatabaseManager.get("showSeconds") ?? showSeconds; 327 | enable24h = DatabaseManager.get("enable24h") ?? enable24h; 328 | keyboardLayoutName = 329 | DatabaseManager.get("keyboardLayoutName") ?? keyboardLayoutName; 330 | volumeLevel = DatabaseManager.get("volumeLevel") ?? volumeLevel; 331 | enableBluelightFilter = 332 | DatabaseManager.get("enableBluelightFilter") ?? enableBluelightFilter; 333 | brightness = DatabaseManager.get("brightness") ?? brightness; 334 | wifi = DatabaseManager.get("wifi") ?? wifi; 335 | bluetooth = DatabaseManager.get("bluetooth") ?? bluetooth; 336 | fontFamily = DatabaseManager.get("fontFamily") ?? fontFamily; 337 | useCustomAccentColor = 338 | DatabaseManager.get("useCustomAccentColor") ?? useCustomAccentColor; 339 | useColoredTitlebar = 340 | DatabaseManager.get("useColoredTitlebar") ?? useColoredTitlebar; 341 | _pinnedApps = List.from(DatabaseManager.get("pinnedApps") ?? pinnedApps); 342 | _recentWallpapers = 343 | List.from(DatabaseManager.get("recentWallpapers") ?? recentWallpapers); 344 | _taskbarPosition = 345 | DatabaseManager.get("taskbarPosition") ?? taskbarPosition; 346 | _launcherIcon = DatabaseManager.get("launcherIcon") ?? launcherIcon; 347 | _recentSearchResults = 348 | DatabaseManager.get("recentSearchResults") ?? recentSearchResults; 349 | } 350 | } 351 | -------------------------------------------------------------------------------- /lib/src/data/feature_flags.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'package:dahlia_backend/dahlia_backend.dart'; 17 | import 'package:flutter/material.dart'; 18 | 19 | class FeatureFlags extends ChangeNotifier { 20 | FeatureFlags() { 21 | _loadData(); 22 | } 23 | 24 | //FeatureFlag Keys 25 | bool _useAcrylic = false; 26 | bool _jsonOverride = false; 27 | bool _useAccentColorBG = false; 28 | //Getter 29 | bool get useAcrylic => _useAcrylic; 30 | bool get jsonOverride => _jsonOverride; 31 | bool get useAccentColorBG => _useAccentColorBG; 32 | //Setter 33 | set useAcrylic(bool value) { 34 | _useAcrylic = value; 35 | notifyListeners(); 36 | DatabaseManager.set("feature_useAcrylic", value); 37 | } 38 | 39 | set jsonOverride(bool value) { 40 | _jsonOverride = value; 41 | notifyListeners(); 42 | DatabaseManager.set("feature_jsonOverride", value); 43 | } 44 | 45 | set useAccentColorBG(bool value) { 46 | _useAccentColorBG = value; 47 | notifyListeners(); 48 | DatabaseManager.set("feature_useAccentColorBG", value); 49 | } 50 | 51 | //Load Values 52 | void _loadData() { 53 | useAcrylic = DatabaseManager.get("feature_useAcrylic") ?? useAcrylic; 54 | jsonOverride = DatabaseManager.get("feature_jsonOverride") ?? jsonOverride; 55 | useAccentColorBG = 56 | DatabaseManager.get("feature_useAccentColorBG") ?? useAccentColorBG; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /lib/src/vars/application.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'package:flutter/widgets.dart'; 17 | 18 | class Application { 19 | final String? name, version, description, packageName; 20 | final Widget? app; 21 | final ApplicationCategory? category; 22 | final bool isTest; 23 | final String? iconName; 24 | final Color? color; 25 | final bool supportsWeb; 26 | const Application( 27 | {required this.app, 28 | required this.packageName, 29 | this.category, 30 | this.description, 31 | this.iconName, 32 | required this.name, 33 | this.color, 34 | this.isTest = false, 35 | this.version, 36 | this.supportsWeb = true}); 37 | const Application.testing( 38 | {required this.app, 39 | required this.packageName, 40 | this.category = ApplicationCategory.TESTING, 41 | this.description = "TESING APP", 42 | this.iconName, 43 | required this.name, 44 | this.isTest = true, 45 | this.color, 46 | this.version = "TEST", 47 | this.supportsWeb = true}); 48 | } 49 | 50 | enum ApplicationCategory { 51 | INTERNET, 52 | MEDIA, 53 | GAMING, 54 | DEVELOPMENT, 55 | SYSTEM, 56 | OFFICE, 57 | TESTING 58 | } 59 | -------------------------------------------------------------------------------- /lib/src/widgets/acrylic.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import 'dart:math'; 18 | import 'dart:ui'; 19 | 20 | import 'package:dahlia_backend/dahlia_backend.dart'; 21 | import 'package:flutter/material.dart'; 22 | import 'package:provider/provider.dart'; 23 | 24 | // Credits: @HrX03 (https://github.com/hrx03) 25 | class Acrylic extends StatelessWidget { 26 | final bool useBlur; 27 | final Color color; 28 | final Widget? child; 29 | final double? opacity, blurRadius, customBlur; 30 | Acrylic( 31 | {required this.color, 32 | required this.child, 33 | this.useBlur = true, 34 | this.opacity, 35 | this.customBlur, 36 | this.blurRadius}); 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | final _pref = Provider.of(context); 41 | final _tint = AcrylicHelper.getEffectiveTintColor(color, opacity ?? 0.9); 42 | return Material( 43 | color: Colors.transparent, 44 | clipBehavior: Clip.antiAlias, 45 | child: BackdropFilter( 46 | filter: ImageFilter.blur( 47 | sigmaX: useBlur 48 | ? customBlur == null 49 | ? (_pref.enableBlur ? blurRadius ?? 24 : 0) 50 | : customBlur! 51 | : 0, 52 | sigmaY: useBlur 53 | ? customBlur == null 54 | ? (_pref.enableBlur ? blurRadius ?? 24 : 0) 55 | : customBlur! 56 | : 0, 57 | ), 58 | child: CustomPaint( 59 | painter: _AcrylicPainter( 60 | context: context, 61 | tintColor: _pref.enableBlur || useBlur ? _tint : Colors.transparent, 62 | luminosityColor: AcrylicHelper.getLuminosityColor( 63 | _pref.enableBlur || useBlur ? _tint : Colors.transparent, 64 | opacity ?? 0.9), 65 | ), 66 | child: BackdropFilter( 67 | filter: ImageFilter.blur( 68 | sigmaX: useBlur 69 | ? customBlur == null 70 | ? (_pref.enableBlur || useBlur ? blurRadius ?? 24 : 0) 71 | : customBlur! 72 | : 0, 73 | sigmaY: useBlur 74 | ? customBlur == null 75 | ? (_pref.enableBlur || useBlur ? blurRadius ?? 24 : 0) 76 | : customBlur! 77 | : 0, 78 | ), 79 | child: Stack( 80 | children: [ 81 | Opacity( 82 | opacity: _pref.enableBlur ? 0.025 : 0, 83 | child: DecoratedBox( 84 | decoration: BoxDecoration( 85 | image: DecorationImage( 86 | image: AssetImage( 87 | "global/assets/NoiseAsset_256X256_PNG.png"), 88 | alignment: Alignment.topLeft, 89 | repeat: ImageRepeat.repeat, 90 | ), 91 | backgroundBlendMode: BlendMode.srcOver, 92 | color: Colors.transparent, 93 | ), 94 | child: Container(), 95 | ), 96 | ), 97 | Align( 98 | /* left: 0, 99 | right: 0, 100 | top: 0, 101 | bottom: 0, */ 102 | alignment: Alignment.center, 103 | child: child ?? Container()), 104 | ], 105 | ), 106 | ), 107 | ), 108 | ), 109 | ); 110 | } 111 | } 112 | 113 | // Credits: @HrX03 (https://github.com/hrx03) 114 | class _AcrylicPainter extends CustomPainter { 115 | static final Color red = Color(0xFFFF0000).withOpacity(0.12); 116 | static final Color blue = Color(0xFF00FF00).withOpacity(0.12); 117 | static final Color green = Color(0xFF0000FF).withOpacity(0.12); 118 | final Color luminosityColor; 119 | final Color tintColor; 120 | final BuildContext context; 121 | 122 | _AcrylicPainter( 123 | {required this.luminosityColor, 124 | required this.tintColor, 125 | required this.context}); 126 | 127 | @override 128 | void paint(Canvas canvas, Size size) { 129 | canvas.drawColor(luminosityColor, BlendMode.luminosity); 130 | if (context.read().enableBlur) { 131 | canvas.drawColor(red, BlendMode.saturation); 132 | canvas.drawColor(blue, BlendMode.saturation); 133 | canvas.drawColor(green, BlendMode.saturation); 134 | canvas.drawColor( 135 | tintColor, 136 | tintColor.opacity == 1 ? BlendMode.srcIn : BlendMode.color, 137 | ); 138 | canvas.drawColor( 139 | Color(Provider.of(context, listen: false) 140 | .accentColor) 141 | .withOpacity(0.05), 142 | BlendMode.color); 143 | } 144 | } 145 | 146 | @override 147 | bool shouldRepaint(_AcrylicPainter old) { 148 | return this.luminosityColor != old.luminosityColor || 149 | this.tintColor != old.tintColor; 150 | } 151 | } 152 | 153 | // Credits: @HrX03 (https://github.com/hrx03) 154 | /// Microsoft utils converted from C# to dart 155 | class AcrylicHelper { 156 | static Color getEffectiveTintColor(Color color, double opacity) { 157 | // Update tintColor's alpha with the combined opacity value 158 | // If LuminosityOpacity was specified, we don't intervene into users parameters 159 | return color.withOpacity(opacity); 160 | } 161 | 162 | static Color getLuminosityColor(Color tintColor, double? luminosityOpacity) { 163 | // If luminosity opacity is specified, just use the values as is 164 | if (luminosityOpacity != null) { 165 | return Color.fromRGBO( 166 | tintColor.red, 167 | tintColor.green, 168 | tintColor.blue, 169 | luminosityOpacity.clamp(0.0, 1.0), 170 | ); 171 | } else { 172 | // To create the Luminosity blend input color without luminosity opacity, 173 | // we're taking the TintColor input, converting to HSV, and clamping the V between these values 174 | const double minHsvV = 0.125; 175 | const double maxHsvV = 0.965; 176 | 177 | HSVColor hsvTintColor = HSVColor.fromColor(tintColor); 178 | 179 | double clampedHsvV = hsvTintColor.value.clamp(minHsvV, maxHsvV); 180 | 181 | HSVColor hsvLuminosityColor = hsvTintColor.withValue(clampedHsvV); 182 | Color rgbLuminosityColor = hsvLuminosityColor.toColor(); 183 | 184 | // Now figure out luminosity opacity 185 | // Map original *tint* opacity to this range 186 | const double minLuminosityOpacity = 0.15; 187 | const double maxLuminosityOpacity = 1.03; 188 | 189 | const double luminosityOpacityRangeMax = 190 | maxLuminosityOpacity - minLuminosityOpacity; 191 | double mappedTintOpacity = 192 | ((tintColor.alpha / 255.0) * luminosityOpacityRangeMax) + 193 | minLuminosityOpacity; 194 | 195 | // Finally, combine the luminosity opacity and the HsvV-clamped tint color 196 | return Color.fromRGBO( 197 | rgbLuminosityColor.red, 198 | rgbLuminosityColor.green, 199 | rgbLuminosityColor.blue, 200 | min(mappedTintOpacity, 1.0), 201 | ); 202 | } 203 | } 204 | 205 | static double getTintOpacityModifier(Color color) { 206 | // Mid point of HsvV range that these calculations are based on. This is here for easy tuning. 207 | const double midPoint = 0.50; 208 | 209 | const double whiteMaxOpacity = 0.45; // 100% luminosity 210 | const double midPointMaxOpacity = 0.90; // 50% luminosity 211 | const double blackMaxOpacity = 0.85; // 0% luminosity 212 | 213 | HSVColor hsv = HSVColor.fromColor(color); 214 | 215 | double opacityModifier = midPointMaxOpacity; 216 | 217 | if (hsv.value != midPoint) { 218 | // Determine maximum suppression amount 219 | double lowestMaxOpacity = midPointMaxOpacity; 220 | double maxDeviation = midPoint; 221 | 222 | if (hsv.value > midPoint) { 223 | lowestMaxOpacity = whiteMaxOpacity; // At white (100% hsvV) 224 | maxDeviation = 1 - maxDeviation; 225 | } else if (hsv.value < midPoint) { 226 | lowestMaxOpacity = blackMaxOpacity; // At black (0% hsvV) 227 | } 228 | 229 | double maxOpacitySuppression = midPointMaxOpacity - lowestMaxOpacity; 230 | 231 | // Determine normalized deviation from the midpoint 232 | double deviation = (hsv.value - midPoint); 233 | double normalizedDeviation = deviation / maxDeviation; 234 | 235 | // If we have saturation, reduce opacity suppression to allow that color to come through more 236 | if (hsv.saturation > 0) { 237 | // Dampen opacity suppression based on how much saturation there is 238 | maxOpacitySuppression *= max(1 - (hsv.saturation * 2), 0.0); 239 | } 240 | 241 | double opacitySuppression = maxOpacitySuppression * normalizedDeviation; 242 | 243 | opacityModifier = midPointMaxOpacity - opacitySuppression; 244 | } 245 | 246 | return opacityModifier; 247 | } 248 | } 249 | -------------------------------------------------------------------------------- /lib/src/widgets/blur.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'dart:ui'; 17 | import 'package:dahlia_backend/dahlia_backend.dart'; 18 | import 'package:flutter/material.dart'; 19 | import 'package:provider/provider.dart'; 20 | 21 | class Blur extends StatelessWidget { 22 | final Widget? child; 23 | final bool? useBlur; 24 | final BorderRadius? borderRadius; 25 | final double? customBlur; 26 | Blur( 27 | {Key? key, 28 | @required this.child, 29 | this.borderRadius, 30 | this.useBlur, 31 | this.customBlur}) 32 | : super(key: key); 33 | @override 34 | Widget build(BuildContext context) { 35 | final _data = context.watch(); 36 | return ClipRRect( 37 | borderRadius: borderRadius ?? BorderRadius.circular(_data.borderRadius), 38 | clipBehavior: Clip.hardEdge, 39 | child: BackdropFilter( 40 | filter: ImageFilter.blur( 41 | sigmaX: (useBlur ?? true) 42 | ? (customBlur ?? (_data.enableBlur ? _data.blur : 0.0)) 43 | : 0.0, 44 | sigmaY: (useBlur ?? true) 45 | ? (customBlur ?? (_data.enableBlur ? _data.blur : 0.0)) 46 | : 0.0), 47 | child: child, 48 | )); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/widgets/box_container.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | 17 | import 'package:dahlia_backend/src/widgets/acrylic.dart'; 18 | import 'package:flutter/material.dart'; 19 | 20 | class BoxSurface extends StatelessWidget { 21 | final EdgeInsetsGeometry? padding, margin; 22 | final BorderRadius borderRadius; 23 | final Widget? child; 24 | final double? width, height; 25 | final bool outline; 26 | final bool dropShadow; 27 | const BoxSurface({ 28 | Key? key, 29 | this.child, 30 | this.borderRadius = BorderRadius.zero, 31 | this.padding, 32 | this.margin, 33 | this.width, 34 | this.height, 35 | this.outline = false, 36 | this.dropShadow = false, 37 | }) : super(key: key); 38 | 39 | @override 40 | Widget build(BuildContext context) { 41 | final bool _darkMode = Theme.of(context).brightness == Brightness.dark; 42 | return Container( 43 | width: width, 44 | height: height, 45 | padding: padding, 46 | margin: margin, 47 | decoration: ShapeDecoration( 48 | shape: RoundedRectangleBorder( 49 | // Set border radius of the surface area 50 | borderRadius: borderRadius, 51 | ), 52 | shadows: dropShadow 53 | ? [ 54 | BoxShadow( 55 | color: Colors.black.withOpacity(0.10), 56 | blurRadius: 25, 57 | spreadRadius: 10) 58 | ] 59 | : [], 60 | ), 61 | foregroundDecoration: ShapeDecoration( 62 | color: Colors.transparent, 63 | shape: RoundedRectangleBorder( 64 | // Set border radius of the surface area 65 | borderRadius: borderRadius, 66 | // Create outline around the surface 67 | side: outline 68 | ? BorderSide.none 69 | : BorderSide.none, 70 | ), 71 | ), 72 | child: ClipRRect( 73 | borderRadius: borderRadius, 74 | child: Acrylic( 75 | opacity: 0.65, 76 | blurRadius: 24, 77 | color: Theme.of(context).backgroundColor, 78 | child: child, 79 | ), 80 | ), 81 | ); 82 | } 83 | } 84 | 85 | class BoxContainer extends StatelessWidget { 86 | final EdgeInsetsGeometry? padding, margin; 87 | final BorderRadius borderRadius; 88 | final Widget? child; 89 | final double? width, height; 90 | final bool outline; 91 | const BoxContainer({ 92 | Key? key, 93 | this.child, 94 | this.borderRadius = BorderRadius.zero, 95 | this.padding, 96 | this.margin, 97 | this.width, 98 | this.height, 99 | this.outline = false, 100 | }) : super(key: key); 101 | 102 | @override 103 | Widget build(BuildContext context) { 104 | final bool _darkMode = Theme.of(context).brightness == Brightness.dark; 105 | return Container( 106 | width: width, 107 | height: height, 108 | padding: padding, 109 | margin: margin, 110 | foregroundDecoration: ShapeDecoration( 111 | color: Colors.transparent, 112 | shape: RoundedRectangleBorder( 113 | // Set border radius of the surface area 114 | borderRadius: borderRadius, 115 | // Create outline around the surface 116 | side: outline 117 | ? BorderSide( 118 | color: _darkMode 119 | ? Colors.white.withOpacity(0.1) 120 | : Colors.black.withOpacity(0.2), 121 | width: 2, 122 | ) 123 | : BorderSide.none, 124 | ), 125 | ), 126 | child: ClipRRect( 127 | borderRadius: borderRadius, 128 | child: Acrylic( 129 | opacity: 0.65, 130 | blurRadius: 24, 131 | color: Theme.of(context).backgroundColor, 132 | child: child, 133 | ), 134 | ), 135 | ); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /lib/src/widgets/error_window.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | import 'package:dahlia_backend/dahlia_backend.dart'; 17 | import 'package:flutter/material.dart'; 18 | 19 | class ErrorWindow extends StatelessWidget { 20 | @override 21 | Widget build(BuildContext context) { 22 | return BoxSurface( 23 | child: Center( 24 | child: Column( 25 | mainAxisAlignment: MainAxisAlignment.center, 26 | crossAxisAlignment: CrossAxisAlignment.center, 27 | children: [ 28 | Text( 29 | "ERROR", 30 | style: TextStyle(fontSize: 25, fontWeight: FontWeight.bold), 31 | ), 32 | SizedBox( 33 | height: 4, 34 | ), 35 | Text( 36 | "Please try again or contact the support", 37 | style: TextStyle(fontSize: 17, fontWeight: FontWeight.bold), 38 | ), 39 | ], 40 | ), 41 | ), 42 | ); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: dahlia_backend 2 | description: Backend for the pangolin desktop 3 | version: 0.0.1+1 4 | publish_to: 'none' 5 | homepage: https://dahliaos.io 6 | 7 | environment: 8 | sdk: ">=2.12.0-0 <3.0.0" 9 | 10 | dependencies: 11 | flutter: 12 | sdk: flutter 13 | provider: ^6.0.0 14 | path_provider: any 15 | hive: ^2.0.0 16 | intl: ^0.17.0-nullsafety.2 17 | hive_flutter: any 18 | utopia_wm: 19 | git: 20 | url: https://github.com/dahliaOS/utopia.git 21 | ref: utopia 22 | 23 | dev_dependencies: 24 | pedantic: ^1.9.0 25 | test: ^1.14.4 26 | vm_service: ^6.1.0+1 27 | flutter_test: 28 | sdk: flutter 29 | 30 | flutter: 31 | assets: 32 | - ../global/assets/ -------------------------------------------------------------------------------- /test/dahlia_backend_test.dart: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2021 The dahliaOS Authors 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | /*import 'package:dahlia_backend/dahlia_backend.dart'; 17 | import 'package:test/test.dart'; 18 | 19 | void main() { 20 | group('A group of tests', () { 21 | Awesome awesome; 22 | 23 | setUp(() { 24 | awesome = Awesome(); 25 | }); 26 | 27 | test('First Test', () { 28 | expect(awesome.isAwesome, isTrue); 29 | }); 30 | }); 31 | } 32 | */ 33 | --------------------------------------------------------------------------------