├── LICENSE ├── README.md └── sudoku ├── .gitignore ├── .metadata ├── analysis_options.yaml ├── android ├── .gitignore ├── app │ ├── build.gradle │ └── src │ │ ├── debug │ │ └── AndroidManifest.xml │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── ic_launcher-playstore.png │ │ ├── kotlin │ │ │ └── com │ │ │ │ └── varuns2002 │ │ │ │ └── sudoku │ │ │ │ └── MainActivity.kt │ │ └── res │ │ │ ├── drawable-hdpi │ │ │ └── splash.png │ │ │ ├── drawable-mdpi │ │ │ └── splash.png │ │ │ ├── drawable-v21 │ │ │ ├── background.png │ │ │ └── launch_background.xml │ │ │ ├── drawable-xhdpi │ │ │ └── splash.png │ │ │ ├── drawable-xxhdpi │ │ │ └── splash.png │ │ │ ├── drawable-xxxhdpi │ │ │ └── splash.png │ │ │ ├── drawable │ │ │ ├── background.png │ │ │ ├── ic_launcher_foreground.xml │ │ │ └── launch_background.xml │ │ │ ├── mipmap-anydpi-v26 │ │ │ ├── ic_launcher.xml │ │ │ └── ic_launcher_round.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ ├── ic_launcher_foreground.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-night │ │ │ └── styles.xml │ │ │ ├── values-v29 │ │ │ └── styles.xml │ │ │ ├── values-v31 │ │ │ └── styles.xml │ │ │ └── values │ │ │ ├── ic_launcher_background.xml │ │ │ └── styles.xml │ │ └── profile │ │ └── AndroidManifest.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ └── gradle-wrapper.properties ├── settings.gradle └── version.properties ├── assets └── icon │ ├── icon_foreground.png │ ├── icon_foreground_vector_108x108.svg │ ├── icon_foreground_vector_400x400.svg │ ├── icon_round.png │ └── icon_square.png ├── flutter_native_splash.yaml ├── lib ├── alerts │ ├── about.dart │ ├── accent_colors.dart │ ├── all.dart │ ├── difficulty.dart │ ├── exit.dart │ ├── game_over.dart │ └── numbers.dart ├── board_style.dart ├── main.dart ├── material_color_generator.dart ├── splash_screen_page.dart └── styles.dart ├── pubspec.lock ├── pubspec.yaml ├── web ├── favicon.ico ├── icons │ ├── Icon-128.png │ ├── Icon-192.png │ ├── Icon-384.png │ ├── Icon-512.png │ ├── Icon-72.png │ ├── Icon-96.png │ ├── Icon-maskable-128.png │ ├── Icon-maskable-192.png │ ├── Icon-maskable-384.png │ ├── Icon-maskable-512.png │ ├── Icon-maskable-72.png │ └── Icon-maskable-96.png ├── index.html ├── manifest.json ├── screenshots │ ├── Choose_324x648.png │ ├── Options_324x648.png │ ├── Result_324x648.png │ ├── Solved_Dark_324x648.png │ └── Solving_Light_324x648.png └── splash │ ├── img │ ├── dark-1x.png │ ├── dark-2x.png │ ├── dark-3x.png │ └── dark-4x.png │ ├── splash.js │ └── style.css └── windows ├── .gitignore ├── CMakeLists.txt ├── flutter ├── CMakeLists.txt ├── generated_plugin_registrant.cc ├── generated_plugin_registrant.h └── generated_plugins.cmake └── runner ├── CMakeLists.txt ├── Runner.rc ├── flutter_window.cpp ├── flutter_window.h ├── main.cpp ├── resource.h ├── resources └── app_icon.ico ├── runner.exe.manifest ├── utils.cpp ├── utils.h ├── win32_window.cpp └── win32_window.h /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | icon_square 2 | 3 | # Flutter-Sudoku 4 | 5 | ## [Play Online](https://sudoku-vs2002.web.app/) 6 | 7 | ## [Downloads](https://github.com/VarunS2002/Flutter-Sudoku/releases) 8 | 9 | > [![APK: v2.4.0](https://img.shields.io/badge/APK-v2.4.0-brightgreen)](https://github.com/VarunS2002/Flutter-Sudoku/releases/download/2.4.0/Sudoku_2.4.0.apk) 10 | [![EXE: v2.4.0](https://img.shields.io/badge/EXE-v2.4.0-brightgreen)](https://github.com/VarunS2002/Flutter-Sudoku/releases/download/2.4.0/Sudoku_2.4.0.exe) 11 | [![Web: v2.4.1](https://img.shields.io/badge/Web-v2.4.1-brightgreen)](https://sudoku-vs2002.web.app/) 12 | [![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) 13 | 14 | This is a fully fledged Sudoku game written in Dart using Flutter. 15 | 16 | It can be exported to Android, iOS, Fuchsia, Windows, Linux, MacOS, PWA or a Web App. 17 | 18 | ## Installation & Usage: 19 | 20 | - Can be played online in the browser. See [Play Online](#play-online) 21 | 22 | - Can be installed as a Progressive Web App on any platform. 23 | See [Use Progressive Web Apps](https://support.google.com/chrome/answer/9658361?co=GENIE.Platform%3DAndroid&hl=en) 24 | 25 | - Can be installed as an Android app. See [Downloads](https://github.com/VarunS2002/Flutter-Sudoku/releases) 26 | 27 | ## Building: 28 | 29 | ### Requirements: 30 | 31 | - [Flutter](https://flutter.dev/docs/get-started/install) 32 | 33 | - For Exporting to Android: 34 | 35 | - [Android Studio](https://developer.android.com/studio#downloads) 3.0+ 36 | / [IntelliJ IDEA](https://www.jetbrains.com/idea/download/) 2017.1+ 37 | with [Flutter Plugin](https://plugins.jetbrains.com/plugin/9212-flutter) 38 | and [Dart Plugin](https://plugins.jetbrains.com/plugin/6351-dart) (recommeded) 39 | 40 | - Android SDK from Android Studio or IntelliJ IDEA (API Level 30 recommended) 41 | 42 | - [Java SE JDK](https://www.oracle.com/in/java/technologies/javase-downloads.html) (v8 recommended) 43 | 44 | - [Gradle](https://gradle.org/releases/) 45 | 46 | - Set ANDROID_HOME and ANDROID_SDK_ROOT variables 47 | 48 | - Add JDK to PATH 49 | 50 | - For Exporting to Web: 51 | 52 | - Set current working directory to sudoku 53 | 54 | - Run these commands: 55 | ``` 56 | flutter config --enable-web 57 | ``` 58 | 59 | - For Exporting to Windows: 60 | 61 | - Set current working directory to sudoku 62 | 63 | - Run these commands: 64 | ``` 65 | flutter config --enable-windows-desktop 66 | ``` 67 | 68 | ### Installing required packages 69 | 70 | 1. Clone this repository 71 | 72 | 2. Set current working directory to sudoku 73 | 74 | 3. Run these commands: 75 | ``` 76 | flutter pub get 77 | flutter pub upgrade 78 | flutter pub outdated 79 | ``` 80 | 81 | - This will install all the required packages 82 | 83 | 4. Run `flutter doctor` to check fo any issues (Optional) 84 | 85 | > #### Steps for exporting to a PWA or Web App 86 | 87 | 1. Set current working directory to sudoku 88 | 89 | 2. Run `flutter build web --release` 90 | 91 | - This will compile the program and store the files in the `sudoku/build/web` directory 92 | 93 | - You can run a simple http server in this directory to run your app in the browser 94 | 95 | - [dhttpd](https://pub.dev/packages/dhttpd) is a Dart package for running a simple http server 96 | 97 | > #### Steps for exporting to Windows 98 | 99 | 1. Set current working directory to sudoku 100 | 101 | 2. Run `flutter build windows --release` 102 | 103 | - This will compile the program and store the files in the `sudoku/build/windows/runner/Release` directory 104 | 105 | - It will export a release build that can be run directly 106 | 107 | > #### Steps for exporting to Android 108 | 109 | 1. Set current working directory to sudoku 110 | 111 | 2. To export as an Android app run: 112 | 113 | `flutter build apk` to build a fat APK for all ABIs 114 | 115 | OR 116 | 117 | `flutter build apk --target-platform android-arm,android-arm64,android-x64 --split-per-abi` to build multiple APKs 118 | for every ABI 119 | 120 | - This will export a release build of the apk file signed with debug keys which can be installed on an Android phone or 121 | emulator 122 | 123 | - The APK file/s will be saved in `sudoku/build/app/outputs/flutter-apk` 124 | 125 | - Minimum Android Version Required : Android 4.1.x Jellybean (API Level 16) 126 | 127 | ## Features: 128 | 129 | - Generates a New Game when you start the app 130 | 131 | - Clicking a box displays a dialog with buttons 1-9 to input in the box 132 | 133 | - Clickable buttons will initially have no number and will turn red after the first click 134 | 135 | - Long pressing a button will erase your input 136 | 137 | - After completely solving the grid, if the solution is correct it will alert you that you successfully solved the 138 | Sudoku 139 | 140 | - The numbers in all the clickable buttons will turn blue if the solution is correct (This will also happen if you click 141 | Show Solution) 142 | 143 | - 4 different difficulty levels to choose from : 144 | - Beginner - 18 empty squares 145 | - Easy - 27 empty squares 146 | - Medium - 36 empty squares 147 | - Hard - 54 empty squares 148 | 149 | - New Game 150 | 151 | - Restart Game 152 | 153 | - Show Solution 154 | 155 | - Dark and Light theme 156 | 157 | - Various Accent Colors to choose from 158 | 159 | - Material Design 160 | 161 | ## Note: 162 | 163 | - Dependencies: 164 | - [sudoku_solver_generator](https://pub.dev/packages/sudoku_solver_generator) is used for the Sudoku logic 165 | 166 | - [flutter_animated_dialog](https://pub.dev/packages/flutter_animated_dialog) is used for animated alert dialogs 167 | 168 | - [shared_preferences](https://pub.dev/packages/shared_preferences) is used for saving preferences locally 169 | 170 | - [splashscreen](https://pub.dev/packages/splashscreen) is used for the splashscreen 171 | 172 | - [flutter_native_splash](https://pub.dev/packages/flutter_native_splash) is used for generating the native 173 | splashscreen files 174 | 175 | - [url_launcher](https://pub.dev/packages/url_launcher) is used for opening hyperlinks 176 | 177 | - [bitsdojo_window](https://pub.dev/packages/bitsdojo_window) is used for title bar improvements on desktop 178 | 179 | - [NSIS](https://nsis.sourceforge.io/) is used for building the Windows installer 180 | 181 | - Untested on iOS, MacOS, Linux and Fuchsia. Additional changes might be required to work correctly 182 | 183 | - If you face any issue or have suggestions then feel free to open an issue on GitHub 184 | 185 | ## Screenshots: 186 | 187 | - Main Screen while solved with dark theme:

188 | 189 | ![Solved_Dark](https://i.imgur.com/PItmR0H.png) 190 |

191 | 192 | - Main Screen while solving with light theme:

193 | 194 | ![Solving_Light](https://i.imgur.com/l987sBq.png) 195 |

196 | 197 | - Choose Number Alert:

198 | 199 | ![Choose](https://i.imgur.com/k8IQA7E.png) 200 |

201 | 202 | - Game Over Alert Box:

203 | 204 | ![Result](https://i.imgur.com/tun5TaS.png) 205 |

206 | 207 | - Options:

208 | 209 | ![Options](https://i.imgur.com/MA0E2Ey.png) 210 |

211 | 212 | - Windows with Violet Accent Color:

213 | 214 | ![Windows_Violet](https://i.imgur.com/nxIZDSV.png) 215 |

216 | -------------------------------------------------------------------------------- /sudoku/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Web related 36 | lib/generated_plugin_registrant.dart 37 | 38 | # Symbolication related 39 | app.*.symbols 40 | 41 | # Obfuscation related 42 | app.*.map.json 43 | 44 | # Android Studio will place build artifacts here 45 | /android/app/debug 46 | /android/app/profile 47 | /android/app/release 48 | -------------------------------------------------------------------------------- /sudoku/.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: 676cefaaff197f27424942307668886253e1ec35 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: 676cefaaff197f27424942307668886253e1ec35 17 | base_revision: 676cefaaff197f27424942307668886253e1ec35 18 | - platform: android 19 | create_revision: 676cefaaff197f27424942307668886253e1ec35 20 | base_revision: 676cefaaff197f27424942307668886253e1ec35 21 | - platform: web 22 | create_revision: 676cefaaff197f27424942307668886253e1ec35 23 | base_revision: 676cefaaff197f27424942307668886253e1ec35 24 | - platform: windows 25 | create_revision: 676cefaaff197f27424942307668886253e1ec35 26 | base_revision: 676cefaaff197f27424942307668886253e1ec35 27 | 28 | # User provided section 29 | 30 | # List of Local paths (relative to this file) that should be 31 | # ignored by the migrate tool. 32 | # 33 | # Files that are not part of the templates will be ignored by default. 34 | unmanaged_files: 35 | - 'lib/main.dart' 36 | - 'ios/Runner.xcodeproj/project.pbxproj' 37 | -------------------------------------------------------------------------------- /sudoku/analysis_options.yaml: -------------------------------------------------------------------------------- 1 | # This file configures the analyzer, which statically analyzes Dart code to 2 | # check for errors, warnings, and lints. 3 | # 4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled 5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be 6 | # invoked from the command line by running `flutter analyze`. 7 | 8 | # The following line activates a set of recommended lints for Flutter apps, 9 | # packages, and plugins designed to encourage good coding practices. 10 | include: package:flutter_lints/flutter.yaml 11 | 12 | linter: 13 | # The lint rules applied to this project can be customized in the 14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml` 15 | # included above or to enable additional rules. A list of all available lints 16 | # and their documentation is published at 17 | # https://dart-lang.github.io/linter/lints/index.html. 18 | # 19 | # Instead of disabling a lint rule for the entire project in the 20 | # section below, it can also be suppressed for a single line of code 21 | # or a specific dart file by using the `// ignore: name_of_lint` and 22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file 23 | # producing the lint. 24 | rules: 25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule 26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule 27 | 28 | # Additional information about this file can be found at 29 | # https://dart.dev/guides/language/analysis-options 30 | -------------------------------------------------------------------------------- /sudoku/android/.gitignore: -------------------------------------------------------------------------------- 1 | gradle-wrapper.jar 2 | /.gradle 3 | /captures/ 4 | /gradlew 5 | /gradlew.bat 6 | /local.properties 7 | GeneratedPluginRegistrant.java 8 | 9 | # Remember to never publicly share your keystore. 10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app 11 | key.properties 12 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /sudoku/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | // Version Config 10 | def versionProperties = new Properties() 11 | def versionPropertiesFile = rootProject.file('version.properties') 12 | if (versionPropertiesFile.exists()) { 13 | versionProperties.load(new FileInputStream(versionPropertiesFile)) 14 | } 15 | 16 | // Key Config 17 | def keystoreProperties = new Properties() 18 | def keystorePropertiesFile = rootProject.file('key.properties') 19 | if (keystorePropertiesFile.exists()) { 20 | keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) 21 | } 22 | 23 | def flutterRoot = localProperties.getProperty('flutter.sdk') 24 | if (flutterRoot == null) { 25 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 26 | } 27 | 28 | def flutterVersionCode = versionProperties.getProperty('flutter.versionCode') 29 | if (flutterVersionCode == null) { 30 | flutterVersionCode = '1' 31 | } 32 | 33 | def flutterVersionName = versionProperties.getProperty('flutter.versionName') 34 | if (flutterVersionName == null) { 35 | flutterVersionName = '1.0' 36 | } 37 | 38 | apply plugin: 'com.android.application' 39 | apply plugin: 'kotlin-android' 40 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 41 | 42 | android { 43 | compileSdkVersion flutter.compileSdkVersion 44 | ndkVersion flutter.ndkVersion 45 | 46 | packagingOptions { 47 | exclude "**/kotlin/**" 48 | exclude "kotlin-tooling-metadata.json" 49 | exclude "DebugProbesKt.bin" 50 | exclude "/META-INF/androidx**" 51 | } 52 | 53 | compileOptions { 54 | sourceCompatibility JavaVersion.VERSION_1_8 55 | targetCompatibility JavaVersion.VERSION_1_8 56 | } 57 | 58 | kotlinOptions { 59 | jvmTarget = '1.8' 60 | } 61 | 62 | sourceSets { 63 | main.java.srcDirs += 'src/main/kotlin' 64 | } 65 | 66 | defaultConfig { 67 | // Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 68 | applicationId "com.varuns2002.sudoku" 69 | // You can update the following values to match your application needs. 70 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 71 | minSdkVersion 21 72 | targetSdkVersion flutter.targetSdkVersion 73 | versionCode flutterVersionCode.toInteger() 74 | versionName flutterVersionName 75 | } 76 | 77 | // Key Config 78 | signingConfigs { 79 | release { 80 | keyAlias keystoreProperties['keyAlias'] 81 | keyPassword keystoreProperties['keyPassword'] 82 | storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null 83 | storePassword keystoreProperties['storePassword'] 84 | } 85 | } 86 | 87 | buildTypes { 88 | release { 89 | // Add your own signing config for the release build. 90 | // Signing with the debug keys for now, so `flutter run --release` works. 91 | signingConfig signingConfigs.debug 92 | // signingConfig signingConfigs.release // Key Config 93 | } 94 | } 95 | } 96 | 97 | flutter { 98 | source '../..' 99 | } 100 | -------------------------------------------------------------------------------- /sudoku/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 16 | 24 | 28 | 32 | 33 | 34 | 35 | 36 | 37 | 39 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/ic_launcher-playstore.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/ic_launcher-playstore.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/kotlin/com/varuns2002/sudoku/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.varuns2002.sudoku 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-hdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable-hdpi/splash.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-mdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable-mdpi/splash.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-v21/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable-v21/background.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-v21/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-xhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable-xhdpi/splash.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-xxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable-xxhdpi/splash.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable-xxxhdpi/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable-xxxhdpi/splash.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/drawable/background.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 6 | 10 | 15 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/drawable/launch_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-hdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-mdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/values-night/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | 19 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/values-v29/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/values-v31/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 15 | 18 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/values/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #121212 4 | -------------------------------------------------------------------------------- /sudoku/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 16 | 19 | 20 | -------------------------------------------------------------------------------- /sudoku/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /sudoku/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.0.4' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /sudoku/android/gradle.properties: -------------------------------------------------------------------------------- 1 | org.gradle.jvmargs=-Xmx1536M 2 | android.useAndroidX=true 3 | android.enableJetifier=true 4 | -------------------------------------------------------------------------------- /sudoku/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jun 23 08:50:38 CEST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 7 | -------------------------------------------------------------------------------- /sudoku/android/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /sudoku/android/version.properties: -------------------------------------------------------------------------------- 1 | flutter.versionName=2.4.1 2 | flutter.versionCode=2041 3 | -------------------------------------------------------------------------------- /sudoku/assets/icon/icon_foreground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/assets/icon/icon_foreground.png -------------------------------------------------------------------------------- /sudoku/assets/icon/icon_foreground_vector_108x108.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /sudoku/assets/icon/icon_foreground_vector_400x400.svg: -------------------------------------------------------------------------------- 1 | 7 | 8 | 14 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /sudoku/assets/icon/icon_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/assets/icon/icon_round.png -------------------------------------------------------------------------------- /sudoku/assets/icon/icon_square.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/assets/icon/icon_square.png -------------------------------------------------------------------------------- /sudoku/flutter_native_splash.yaml: -------------------------------------------------------------------------------- 1 | flutter_native_splash: 2 | 3 | # This package generates native code to customize Flutter's default white native splash screen 4 | # with background color and splash image. 5 | # Customize the parameters below, and run the following command in the terminal: 6 | # flutter pub run flutter_native_splash:create 7 | # To restore Flutter's default white splash screen, run the following command in the terminal: 8 | # flutter pub run flutter_native_splash:remove 9 | 10 | # color or background_image is the only required parameter. Use color to set the background 11 | # of your splash screen to a solid color. Use background_image to set the background of your 12 | # splash screen to a png image. This is useful for gradients. The image will be stretch to the 13 | # size of the app. Only one parameter can be used, color and background_image cannot both be set. 14 | color: "#121212" 15 | #background_image: "assets/background.png" 16 | 17 | # Optional parameters are listed below. To enable a parameter, uncomment the line by removing 18 | # the leading # character. 19 | 20 | # The image parameter allows you to specify an image used in the splash screen. It must be a 21 | # png file and should be sized for 4x pixel density. 22 | image: assets/icon/icon_foreground.png 23 | 24 | # The branding property allows you to specify an image used as branding in the splash screen. 25 | # It must be a png file. Currently, it is only supported for Android < v12 and iOS. 26 | #branding: assets/dart.png 27 | 28 | # To position the branding image at the bottom of the screen you can use bottom, bottomRight, 29 | # and bottomLeft. The default values is bottom if not specified or specified something else. 30 | #branding_mode: bottom 31 | 32 | # The color_dark, background_image_dark, image_dark, branding_dark are parameters that set the background 33 | # and image when the device is in dark mode. If they are not specified, the app will use the 34 | # parameters from above. If the image_dark parameter is specified, color_dark or 35 | # background_image_dark must be specified. color_dark and background_image_dark cannot both be 36 | # set. 37 | #color_dark: "#042a49" 38 | #background_image_dark: "assets/dark-background.png" 39 | #image_dark: assets/splash-invert.png 40 | #branding_dark: assets/dart_dark.png 41 | 42 | # Android 12 handles the splash screen differently than previous versions. Please visit 43 | # https://developer.android.com/guide/topics/ui/splash-screen 44 | # Following are Android 12 specific parameter. 45 | android_12: 46 | # The image parameter sets the splash screen icon image. If this parameter is not specified, 47 | # the app's launcher icon will be used instead. 48 | # Please note that the splash screen will be clipped to a circle on the center of the screen. 49 | # App icon with an icon background: This should be 960×960 pixels, and fit within a circle 50 | # 640 pixels in diameter. 51 | # App icon without an icon background: This should be 1152×1152 pixels, and fit within a circle 52 | # 768 pixels in diameter. 53 | #image: assets/icon/icon_foreground.png 54 | 55 | # Splash screen background color. 56 | color: "#121212" 57 | 58 | # App icon background color. 59 | #icon_background_color: "#111111" 60 | 61 | # The image_dark parameter and icon_background_color_dark set the image and icon background 62 | # color when the device is in dark mode. If they are not specified, the app will use the 63 | # parameters from above. 64 | #image_dark: assets/android12splash-invert.png 65 | #color_dark: "#042a49" 66 | #icon_background_color_dark: "#eeeeee" 67 | 68 | # The android, ios and web parameters can be used to disable generating a splash screen on a given 69 | # platform. 70 | #android: false 71 | ios: false 72 | #web: false 73 | 74 | # The position of the splash image can be set with android_gravity, ios_content_mode, and 75 | # web_image_mode parameters. All default to center. 76 | # 77 | # android_gravity can be one of the following Android Gravity (see 78 | # https://developer.android.com/reference/android/view/Gravity): bottom, center, 79 | # center_horizontal, center_vertical, clip_horizontal, clip_vertical, end, fill, fill_horizontal, 80 | # fill_vertical, left, right, start, or top. 81 | android_gravity: center 82 | # 83 | # ios_content_mode can be one of the following iOS UIView.ContentMode (see 84 | # https://developer.apple.com/documentation/uikit/uiview/contentmode): scaleToFill, 85 | # scaleAspectFit, scaleAspectFill, center, top, bottom, left, right, topLeft, topRight, 86 | # bottomLeft, or bottomRight. 87 | #ios_content_mode: center 88 | # 89 | # web_image_mode can be one of the following modes: center, contain, stretch, and cover. 90 | web_image_mode: center 91 | 92 | # The screen orientation can be set in Android with the android_screen_orientation parameter. 93 | # Valid parameters can be found here: 94 | # https://developer.android.com/guide/topics/manifest/activity-element#screen 95 | #android_screen_orientation: sensorLandscape 96 | 97 | # To hide the notification bar, use the fullscreen parameter. Has no effect in web since web 98 | # has no notification bar. Defaults to false. 99 | # NOTE: Unlike Android, iOS will not automatically show the notification bar when the app loads. 100 | # To show the notification bar, add the following code to your Flutter app: 101 | # WidgetsFlutterBinding.ensureInitialized(); 102 | # SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.bottom, SystemUiOverlay.top]); 103 | #fullscreen: true 104 | 105 | # If you have changed the name(s) of your info.plist file(s), you can specify the filename(s) 106 | # with the info_plist_files parameter. Remove only the # characters in the three lines below, 107 | # do not remove any spaces: 108 | #info_plist_files: 109 | # - 'ios/Runner/Info-Debug.plist' 110 | # - 'ios/Runner/Info-Release.plist' 111 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/about.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:url_launcher/url_launcher.dart'; 3 | 4 | import '../main.dart'; 5 | import '../styles.dart'; 6 | 7 | class AlertAbout extends StatelessWidget { 8 | static const String authorURL = "https://www.github.com/VarunS2002/"; 9 | static const String releasesURL = 10 | "https://github.com/VarunS2002/Flutter-Sudoku/releases/"; 11 | static const String sourceURL = 12 | "https://github.com/VarunS2002/Flutter-Sudoku/"; 13 | static const String licenseURL = 14 | "https://github.com/VarunS2002/Flutter-Sudoku/blob/master/LICENSE"; 15 | 16 | const AlertAbout({Key? key}) : super(key: key); 17 | 18 | openURL(String url) async { 19 | await launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication); 20 | } 21 | 22 | @override 23 | Widget build(BuildContext context) { 24 | return AlertDialog( 25 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), 26 | backgroundColor: Styles.secondaryBackgroundColor, 27 | title: Center( 28 | child: Text( 29 | 'About', 30 | style: TextStyle(color: Styles.foregroundColor), 31 | ), 32 | ), 33 | content: Column( 34 | mainAxisSize: MainAxisSize.min, 35 | mainAxisAlignment: MainAxisAlignment.center, 36 | crossAxisAlignment: CrossAxisAlignment.center, 37 | children: [ 38 | Row( 39 | mainAxisAlignment: MainAxisAlignment.center, 40 | children: [ 41 | Image.asset('assets/icon/icon_round.png', 42 | height: 48.0, width: 48.0, fit: BoxFit.contain), 43 | Text( 44 | ' Sudoku', 45 | style: TextStyle( 46 | color: Styles.foregroundColor, 47 | fontFamily: 'roboto', 48 | fontSize: 22, 49 | fontWeight: FontWeight.bold), 50 | ), 51 | ], 52 | ), 53 | Row( 54 | mainAxisAlignment: MainAxisAlignment.center, 55 | children: [ 56 | Text( 57 | ' ', 58 | style: TextStyle( 59 | color: Styles.foregroundColor, 60 | fontFamily: 'roboto', 61 | fontSize: 15), 62 | ), 63 | ], 64 | ), 65 | Row( 66 | mainAxisAlignment: MainAxisAlignment.center, 67 | children: [ 68 | Text( 69 | 'Version: ', 70 | style: TextStyle( 71 | color: Styles.foregroundColor, 72 | fontFamily: 'roboto', 73 | fontSize: 15), 74 | ), 75 | InkWell( 76 | onTap: () => openURL(releasesURL), 77 | child: Text( 78 | '${MyApp.versionNumber} ', 79 | style: TextStyle( 80 | color: Styles.primaryColor, 81 | fontFamily: 'roboto', 82 | fontSize: 15), 83 | ), 84 | ), 85 | Text( 86 | HomePageState.platform, 87 | style: TextStyle( 88 | color: Styles.foregroundColor, 89 | fontFamily: 'roboto', 90 | fontSize: 15), 91 | ), 92 | ], 93 | ), 94 | Row( 95 | mainAxisAlignment: MainAxisAlignment.center, 96 | children: [ 97 | Text( 98 | ' ', 99 | style: TextStyle( 100 | color: Styles.foregroundColor, 101 | fontFamily: 'roboto', 102 | fontSize: 15), 103 | ), 104 | ], 105 | ), 106 | Row( 107 | mainAxisAlignment: MainAxisAlignment.center, 108 | children: [ 109 | Text( 110 | 'Author: ', 111 | style: TextStyle( 112 | color: Styles.foregroundColor, 113 | fontFamily: 'roboto', 114 | fontSize: 15), 115 | ), 116 | InkWell( 117 | onTap: () => openURL(authorURL), 118 | child: Text( 119 | 'VarunS2002', 120 | style: TextStyle( 121 | color: Styles.primaryColor, 122 | fontFamily: 'roboto', 123 | fontSize: 15), 124 | ), 125 | ) 126 | ], 127 | ), 128 | Row( 129 | mainAxisAlignment: MainAxisAlignment.center, 130 | children: [ 131 | Text( 132 | ' ', 133 | style: TextStyle( 134 | color: Styles.foregroundColor, 135 | fontFamily: 'roboto', 136 | fontSize: 15), 137 | ), 138 | ], 139 | ), 140 | Row( 141 | mainAxisAlignment: MainAxisAlignment.center, 142 | children: [ 143 | Text( 144 | 'License: ', 145 | style: TextStyle( 146 | color: Styles.foregroundColor, 147 | fontFamily: 'roboto', 148 | fontSize: 15), 149 | ), 150 | InkWell( 151 | onTap: () => openURL(licenseURL), 152 | child: Text( 153 | 'GNU GPLv3', 154 | style: TextStyle( 155 | color: Styles.primaryColor, 156 | fontFamily: 'roboto', 157 | fontSize: 15), 158 | ), 159 | ), 160 | ], 161 | ), 162 | Row( 163 | mainAxisAlignment: MainAxisAlignment.center, 164 | children: [ 165 | Text( 166 | ' ', 167 | style: TextStyle( 168 | color: Styles.foregroundColor, 169 | fontFamily: 'roboto', 170 | fontSize: 15), 171 | ), 172 | ], 173 | ), 174 | Row( 175 | mainAxisAlignment: MainAxisAlignment.center, 176 | children: [ 177 | InkWell( 178 | onTap: () => openURL(sourceURL), 179 | child: Text( 180 | 'Source Code', 181 | style: TextStyle( 182 | color: Styles.primaryColor, 183 | fontFamily: 'roboto', 184 | fontSize: 15), 185 | ), 186 | ), 187 | ], 188 | ), 189 | ], 190 | ), 191 | ); 192 | } 193 | } 194 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/accent_colors.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../styles.dart'; 4 | 5 | // ignore: must_be_immutable 6 | class AlertAccentColorsState extends StatefulWidget { 7 | String currentAccentColor; 8 | 9 | AlertAccentColorsState(this.currentAccentColor, {Key? key}) : super(key: key); 10 | 11 | static String? get accentColor { 12 | return AlertAccentColors.accentColor; 13 | } 14 | 15 | static set accentColor(String? color) { 16 | AlertAccentColors.accentColor = color; 17 | } 18 | 19 | @override 20 | // ignore: no_logic_in_create_state 21 | AlertAccentColors createState() => AlertAccentColors(currentAccentColor); 22 | } 23 | 24 | class AlertAccentColors extends State { 25 | // ignore: avoid_init_to_null 26 | static String? accentColor = null; 27 | static final List accentColors = [...Styles.accentColors.keys]; 28 | String currentAccentColor; 29 | 30 | AlertAccentColors(this.currentAccentColor); 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return SimpleDialog( 35 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), 36 | title: Center( 37 | child: Text( 38 | 'Select Accent Color', 39 | style: TextStyle(color: Styles.foregroundColor), 40 | )), 41 | backgroundColor: Styles.secondaryBackgroundColor, 42 | contentPadding: const EdgeInsets.fromLTRB(10, 10, 10, 10), 43 | children: [ 44 | for (String color in accentColors) 45 | SimpleDialogOption( 46 | onPressed: () { 47 | if (color != currentAccentColor) { 48 | setState(() { 49 | accentColor = color; 50 | }); 51 | } 52 | Navigator.pop(context); 53 | }, 54 | child: Text(color, 55 | textAlign: TextAlign.center, 56 | style: TextStyle( 57 | fontSize: 15, 58 | color: color == currentAccentColor 59 | ? Styles.primaryColor 60 | : Styles.foregroundColor)), 61 | ), 62 | ], 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/all.dart: -------------------------------------------------------------------------------- 1 | export 'about.dart'; 2 | export 'accent_colors.dart'; 3 | export 'difficulty.dart'; 4 | export 'exit.dart'; 5 | export 'game_over.dart'; 6 | export 'numbers.dart'; 7 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/difficulty.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../styles.dart'; 4 | 5 | // ignore: must_be_immutable 6 | class AlertDifficultyState extends StatefulWidget { 7 | String currentDifficultyLevel; 8 | 9 | AlertDifficultyState(this.currentDifficultyLevel, {Key? key}) 10 | : super(key: key); 11 | 12 | @override 13 | // ignore: no_logic_in_create_state 14 | AlertDifficulty createState() => AlertDifficulty(currentDifficultyLevel); 15 | 16 | static String? get difficulty { 17 | return AlertDifficulty.difficulty; 18 | } 19 | 20 | static set difficulty(String? level) { 21 | AlertDifficulty.difficulty = level; 22 | } 23 | } 24 | 25 | class AlertDifficulty extends State { 26 | // ignore: avoid_init_to_null 27 | static String? difficulty = null; 28 | static final List difficulties = [ 29 | 'beginner', 30 | 'easy', 31 | 'medium', 32 | 'hard' 33 | ]; 34 | String currentDifficultyLevel; 35 | 36 | AlertDifficulty(this.currentDifficultyLevel); 37 | 38 | @override 39 | Widget build(BuildContext context) { 40 | return SimpleDialog( 41 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), 42 | title: Center( 43 | child: Text( 44 | 'Select Difficulty Level', 45 | style: TextStyle(color: Styles.foregroundColor), 46 | )), 47 | backgroundColor: Styles.secondaryBackgroundColor, 48 | contentPadding: const EdgeInsets.fromLTRB(10, 10, 10, 10), 49 | children: [ 50 | for (String level in difficulties) 51 | SimpleDialogOption( 52 | onPressed: () { 53 | if (level != currentDifficultyLevel) { 54 | setState(() { 55 | difficulty = level; 56 | }); 57 | } 58 | Navigator.pop(context); 59 | }, 60 | child: Text(level[0].toUpperCase() + level.substring(1), 61 | textAlign: TextAlign.center, 62 | style: TextStyle( 63 | fontSize: 15, 64 | color: level == currentDifficultyLevel 65 | ? Styles.primaryColor 66 | : Styles.foregroundColor)), 67 | ), 68 | ], 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/exit.dart: -------------------------------------------------------------------------------- 1 | import 'dart:io'; 2 | 3 | import 'package:flutter/material.dart'; 4 | import 'package:flutter/services.dart'; 5 | 6 | import '../main.dart'; 7 | import '../styles.dart'; 8 | 9 | class AlertExit extends StatelessWidget { 10 | const AlertExit({Key? key}) : super(key: key); 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | return AlertDialog( 15 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), 16 | backgroundColor: Styles.secondaryBackgroundColor, 17 | title: Text( 18 | 'Exit Game', 19 | style: TextStyle(color: Styles.foregroundColor), 20 | ), 21 | content: Text( 22 | 'Are you sure you want to exit the game ?', 23 | style: TextStyle(color: Styles.foregroundColor), 24 | ), 25 | actions: [ 26 | TextButton( 27 | style: ButtonStyle( 28 | foregroundColor: 29 | MaterialStateProperty.all(Styles.primaryColor)), 30 | onPressed: () { 31 | Navigator.pop(context); 32 | }, 33 | child: const Text('No'), 34 | ), 35 | TextButton( 36 | style: ButtonStyle( 37 | foregroundColor: 38 | MaterialStateProperty.all(Styles.primaryColor)), 39 | onPressed: () { 40 | if (HomePageState.isDesktop) { 41 | exit(0); 42 | } else if (HomePageState.platform == 'android') { 43 | SystemNavigator.pop(); 44 | } 45 | }, 46 | child: const Text('Yes'), 47 | ), 48 | ], 49 | ); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/game_over.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../styles.dart'; 4 | 5 | class AlertGameOver extends StatelessWidget { 6 | static bool newGame = false; 7 | static bool restartGame = false; 8 | 9 | const AlertGameOver({Key? key}) : super(key: key); 10 | 11 | @override 12 | Widget build(BuildContext context) { 13 | return AlertDialog( 14 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), 15 | backgroundColor: Styles.secondaryBackgroundColor, 16 | title: Text( 17 | 'Game Over', 18 | style: TextStyle(color: Styles.foregroundColor), 19 | ), 20 | content: Text( 21 | 'You successfully solved the Sudoku', 22 | style: TextStyle(color: Styles.foregroundColor), 23 | ), 24 | actions: [ 25 | TextButton( 26 | style: ButtonStyle( 27 | foregroundColor: 28 | MaterialStateProperty.all(Styles.primaryColor)), 29 | onPressed: () { 30 | Navigator.pop(context); 31 | restartGame = true; 32 | }, 33 | child: const Text('Restart Game'), 34 | ), 35 | TextButton( 36 | style: ButtonStyle( 37 | foregroundColor: 38 | MaterialStateProperty.all(Styles.primaryColor)), 39 | onPressed: () { 40 | Navigator.pop(context); 41 | newGame = true; 42 | }, 43 | child: const Text('New Game'), 44 | ), 45 | ], 46 | ); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /sudoku/lib/alerts/numbers.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import '../styles.dart'; 4 | 5 | class AlertNumbersState extends StatefulWidget { 6 | const AlertNumbersState({Key? key}) : super(key: key); 7 | 8 | @override 9 | AlertNumbers createState() => AlertNumbers(); 10 | 11 | static int? get number { 12 | return AlertNumbers.number; 13 | } 14 | 15 | static set number(int? number) { 16 | AlertNumbers.number = number; 17 | } 18 | } 19 | 20 | class AlertNumbers extends State { 21 | // ignore: avoid_init_to_null 22 | static int? number = null; 23 | late int numberSelected; 24 | static final List numberList1 = [1, 2, 3]; 25 | static final List numberList2 = [4, 5, 6]; 26 | static final List numberList3 = [7, 8, 9]; 27 | 28 | List createButtons(List numberList) { 29 | return [ 30 | for (int numbers in numberList) 31 | SizedBox( 32 | width: 38, 33 | height: 38, 34 | child: TextButton( 35 | onPressed: () => { 36 | setState(() { 37 | numberSelected = numbers; 38 | number = numberSelected; 39 | Navigator.pop(context); 40 | }) 41 | }, 42 | style: ButtonStyle( 43 | backgroundColor: MaterialStateProperty.all( 44 | Styles.secondaryBackgroundColor), 45 | foregroundColor: 46 | MaterialStateProperty.all(Styles.primaryColor), 47 | shape: MaterialStateProperty.all( 48 | RoundedRectangleBorder( 49 | borderRadius: BorderRadius.circular(5), 50 | )), 51 | side: MaterialStateProperty.all(BorderSide( 52 | color: Styles.foregroundColor, 53 | width: 1, 54 | style: BorderStyle.solid, 55 | )), 56 | ), 57 | child: Text( 58 | numbers.toString(), 59 | textAlign: TextAlign.center, 60 | style: const TextStyle(fontSize: 18), 61 | ), 62 | ), 63 | ) 64 | ]; 65 | } 66 | 67 | Row oneRow(List numberList) { 68 | return Row( 69 | mainAxisAlignment: MainAxisAlignment.center, 70 | children: createButtons(numberList), 71 | ); 72 | } 73 | 74 | List createRows() { 75 | List> numberLists = [numberList1, numberList2, numberList3]; 76 | List rowList = []; 77 | for (var i = 0; i <= 2; i++) { 78 | rowList.add(oneRow(numberLists[i])); 79 | } 80 | return rowList; 81 | } 82 | 83 | @override 84 | Widget build(BuildContext context) { 85 | return AlertDialog( 86 | shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(10)), 87 | backgroundColor: Styles.secondaryBackgroundColor, 88 | title: Center( 89 | child: Text( 90 | 'Choose a Number', 91 | style: TextStyle(color: Styles.foregroundColor), 92 | )), 93 | content: Column( 94 | mainAxisSize: MainAxisSize.min, 95 | mainAxisAlignment: MainAxisAlignment.center, 96 | crossAxisAlignment: CrossAxisAlignment.center, 97 | children: createRows(), 98 | )); 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /sudoku/lib/board_style.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | import 'main.dart'; 4 | import 'styles.dart'; 5 | 6 | MaterialColor emptyColor(bool gameOver) => 7 | gameOver ? Styles.primaryColor : Styles.secondaryColor; 8 | 9 | Color buttonColor(int k, int i) { 10 | Color color; 11 | if (([0, 1, 2].contains(k) && [3, 4, 5].contains(i)) || 12 | ([3, 4, 5].contains(k) && [0, 1, 2, 6, 7, 8].contains(i)) || 13 | ([6, 7, 8].contains(k) && [3, 4, 5].contains(i))) { 14 | if (Styles.primaryBackgroundColor == Styles.darkGrey) { 15 | color = Styles.grey; 16 | } else { 17 | color = Colors.grey[300]!; 18 | } 19 | } else { 20 | color = Styles.primaryBackgroundColor; 21 | } 22 | 23 | return color; 24 | } 25 | 26 | double buttonSize() { 27 | double size = 50; 28 | if (HomePageState.platform.contains('android') || 29 | HomePageState.platform.contains('ios')) { 30 | size = 38; 31 | } 32 | return size; 33 | } 34 | 35 | double buttonFontSize() { 36 | double size = 20; 37 | if (HomePageState.platform.contains('android') || 38 | HomePageState.platform.contains('ios')) { 39 | size = 16; 40 | } 41 | return size; 42 | } 43 | 44 | BorderRadiusGeometry buttonEdgeRadius(int k, int i) { 45 | if (k == 0 && i == 0) { 46 | return const BorderRadius.only(topLeft: Radius.circular(5)); 47 | } else if (k == 0 && i == 8) { 48 | return const BorderRadius.only(topRight: Radius.circular(5)); 49 | } else if (k == 8 && i == 0) { 50 | return const BorderRadius.only(bottomLeft: Radius.circular(5)); 51 | } else if (k == 8 && i == 8) { 52 | return const BorderRadius.only(bottomRight: Radius.circular(5)); 53 | } 54 | return BorderRadius.circular(0); 55 | } 56 | -------------------------------------------------------------------------------- /sudoku/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'dart:async'; 2 | 3 | import 'package:bitsdojo_window/bitsdojo_window.dart'; 4 | import 'package:flutter/foundation.dart'; 5 | import 'package:flutter/material.dart'; 6 | import 'package:flutter/services.dart'; 7 | import 'package:flutter_animated_dialog/flutter_animated_dialog.dart'; 8 | import 'package:shared_preferences/shared_preferences.dart'; 9 | import 'package:sudoku_solver_generator/sudoku_solver_generator.dart'; 10 | 11 | import 'alerts/all.dart'; 12 | import 'board_style.dart'; 13 | import 'splash_screen_page.dart'; 14 | import 'styles.dart'; 15 | 16 | void main() { 17 | WidgetsFlutterBinding.ensureInitialized(); 18 | SystemChrome.setPreferredOrientations( 19 | [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown]); 20 | // SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []); 21 | runApp(const MyApp()); 22 | } 23 | 24 | class MyApp extends StatelessWidget { 25 | const MyApp({Key? key}) : super(key: key); 26 | 27 | static const String versionNumber = '2.4.1'; 28 | 29 | @override 30 | Widget build(BuildContext context) { 31 | return MaterialApp( 32 | title: 'Sudoku', 33 | debugShowCheckedModeBanner: false, 34 | theme: ThemeData( 35 | primarySwatch: Styles.primaryColor, 36 | ), 37 | home: const SplashScreenPage(), 38 | ); 39 | } 40 | } 41 | 42 | class HomePage extends StatefulWidget { 43 | const HomePage({Key? key}) : super(key: key); 44 | 45 | @override 46 | State createState() => HomePageState(); 47 | } 48 | 49 | class HomePageState extends State { 50 | bool firstRun = true; 51 | bool gameOver = false; 52 | int timesCalled = 0; 53 | bool isButtonDisabled = false; 54 | bool isFABDisabled = false; 55 | late List>> gameList; 56 | late List> game; 57 | late List> gameCopy; 58 | late List> gameSolved; 59 | static String? currentDifficultyLevel; 60 | static String? currentTheme; 61 | static String? currentAccentColor; 62 | static String platform = () { 63 | if (kIsWeb) { 64 | return 'web-${defaultTargetPlatform.toString().replaceFirst("TargetPlatform.", "").toLowerCase()}'; 65 | } else { 66 | return defaultTargetPlatform 67 | .toString() 68 | .replaceFirst("TargetPlatform.", "") 69 | .toLowerCase(); 70 | } 71 | }(); 72 | static bool isDesktop = ['windows', 'linux', 'macos'].contains(platform); 73 | 74 | @override 75 | void initState() { 76 | super.initState(); 77 | try { 78 | doWhenWindowReady(() { 79 | appWindow.alignment = Alignment.center; 80 | appWindow.minSize = const Size(625, 625); 81 | }); 82 | // ignore: empty_catches 83 | } on UnimplementedError {} 84 | getPrefs().whenComplete(() { 85 | if (currentDifficultyLevel == null) { 86 | currentDifficultyLevel = 'easy'; 87 | setPrefs('currentDifficultyLevel'); 88 | } 89 | if (currentTheme == null) { 90 | if (MediaQuery.maybeOf(context)?.platformBrightness != null) { 91 | currentTheme = 92 | MediaQuery.of(context).platformBrightness == Brightness.light 93 | ? 'light' 94 | : 'dark'; 95 | } else { 96 | currentTheme = 'dark'; 97 | } 98 | setPrefs('currentTheme'); 99 | } 100 | if (currentAccentColor == null) { 101 | currentAccentColor = 'Blue'; 102 | setPrefs('currentAccentColor'); 103 | } 104 | newGame(currentDifficultyLevel!); 105 | changeTheme('set'); 106 | changeAccentColor(currentAccentColor!, true); 107 | }); 108 | } 109 | 110 | Future getPrefs() async { 111 | final prefs = await SharedPreferences.getInstance(); 112 | setState(() { 113 | currentDifficultyLevel = prefs.getString('currentDifficultyLevel'); 114 | currentTheme = prefs.getString('currentTheme'); 115 | currentAccentColor = prefs.getString('currentAccentColor'); 116 | }); 117 | } 118 | 119 | setPrefs(String property) async { 120 | final prefs = await SharedPreferences.getInstance(); 121 | if (property == 'currentDifficultyLevel') { 122 | prefs.setString('currentDifficultyLevel', currentDifficultyLevel!); 123 | } else if (property == 'currentTheme') { 124 | prefs.setString('currentTheme', currentTheme!); 125 | } else if (property == 'currentAccentColor') { 126 | prefs.setString('currentAccentColor', currentAccentColor!); 127 | } 128 | } 129 | 130 | void changeTheme(String mode) { 131 | setState(() { 132 | if (currentTheme == 'light') { 133 | if (mode == 'switch') { 134 | Styles.primaryBackgroundColor = Styles.darkGrey; 135 | Styles.secondaryBackgroundColor = Styles.grey; 136 | Styles.foregroundColor = Styles.white; 137 | currentTheme = 'dark'; 138 | } else if (mode == 'set') { 139 | Styles.primaryBackgroundColor = Styles.white; 140 | Styles.secondaryBackgroundColor = Styles.white; 141 | Styles.foregroundColor = Styles.darkGrey; 142 | } 143 | } else if (currentTheme == 'dark') { 144 | if (mode == 'switch') { 145 | Styles.primaryBackgroundColor = Styles.white; 146 | Styles.secondaryBackgroundColor = Styles.white; 147 | Styles.foregroundColor = Styles.darkGrey; 148 | currentTheme = 'light'; 149 | } else if (mode == 'set') { 150 | Styles.primaryBackgroundColor = Styles.darkGrey; 151 | Styles.secondaryBackgroundColor = Styles.grey; 152 | Styles.foregroundColor = Styles.white; 153 | } 154 | } 155 | setPrefs('currentTheme'); 156 | }); 157 | } 158 | 159 | void changeAccentColor(String color, [bool firstRun = false]) { 160 | setState(() { 161 | if (Styles.accentColors.keys.contains(color)) { 162 | Styles.primaryColor = Styles.accentColors[color]!; 163 | } else { 164 | currentAccentColor = 'Blue'; 165 | Styles.primaryColor = Styles.accentColors[color]!; 166 | } 167 | if (color == 'Red') { 168 | Styles.secondaryColor = Styles.orange; 169 | } else { 170 | Styles.secondaryColor = Styles.lightRed; 171 | } 172 | if (!firstRun) { 173 | setPrefs('currentAccentColor'); 174 | } 175 | }); 176 | } 177 | 178 | void checkResult() { 179 | try { 180 | if (SudokuUtilities.isSolved(game)) { 181 | isButtonDisabled = !isButtonDisabled; 182 | gameOver = true; 183 | Timer(const Duration(milliseconds: 500), () { 184 | showAnimatedDialog( 185 | animationType: DialogTransitionType.fadeScale, 186 | barrierDismissible: true, 187 | duration: const Duration(milliseconds: 350), 188 | context: context, 189 | builder: (_) => const AlertGameOver()).whenComplete(() { 190 | if (AlertGameOver.newGame) { 191 | newGame(); 192 | AlertGameOver.newGame = false; 193 | } else if (AlertGameOver.restartGame) { 194 | restartGame(); 195 | AlertGameOver.restartGame = false; 196 | } 197 | }); 198 | }); 199 | } 200 | } on InvalidSudokuConfigurationException { 201 | return; 202 | } 203 | } 204 | 205 | static Future>>> getNewGame( 206 | [String difficulty = 'easy']) async { 207 | int emptySquares; 208 | switch (difficulty) { 209 | case 'test': 210 | { 211 | emptySquares = 2; 212 | } 213 | break; 214 | case 'beginner': 215 | { 216 | emptySquares = 18; 217 | } 218 | break; 219 | case 'easy': 220 | { 221 | emptySquares = 27; 222 | } 223 | break; 224 | case 'medium': 225 | { 226 | emptySquares = 36; 227 | } 228 | break; 229 | case 'hard': 230 | { 231 | emptySquares = 54; 232 | } 233 | break; 234 | default: 235 | { 236 | emptySquares = 2; 237 | } 238 | break; 239 | } 240 | SudokuGenerator generator = SudokuGenerator(emptySquares: emptySquares); 241 | return [generator.newSudoku, generator.newSudokuSolved]; 242 | } 243 | 244 | static List> copyGrid(List> grid) { 245 | return grid.map((row) => [...row]).toList(); 246 | } 247 | 248 | void setGame(int mode, [String difficulty = 'easy']) async { 249 | if (mode == 1) { 250 | game = List.filled(9, [0, 0, 0, 0, 0, 0, 0, 0, 0]); 251 | gameCopy = List.filled(9, [0, 0, 0, 0, 0, 0, 0, 0, 0]); 252 | gameSolved = List.filled(9, [0, 0, 0, 0, 0, 0, 0, 0, 0]); 253 | } else { 254 | gameList = await getNewGame(difficulty); 255 | game = gameList[0]; 256 | gameCopy = copyGrid(game); 257 | gameSolved = gameList[1]; 258 | } 259 | } 260 | 261 | void showSolution() { 262 | setState(() { 263 | game = copyGrid(gameSolved); 264 | isButtonDisabled = 265 | !isButtonDisabled ? !isButtonDisabled : isButtonDisabled; 266 | gameOver = true; 267 | }); 268 | } 269 | 270 | void newGame([String difficulty = 'easy']) { 271 | setState(() { 272 | isFABDisabled = !isFABDisabled; 273 | }); 274 | Future.delayed(const Duration(milliseconds: 200), () { 275 | setState(() { 276 | setGame(2, difficulty); 277 | isButtonDisabled = 278 | isButtonDisabled ? !isButtonDisabled : isButtonDisabled; 279 | gameOver = false; 280 | isFABDisabled = !isFABDisabled; 281 | }); 282 | }); 283 | } 284 | 285 | void restartGame() { 286 | setState(() { 287 | game = copyGrid(gameCopy); 288 | isButtonDisabled = 289 | isButtonDisabled ? !isButtonDisabled : isButtonDisabled; 290 | gameOver = false; 291 | }); 292 | } 293 | 294 | List createButtons() { 295 | if (firstRun) { 296 | setGame(1); 297 | firstRun = false; 298 | } 299 | 300 | List buttonList = List.filled(9, const SizedBox()); 301 | for (var i = 0; i <= 8; i++) { 302 | var k = timesCalled; 303 | buttonList[i] = SizedBox( 304 | key: Key('grid-button-$k-$i'), 305 | width: buttonSize(), 306 | height: buttonSize(), 307 | child: TextButton( 308 | onPressed: isButtonDisabled || gameCopy[k][i] != 0 309 | ? null 310 | : () { 311 | showAnimatedDialog( 312 | animationType: DialogTransitionType.fade, 313 | barrierDismissible: true, 314 | duration: const Duration(milliseconds: 300), 315 | context: context, 316 | builder: (_) => const AlertNumbersState()) 317 | .whenComplete(() { 318 | callback([k, i], AlertNumbersState.number); 319 | AlertNumbersState.number = null; 320 | }); 321 | }, 322 | onLongPress: isButtonDisabled || gameCopy[k][i] != 0 323 | ? null 324 | : () => callback([k, i], 0), 325 | style: ButtonStyle( 326 | backgroundColor: 327 | MaterialStateProperty.all(buttonColor(k, i)), 328 | foregroundColor: MaterialStateProperty.resolveWith( 329 | (Set states) { 330 | if (states.contains(MaterialState.disabled)) { 331 | return gameCopy[k][i] == 0 332 | ? emptyColor(gameOver) 333 | : Styles.foregroundColor; 334 | } 335 | return game[k][i] == 0 336 | ? buttonColor(k, i) 337 | : Styles.secondaryColor; 338 | }), 339 | shape: MaterialStateProperty.all( 340 | RoundedRectangleBorder( 341 | borderRadius: buttonEdgeRadius(k, i), 342 | )), 343 | side: MaterialStateProperty.all(BorderSide( 344 | color: Styles.foregroundColor, 345 | width: 1, 346 | style: BorderStyle.solid, 347 | )), 348 | ), 349 | child: Text( 350 | game[k][i] != 0 ? game[k][i].toString() : ' ', 351 | textAlign: TextAlign.center, 352 | style: TextStyle(fontSize: buttonFontSize()), 353 | ), 354 | ), 355 | ); 356 | } 357 | timesCalled++; 358 | if (timesCalled == 9) { 359 | timesCalled = 0; 360 | } 361 | return buttonList; 362 | } 363 | 364 | Row oneRow() { 365 | return Row( 366 | mainAxisAlignment: MainAxisAlignment.center, 367 | children: createButtons(), 368 | ); 369 | } 370 | 371 | List createRows() { 372 | List rowList = List.generate(9, (i) => oneRow()); 373 | return rowList; 374 | } 375 | 376 | void callback(List index, int? number) { 377 | setState(() { 378 | if (number == null) { 379 | return; 380 | } else if (number == 0) { 381 | game[index[0]][index[1]] = number; 382 | } else { 383 | game[index[0]][index[1]] = number; 384 | checkResult(); 385 | } 386 | }); 387 | } 388 | 389 | showOptionModalSheet(BuildContext context) { 390 | BuildContext outerContext = context; 391 | showModalBottomSheet( 392 | context: context, 393 | isScrollControlled: true, 394 | backgroundColor: Styles.secondaryBackgroundColor, 395 | shape: const RoundedRectangleBorder( 396 | borderRadius: BorderRadius.vertical( 397 | top: Radius.circular(10), 398 | ), 399 | ), 400 | builder: (context) { 401 | final TextStyle customStyle = 402 | TextStyle(inherit: false, color: Styles.foregroundColor); 403 | return Wrap( 404 | children: [ 405 | ListTile( 406 | leading: Icon(Icons.refresh, color: Styles.foregroundColor), 407 | title: Text('Restart Game', style: customStyle), 408 | onTap: () { 409 | Navigator.pop(context); 410 | Timer(const Duration(milliseconds: 200), () => restartGame()); 411 | }, 412 | ), 413 | ListTile( 414 | leading: Icon(Icons.add_rounded, color: Styles.foregroundColor), 415 | title: Text('New Game', style: customStyle), 416 | onTap: () { 417 | Navigator.pop(context); 418 | Timer(const Duration(milliseconds: 200), 419 | () => newGame(currentDifficultyLevel!)); 420 | }, 421 | ), 422 | ListTile( 423 | leading: Icon(Icons.lightbulb_outline_rounded, 424 | color: Styles.foregroundColor), 425 | title: Text('Show Solution', style: customStyle), 426 | onTap: () { 427 | Navigator.pop(context); 428 | Timer( 429 | const Duration(milliseconds: 200), () => showSolution()); 430 | }, 431 | ), 432 | ListTile( 433 | leading: 434 | Icon(Icons.build_outlined, color: Styles.foregroundColor), 435 | title: Text('Set Difficulty', style: customStyle), 436 | onTap: () { 437 | Navigator.pop(context); 438 | Timer( 439 | const Duration(milliseconds: 300), 440 | () => showAnimatedDialog( 441 | animationType: DialogTransitionType.fadeScale, 442 | barrierDismissible: true, 443 | duration: const Duration(milliseconds: 350), 444 | context: outerContext, 445 | builder: (_) => AlertDifficultyState( 446 | currentDifficultyLevel!)).whenComplete(() { 447 | if (AlertDifficultyState.difficulty != null) { 448 | Timer(const Duration(milliseconds: 300), () { 449 | newGame( 450 | AlertDifficultyState.difficulty ?? 'test'); 451 | currentDifficultyLevel = 452 | AlertDifficultyState.difficulty; 453 | AlertDifficultyState.difficulty = null; 454 | setPrefs('currentDifficultyLevel'); 455 | }); 456 | } 457 | })); 458 | }, 459 | ), 460 | ListTile( 461 | leading: Icon(Icons.invert_colors_on_rounded, 462 | color: Styles.foregroundColor), 463 | title: Text('Switch Theme', style: customStyle), 464 | onTap: () { 465 | Navigator.pop(context); 466 | Timer(const Duration(milliseconds: 200), () { 467 | changeTheme('switch'); 468 | }); 469 | }, 470 | ), 471 | ListTile( 472 | leading: Icon(Icons.color_lens_outlined, 473 | color: Styles.foregroundColor), 474 | title: Text('Change Accent Color', style: customStyle), 475 | onTap: () { 476 | Navigator.pop(context); 477 | Timer( 478 | const Duration(milliseconds: 200), 479 | () => showAnimatedDialog( 480 | animationType: DialogTransitionType.fadeScale, 481 | barrierDismissible: true, 482 | duration: const Duration(milliseconds: 350), 483 | context: outerContext, 484 | builder: (_) => AlertAccentColorsState( 485 | currentAccentColor!)).whenComplete(() { 486 | if (AlertAccentColorsState.accentColor != null) { 487 | Timer(const Duration(milliseconds: 300), () { 488 | currentAccentColor = 489 | AlertAccentColorsState.accentColor; 490 | changeAccentColor( 491 | currentAccentColor.toString()); 492 | AlertAccentColorsState.accentColor = null; 493 | setPrefs('currentAccentColor'); 494 | }); 495 | } 496 | })); 497 | }, 498 | ), 499 | ListTile( 500 | leading: Icon(Icons.info_outline_rounded, 501 | color: Styles.foregroundColor), 502 | title: Text('About', style: customStyle), 503 | onTap: () { 504 | Navigator.pop(context); 505 | Timer( 506 | const Duration(milliseconds: 200), 507 | () => showAnimatedDialog( 508 | animationType: DialogTransitionType.fadeScale, 509 | barrierDismissible: true, 510 | duration: const Duration(milliseconds: 350), 511 | context: outerContext, 512 | builder: (_) => const AlertAbout())); 513 | }, 514 | ), 515 | ], 516 | ); 517 | }); 518 | } 519 | 520 | @override 521 | Widget build(BuildContext context) { 522 | return WillPopScope( 523 | onWillPop: () async { 524 | if (kIsWeb) { 525 | return false; 526 | } else { 527 | showAnimatedDialog( 528 | animationType: DialogTransitionType.fadeScale, 529 | barrierDismissible: true, 530 | duration: const Duration(milliseconds: 350), 531 | context: context, 532 | builder: (_) => const AlertExit()); 533 | } 534 | return true; 535 | }, 536 | child: Scaffold( 537 | backgroundColor: Styles.primaryBackgroundColor, 538 | appBar: PreferredSize( 539 | preferredSize: const Size.fromHeight(56.0), 540 | child: isDesktop 541 | ? MoveWindow( 542 | onDoubleTap: () => appWindow.maximizeOrRestore(), 543 | child: AppBar( 544 | centerTitle: true, 545 | title: const Text('Sudoku'), 546 | backgroundColor: Styles.primaryColor, 547 | actions: [ 548 | IconButton( 549 | icon: const Icon(Icons.minimize_outlined), 550 | padding: const EdgeInsets.fromLTRB(8, 0, 8, 15), 551 | onPressed: () { 552 | appWindow.minimize(); 553 | }, 554 | ), 555 | IconButton( 556 | icon: const Icon(Icons.close_rounded), 557 | padding: const EdgeInsets.fromLTRB(8, 8, 20, 8), 558 | onPressed: () { 559 | showAnimatedDialog( 560 | animationType: 561 | DialogTransitionType.fadeScale, 562 | barrierDismissible: true, 563 | duration: const Duration(milliseconds: 350), 564 | context: context, 565 | builder: (_) => const AlertExit()); 566 | }, 567 | ), 568 | ], 569 | ), 570 | ) 571 | : AppBar( 572 | centerTitle: true, 573 | title: const Text('Sudoku'), 574 | backgroundColor: Styles.primaryColor, 575 | )), 576 | body: Builder(builder: (builder) { 577 | return Center( 578 | child: Column( 579 | mainAxisAlignment: MainAxisAlignment.center, 580 | children: createRows(), 581 | ), 582 | ); 583 | }), 584 | floatingActionButton: FloatingActionButton( 585 | foregroundColor: Styles.primaryBackgroundColor, 586 | backgroundColor: isFABDisabled 587 | ? Styles.primaryColor[900] 588 | : Styles.primaryColor, 589 | onPressed: 590 | isFABDisabled ? null : () => showOptionModalSheet(context), 591 | child: const Icon(Icons.menu_rounded), 592 | ))); 593 | } 594 | } 595 | -------------------------------------------------------------------------------- /sudoku/lib/material_color_generator.dart: -------------------------------------------------------------------------------- 1 | // ignore_for_file: avoid_print 2 | 3 | import 'package:flutter/material.dart'; 4 | 5 | MaterialColor createMaterialColor(String hexColorCode) { 6 | Color color = Color(int.parse("0xFF$hexColorCode")); 7 | List strengths = [.05]; 8 | Map swatch = {}; 9 | final int r = color.red, g = color.green, b = color.blue; 10 | 11 | for (int i = 1; i < 10; i++) { 12 | strengths.add(0.1 * i); 13 | } 14 | for (var strength in strengths) { 15 | final double ds = 0.5 - strength; 16 | swatch[(strength * 1000).round()] = Color.fromRGBO( 17 | r + ((ds < 0 ? r : (255 - r)) * ds).round(), 18 | g + ((ds < 0 ? g : (255 - g)) * ds).round(), 19 | b + ((ds < 0 ? b : (255 - b)) * ds).round(), 20 | 1, 21 | ); 22 | } 23 | // print(color.value); 24 | // print(swatch); 25 | print("MaterialColor(${color.value},$swatch);"); 26 | return MaterialColor(color.value, swatch); 27 | } 28 | 29 | void main() { 30 | // ignore: unused_local_variable 31 | MaterialColor grey = createMaterialColor("303030"); 32 | } 33 | -------------------------------------------------------------------------------- /sudoku/lib/splash_screen_page.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | import 'package:splashscreen/splashscreen.dart'; 3 | 4 | import 'main.dart'; 5 | import 'styles.dart'; 6 | 7 | class SplashScreenPage extends StatefulWidget { 8 | const SplashScreenPage({Key? key}) : super(key: key); 9 | 10 | @override 11 | SplashScreenPageState createState() => SplashScreenPageState(); 12 | } 13 | 14 | class SplashScreenPageState extends State { 15 | @override 16 | void initState() { 17 | super.initState(); 18 | } 19 | 20 | @override 21 | Widget build(BuildContext context) { 22 | return SplashScreen( 23 | seconds: 2, 24 | navigateAfterSeconds: const HomePage(), 25 | title: Text( 26 | '\nSudoku', 27 | style: TextStyle( 28 | fontWeight: FontWeight.bold, 29 | fontSize: 25.0, 30 | color: Styles.foregroundColor), 31 | ), 32 | image: Image.asset('assets/icon/icon_foreground.png'), 33 | photoSize: 50, 34 | backgroundColor: Styles.primaryBackgroundColor, 35 | useLoader: true, 36 | loaderColor: Styles.primaryColor, 37 | loadingText: const Text( 38 | 'VarunS2002', 39 | style: TextStyle(color: Colors.grey), 40 | ), 41 | loadingTextPadding: const EdgeInsets.only(top: 10.0), 42 | styleTextUnderTheLoader: const TextStyle( 43 | fontSize: 18.0, fontWeight: FontWeight.bold, color: Colors.black), 44 | ); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sudoku/lib/styles.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class Styles { 4 | // #FFFFFF 5 | static const MaterialColor white = MaterialColor(4294967295, { 6 | 50: Color(0xffffffff), 7 | 100: Color(0xffffffff), 8 | 200: Color(0xffffffff), 9 | 300: Color(0xffffffff), 10 | 400: Color(0xffffffff), 11 | 500: Color(0xffffffff), 12 | 600: Color(0xffe5e5e5), 13 | 700: Color(0xffcccccc), 14 | 800: Color(0xffb2b2b2), 15 | 900: Color(0xff999999) 16 | }); 17 | 18 | // 303030 19 | static const MaterialColor grey = MaterialColor(4281348144, { 20 | 50: Color(0xff8d8d8d), 21 | 100: Color(0xff838383), 22 | 200: Color(0xff6e6e6e), 23 | 300: Color(0xff595959), 24 | 400: Color(0xff454545), 25 | 500: Color(0xff303030), 26 | 600: Color(0xff2b2b2b), 27 | 700: Color(0xff262626), 28 | 800: Color(0xff222222), 29 | 900: Color(0xff1d1d1d) 30 | }); 31 | 32 | // #121212 33 | static const MaterialColor darkGrey = MaterialColor(4279374354, { 34 | 50: Color(0xff7d7d7d), 35 | 100: Color(0xff717171), 36 | 200: Color(0xff595959), 37 | 300: Color(0xff414141), 38 | 400: Color(0xff2a2a2a), 39 | 500: Color(0xff121212), 40 | 600: Color(0xff101010), 41 | 700: Color(0xff0e0e0e), 42 | 800: Color(0xff0d0d0d), 43 | 900: Color(0xff0b0b0b) 44 | }); 45 | 46 | // 3DC2FF 47 | static const MaterialColor ionicCyan = MaterialColor(4282237695, { 48 | 50: Color(0xff94ddff), 49 | 100: Color(0xff8bdaff), 50 | 200: Color(0xff77d4ff), 51 | 300: Color(0xff64ceff), 52 | 400: Color(0xff50c8ff), 53 | 500: Color(0xff3dc2ff), 54 | 600: Color(0xff37afe5), 55 | 700: Color(0xff319bcc), 56 | 800: Color(0xff2b88b2), 57 | 900: Color(0xff257499) 58 | }); 59 | 60 | // #3880FF 61 | static const MaterialColor ionicBlue = MaterialColor(4281893119, { 62 | 50: Color(0xff92b9ff), 63 | 100: Color(0xff88b3ff), 64 | 200: Color(0xff74a6ff), 65 | 300: Color(0xff6099ff), 66 | 400: Color(0xff4c8dff), 67 | 500: Color(0xff3880ff), 68 | 600: Color(0xff3273e5), 69 | 700: Color(0xff2d66cc), 70 | 800: Color(0xff275ab2), 71 | 900: Color(0xff224d99) 72 | }); 73 | 74 | // #5260FF 75 | static const MaterialColor ionicIndigo = MaterialColor(4283588863, { 76 | 50: Color(0xffa0a8ff), 77 | 100: Color(0xff97a0ff), 78 | 200: Color(0xff8690ff), 79 | 300: Color(0xff7580ff), 80 | 400: Color(0xff6370ff), 81 | 500: Color(0xff5260ff), 82 | 600: Color(0xff4a56e5), 83 | 700: Color(0xff424dcc), 84 | 800: Color(0xff3943b2), 85 | 900: Color(0xff313a99) 86 | }); 87 | 88 | // 7C4DFF 89 | static const MaterialColor violet = MaterialColor(4286336511, { 90 | 50: Color(0xffb79dff), 91 | 100: Color(0xffb094ff), 92 | 200: Color(0xffa382ff), 93 | 300: Color(0xff9671ff), 94 | 400: Color(0xff895fff), 95 | 500: Color(0xff7c4dff), 96 | 600: Color(0xff7045e5), 97 | 700: Color(0xff633ecc), 98 | 800: Color(0xff5736b2), 99 | 900: Color(0xff4a2e99) 100 | }); 101 | 102 | // E040FB 103 | static const MaterialColor purple = MaterialColor(4292886779, { 104 | 50: Color(0xffee96fd), 105 | 100: Color(0xffec8cfd), 106 | 200: Color(0xffe979fc), 107 | 300: Color(0xffe666fc), 108 | 400: Color(0xffe353fb), 109 | 500: Color(0xffe040fb), 110 | 600: Color(0xffca3ae2), 111 | 700: Color(0xffb333c9), 112 | 800: Color(0xff9d2db0), 113 | 900: Color(0xff862697) 114 | }); 115 | 116 | // F00075 117 | static const MaterialColor pink = MaterialColor(4293918837, { 118 | 50: Color(0xfff773b3), 119 | 100: Color(0xfff666ac), 120 | 200: Color(0xfff54d9e), 121 | 300: Color(0xfff33391), 122 | 400: Color(0xfff11983), 123 | 500: Color(0xfff00075), 124 | 600: Color(0xffd80069), 125 | 700: Color(0xffc0005e), 126 | 800: Color(0xffa80052), 127 | 900: Color(0xff900046) 128 | }); 129 | 130 | // EB0028 131 | static const MaterialColor oneplusRed = MaterialColor(4293591080, { 132 | 50: Color(0xfff47389), 133 | 100: Color(0xfff3667e), 134 | 200: Color(0xfff14d69), 135 | 300: Color(0xffef3353), 136 | 400: Color(0xffed193d), 137 | 500: Color(0xffeb0028), 138 | 600: Color(0xffd30024), 139 | 700: Color(0xffbc0020), 140 | 800: Color(0xffa4001c), 141 | 900: Color(0xff8d0018) 142 | }); 143 | 144 | // #EB445A 145 | static const MaterialColor lightRed = MaterialColor(4293608538, { 146 | 50: Color(0xfff498a4), 147 | 100: Color(0xfff38f9c), 148 | 200: Color(0xfff17c8c), 149 | 300: Color(0xffef697b), 150 | 400: Color(0xffed576a), 151 | 500: Color(0xffeb445a), 152 | 600: Color(0xffd33d51), 153 | 700: Color(0xffbc3648), 154 | 800: Color(0xffa4303f), 155 | 900: Color(0xff8d2936) 156 | }); 157 | 158 | // FF5722 159 | static const MaterialColor orange = MaterialColor(4294924066, { 160 | 50: Color(0xffffa385), 161 | 100: Color(0xffff9a7a), 162 | 200: Color(0xffff8964), 163 | 300: Color(0xffff794e), 164 | 400: Color(0xffff6838), 165 | 500: Color(0xffff5722), 166 | 600: Color(0xffe54e1f), 167 | 700: Color(0xffcc461b), 168 | 800: Color(0xffb23d18), 169 | 900: Color(0xff993414) 170 | }); 171 | 172 | // 21EF8B 173 | static const MaterialColor aospExtendedGreen = MaterialColor(4280414091, { 174 | 50: Color(0xff85f6bf), 175 | 100: Color(0xff7af5b9), 176 | 200: Color(0xff64f4ae), 177 | 300: Color(0xff4df2a2), 178 | 400: Color(0xff37f197), 179 | 500: Color(0xff21ef8b), 180 | 600: Color(0xff1ed77d), 181 | 700: Color(0xff1abf6f), 182 | 800: Color(0xff17a761), 183 | 900: Color(0xff148f53) 184 | }); 185 | 186 | static MaterialColor primaryBackgroundColor = darkGrey; 187 | static MaterialColor secondaryBackgroundColor = grey; 188 | static MaterialColor foregroundColor = white; 189 | static MaterialColor primaryColor = ionicBlue; 190 | static MaterialColor secondaryColor = lightRed; 191 | 192 | static final Map accentColors = { 193 | 'Cyan': ionicCyan, 194 | 'Blue': ionicBlue, 195 | 'Indigo': ionicIndigo, 196 | 'Violet': violet, 197 | 'Purple': purple, 198 | 'Pink': pink, 199 | 'Red': oneplusRed, 200 | 'Orange': orange, 201 | 'Green': aospExtendedGreen, 202 | }; 203 | } 204 | -------------------------------------------------------------------------------- /sudoku/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | archive: 5 | dependency: transitive 6 | description: 7 | name: archive 8 | url: "https://pub.dartlang.org" 9 | source: hosted 10 | version: "3.3.0" 11 | args: 12 | dependency: transitive 13 | description: 14 | name: args 15 | url: "https://pub.dartlang.org" 16 | source: hosted 17 | version: "2.3.1" 18 | async: 19 | dependency: transitive 20 | description: 21 | name: async 22 | url: "https://pub.dartlang.org" 23 | source: hosted 24 | version: "2.8.2" 25 | bitsdojo_window: 26 | dependency: "direct main" 27 | description: 28 | name: bitsdojo_window 29 | url: "https://pub.dartlang.org" 30 | source: hosted 31 | version: "0.1.2" 32 | bitsdojo_window_linux: 33 | dependency: transitive 34 | description: 35 | name: bitsdojo_window_linux 36 | url: "https://pub.dartlang.org" 37 | source: hosted 38 | version: "0.1.2" 39 | bitsdojo_window_macos: 40 | dependency: transitive 41 | description: 42 | name: bitsdojo_window_macos 43 | url: "https://pub.dartlang.org" 44 | source: hosted 45 | version: "0.1.2" 46 | bitsdojo_window_platform_interface: 47 | dependency: transitive 48 | description: 49 | name: bitsdojo_window_platform_interface 50 | url: "https://pub.dartlang.org" 51 | source: hosted 52 | version: "0.1.2" 53 | bitsdojo_window_windows: 54 | dependency: transitive 55 | description: 56 | name: bitsdojo_window_windows 57 | url: "https://pub.dartlang.org" 58 | source: hosted 59 | version: "0.1.2" 60 | boolean_selector: 61 | dependency: transitive 62 | description: 63 | name: boolean_selector 64 | url: "https://pub.dartlang.org" 65 | source: hosted 66 | version: "2.1.0" 67 | characters: 68 | dependency: transitive 69 | description: 70 | name: characters 71 | url: "https://pub.dartlang.org" 72 | source: hosted 73 | version: "1.2.0" 74 | charcode: 75 | dependency: transitive 76 | description: 77 | name: charcode 78 | url: "https://pub.dartlang.org" 79 | source: hosted 80 | version: "1.3.1" 81 | clock: 82 | dependency: transitive 83 | description: 84 | name: clock 85 | url: "https://pub.dartlang.org" 86 | source: hosted 87 | version: "1.1.0" 88 | collection: 89 | dependency: transitive 90 | description: 91 | name: collection 92 | url: "https://pub.dartlang.org" 93 | source: hosted 94 | version: "1.16.0" 95 | crypto: 96 | dependency: transitive 97 | description: 98 | name: crypto 99 | url: "https://pub.dartlang.org" 100 | source: hosted 101 | version: "3.0.2" 102 | fake_async: 103 | dependency: transitive 104 | description: 105 | name: fake_async 106 | url: "https://pub.dartlang.org" 107 | source: hosted 108 | version: "1.3.0" 109 | ffi: 110 | dependency: transitive 111 | description: 112 | name: ffi 113 | url: "https://pub.dartlang.org" 114 | source: hosted 115 | version: "1.2.1" 116 | file: 117 | dependency: transitive 118 | description: 119 | name: file 120 | url: "https://pub.dartlang.org" 121 | source: hosted 122 | version: "6.1.2" 123 | flutter: 124 | dependency: "direct main" 125 | description: flutter 126 | source: sdk 127 | version: "0.0.0" 128 | flutter_animated_dialog: 129 | dependency: "direct main" 130 | description: 131 | name: flutter_animated_dialog 132 | url: "https://pub.dartlang.org" 133 | source: hosted 134 | version: "2.0.1" 135 | flutter_lints: 136 | dependency: "direct dev" 137 | description: 138 | name: flutter_lints 139 | url: "https://pub.dartlang.org" 140 | source: hosted 141 | version: "2.0.1" 142 | flutter_native_splash: 143 | dependency: "direct dev" 144 | description: 145 | name: flutter_native_splash 146 | url: "https://pub.dartlang.org" 147 | source: hosted 148 | version: "2.2.3+1" 149 | flutter_test: 150 | dependency: "direct dev" 151 | description: flutter 152 | source: sdk 153 | version: "0.0.0" 154 | flutter_web_plugins: 155 | dependency: transitive 156 | description: flutter 157 | source: sdk 158 | version: "0.0.0" 159 | image: 160 | dependency: transitive 161 | description: 162 | name: image 163 | url: "https://pub.dartlang.org" 164 | source: hosted 165 | version: "3.2.0" 166 | js: 167 | dependency: transitive 168 | description: 169 | name: js 170 | url: "https://pub.dartlang.org" 171 | source: hosted 172 | version: "0.6.4" 173 | lint: 174 | dependency: transitive 175 | description: 176 | name: lint 177 | url: "https://pub.dartlang.org" 178 | source: hosted 179 | version: "1.8.2" 180 | lints: 181 | dependency: transitive 182 | description: 183 | name: lints 184 | url: "https://pub.dartlang.org" 185 | source: hosted 186 | version: "2.0.0" 187 | matcher: 188 | dependency: transitive 189 | description: 190 | name: matcher 191 | url: "https://pub.dartlang.org" 192 | source: hosted 193 | version: "0.12.11" 194 | material_color_utilities: 195 | dependency: transitive 196 | description: 197 | name: material_color_utilities 198 | url: "https://pub.dartlang.org" 199 | source: hosted 200 | version: "0.1.4" 201 | meta: 202 | dependency: transitive 203 | description: 204 | name: meta 205 | url: "https://pub.dartlang.org" 206 | source: hosted 207 | version: "1.7.0" 208 | path: 209 | dependency: transitive 210 | description: 211 | name: path 212 | url: "https://pub.dartlang.org" 213 | source: hosted 214 | version: "1.8.1" 215 | path_provider_linux: 216 | dependency: transitive 217 | description: 218 | name: path_provider_linux 219 | url: "https://pub.dartlang.org" 220 | source: hosted 221 | version: "2.1.7" 222 | path_provider_platform_interface: 223 | dependency: transitive 224 | description: 225 | name: path_provider_platform_interface 226 | url: "https://pub.dartlang.org" 227 | source: hosted 228 | version: "2.0.4" 229 | path_provider_windows: 230 | dependency: transitive 231 | description: 232 | name: path_provider_windows 233 | url: "https://pub.dartlang.org" 234 | source: hosted 235 | version: "2.0.7" 236 | petitparser: 237 | dependency: transitive 238 | description: 239 | name: petitparser 240 | url: "https://pub.dartlang.org" 241 | source: hosted 242 | version: "5.0.0" 243 | platform: 244 | dependency: transitive 245 | description: 246 | name: platform 247 | url: "https://pub.dartlang.org" 248 | source: hosted 249 | version: "3.1.0" 250 | plugin_platform_interface: 251 | dependency: transitive 252 | description: 253 | name: plugin_platform_interface 254 | url: "https://pub.dartlang.org" 255 | source: hosted 256 | version: "2.1.2" 257 | process: 258 | dependency: transitive 259 | description: 260 | name: process 261 | url: "https://pub.dartlang.org" 262 | source: hosted 263 | version: "4.2.4" 264 | shared_preferences: 265 | dependency: "direct main" 266 | description: 267 | name: shared_preferences 268 | url: "https://pub.dartlang.org" 269 | source: hosted 270 | version: "2.0.15" 271 | shared_preferences_android: 272 | dependency: transitive 273 | description: 274 | name: shared_preferences_android 275 | url: "https://pub.dartlang.org" 276 | source: hosted 277 | version: "2.0.12" 278 | shared_preferences_ios: 279 | dependency: transitive 280 | description: 281 | name: shared_preferences_ios 282 | url: "https://pub.dartlang.org" 283 | source: hosted 284 | version: "2.1.1" 285 | shared_preferences_linux: 286 | dependency: transitive 287 | description: 288 | name: shared_preferences_linux 289 | url: "https://pub.dartlang.org" 290 | source: hosted 291 | version: "2.1.1" 292 | shared_preferences_macos: 293 | dependency: transitive 294 | description: 295 | name: shared_preferences_macos 296 | url: "https://pub.dartlang.org" 297 | source: hosted 298 | version: "2.0.4" 299 | shared_preferences_platform_interface: 300 | dependency: transitive 301 | description: 302 | name: shared_preferences_platform_interface 303 | url: "https://pub.dartlang.org" 304 | source: hosted 305 | version: "2.0.0" 306 | shared_preferences_web: 307 | dependency: transitive 308 | description: 309 | name: shared_preferences_web 310 | url: "https://pub.dartlang.org" 311 | source: hosted 312 | version: "2.0.4" 313 | shared_preferences_windows: 314 | dependency: transitive 315 | description: 316 | name: shared_preferences_windows 317 | url: "https://pub.dartlang.org" 318 | source: hosted 319 | version: "2.1.1" 320 | sky_engine: 321 | dependency: transitive 322 | description: flutter 323 | source: sdk 324 | version: "0.0.99" 325 | source_span: 326 | dependency: transitive 327 | description: 328 | name: source_span 329 | url: "https://pub.dartlang.org" 330 | source: hosted 331 | version: "1.8.2" 332 | splashscreen: 333 | dependency: "direct main" 334 | description: 335 | path: "." 336 | ref: a05b64f8326f7c2615491e9f47a1f2dcf8b28a69 337 | resolved-ref: a05b64f8326f7c2615491e9f47a1f2dcf8b28a69 338 | url: "https://github.com/DPLYR-dev/SplashScreenFlutterPackage.git" 339 | source: git 340 | version: "1.4.0" 341 | stack_trace: 342 | dependency: transitive 343 | description: 344 | name: stack_trace 345 | url: "https://pub.dartlang.org" 346 | source: hosted 347 | version: "1.10.0" 348 | stream_channel: 349 | dependency: transitive 350 | description: 351 | name: stream_channel 352 | url: "https://pub.dartlang.org" 353 | source: hosted 354 | version: "2.1.0" 355 | string_scanner: 356 | dependency: transitive 357 | description: 358 | name: string_scanner 359 | url: "https://pub.dartlang.org" 360 | source: hosted 361 | version: "1.1.0" 362 | sudoku_solver_generator: 363 | dependency: "direct main" 364 | description: 365 | name: sudoku_solver_generator 366 | url: "https://pub.dartlang.org" 367 | source: hosted 368 | version: "2.1.0+1" 369 | term_glyph: 370 | dependency: transitive 371 | description: 372 | name: term_glyph 373 | url: "https://pub.dartlang.org" 374 | source: hosted 375 | version: "1.2.0" 376 | test_api: 377 | dependency: transitive 378 | description: 379 | name: test_api 380 | url: "https://pub.dartlang.org" 381 | source: hosted 382 | version: "0.4.9" 383 | typed_data: 384 | dependency: transitive 385 | description: 386 | name: typed_data 387 | url: "https://pub.dartlang.org" 388 | source: hosted 389 | version: "1.3.1" 390 | universal_io: 391 | dependency: transitive 392 | description: 393 | name: universal_io 394 | url: "https://pub.dartlang.org" 395 | source: hosted 396 | version: "2.0.4" 397 | url_launcher: 398 | dependency: "direct main" 399 | description: 400 | name: url_launcher 401 | url: "https://pub.dartlang.org" 402 | source: hosted 403 | version: "6.1.4" 404 | url_launcher_android: 405 | dependency: transitive 406 | description: 407 | name: url_launcher_android 408 | url: "https://pub.dartlang.org" 409 | source: hosted 410 | version: "6.0.17" 411 | url_launcher_ios: 412 | dependency: transitive 413 | description: 414 | name: url_launcher_ios 415 | url: "https://pub.dartlang.org" 416 | source: hosted 417 | version: "6.0.17" 418 | url_launcher_linux: 419 | dependency: transitive 420 | description: 421 | name: url_launcher_linux 422 | url: "https://pub.dartlang.org" 423 | source: hosted 424 | version: "3.0.1" 425 | url_launcher_macos: 426 | dependency: transitive 427 | description: 428 | name: url_launcher_macos 429 | url: "https://pub.dartlang.org" 430 | source: hosted 431 | version: "3.0.1" 432 | url_launcher_platform_interface: 433 | dependency: transitive 434 | description: 435 | name: url_launcher_platform_interface 436 | url: "https://pub.dartlang.org" 437 | source: hosted 438 | version: "2.1.0" 439 | url_launcher_web: 440 | dependency: transitive 441 | description: 442 | name: url_launcher_web 443 | url: "https://pub.dartlang.org" 444 | source: hosted 445 | version: "2.0.12" 446 | url_launcher_windows: 447 | dependency: transitive 448 | description: 449 | name: url_launcher_windows 450 | url: "https://pub.dartlang.org" 451 | source: hosted 452 | version: "3.0.1" 453 | vector_math: 454 | dependency: transitive 455 | description: 456 | name: vector_math 457 | url: "https://pub.dartlang.org" 458 | source: hosted 459 | version: "2.1.2" 460 | win32: 461 | dependency: transitive 462 | description: 463 | name: win32 464 | url: "https://pub.dartlang.org" 465 | source: hosted 466 | version: "2.6.1" 467 | xdg_directories: 468 | dependency: transitive 469 | description: 470 | name: xdg_directories 471 | url: "https://pub.dartlang.org" 472 | source: hosted 473 | version: "0.2.0+1" 474 | xml: 475 | dependency: transitive 476 | description: 477 | name: xml 478 | url: "https://pub.dartlang.org" 479 | source: hosted 480 | version: "6.1.0" 481 | yaml: 482 | dependency: transitive 483 | description: 484 | name: yaml 485 | url: "https://pub.dartlang.org" 486 | source: hosted 487 | version: "3.1.1" 488 | sdks: 489 | dart: ">=2.17.1 <3.0.0" 490 | flutter: ">=3.0.0" 491 | -------------------------------------------------------------------------------- /sudoku/pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: sudoku 2 | description: A fully fledged Sudoku game. 3 | 4 | # The following line prevents the package from being accidentally published to 5 | # pub.dev using `flutter pub publish`. This is preferred for private packages. 6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev 7 | 8 | # The following defines the version and build number for your application. 9 | # A version number is three numbers separated by dots, like 1.2.43 10 | # followed by an optional build number separated by a +. 11 | # Both the version and the builder number may be overridden in flutter 12 | # build by specifying --build-name and --build-number, respectively. 13 | # In Android, build-name is used as versionName while build-number used as versionCode. 14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning 15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. 16 | # Read more about iOS versioning at 17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html 18 | version: 2.4.1+2041 19 | 20 | environment: 21 | sdk: ">=2.17.1 <3.0.0" 22 | flutter: ">=3.0.0" 23 | 24 | # Dependencies specify other packages that your package needs in order to work. 25 | # To automatically upgrade your package dependencies to the latest versions 26 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 27 | # dependencies can be manually updated by changing the version numbers below to 28 | # the latest version available on pub.dev. To see which dependencies have newer 29 | # versions available, run `flutter pub outdated`. 30 | dependencies: 31 | flutter: 32 | sdk: flutter 33 | 34 | # Sudoku Logic 35 | sudoku_solver_generator: ^2.1.0+1 36 | 37 | # Saving Preferences Locally 38 | shared_preferences: ^2.0.15 39 | 40 | # Animated Alert Dialogs 41 | flutter_animated_dialog: ^2.0.1 42 | 43 | # Splashscreen 1.4.0 44 | splashscreen: 45 | git: 46 | url: https://github.com/DPLYR-dev/SplashScreenFlutterPackage.git 47 | ref: a05b64f8326f7c2615491e9f47a1f2dcf8b28a69 48 | 49 | # Hyperlinks 50 | url_launcher: ^6.1.4 51 | 52 | # Windows Title Bar 53 | bitsdojo_window: ^0.1.2 54 | 55 | # The following adds the Cupertino Icons font to your application. 56 | # Use with the CupertinoIcons class for iOS style icons. 57 | # cupertino_icons: ^1.0.2 58 | 59 | dev_dependencies: 60 | flutter_test: 61 | sdk: flutter 62 | 63 | # The "flutter_lints" package below contains a set of recommended lints to 64 | # encourage good coding practices. The lint set provided by the package is 65 | # activated in the `analysis_options.yaml` file located at the root of your 66 | # package. See that file for information about deactivating specific lint 67 | # rules and activating additional ones. 68 | flutter_lints: ^2.0.1 69 | 70 | # Native Splashscreen 71 | flutter_native_splash: ^2.2.3+1 72 | 73 | # For information on the generic Dart part of this file, see the 74 | # following page: https://dart.dev/tools/pub/pubspec 75 | 76 | # The following section is specific to Flutter packages. 77 | flutter: 78 | 79 | # The following line ensures that the Material Icons font is 80 | # included with your application, so that you can use the icons in 81 | # the material Icons class. 82 | uses-material-design: true 83 | 84 | # To add assets to your application, add an assets section, like this: 85 | # assets: 86 | # - images/a_dot_burr.jpeg 87 | # - images/a_dot_ham.jpeg 88 | 89 | assets: 90 | - assets/icon/icon_foreground.png 91 | - assets/icon/icon_round.png 92 | 93 | # An image asset can refer to one or more resolution-specific "variants", see 94 | # https://flutter.dev/assets-and-images/#resolution-aware 95 | 96 | # For details regarding adding assets from package dependencies, see 97 | # https://flutter.dev/assets-and-images/#from-packages 98 | 99 | # To add custom fonts to your application, add a fonts section here, 100 | # in this "flutter" section. Each entry in this list should have a 101 | # "family" key with the font family name, and a "fonts" key with a 102 | # list giving the asset and other descriptors for the font. For 103 | # example: 104 | # fonts: 105 | # - family: Schyler 106 | # fonts: 107 | # - asset: fonts/Schyler-Regular.ttf 108 | # - asset: fonts/Schyler-Italic.ttf 109 | # style: italic 110 | # - family: Trajan Pro 111 | # fonts: 112 | # - asset: fonts/TrajanPro.ttf 113 | # - asset: fonts/TrajanPro_Bold.ttf 114 | # weight: 700 115 | # 116 | # For details regarding fonts from package dependencies, 117 | # see https://flutter.dev/custom-fonts/#from-packages 118 | -------------------------------------------------------------------------------- /sudoku/web/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/favicon.ico -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-128.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-192.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-384.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-512.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-72.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-96.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-maskable-128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-maskable-128.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-maskable-384.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-maskable-384.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-maskable-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-maskable-72.png -------------------------------------------------------------------------------- /sudoku/web/icons/Icon-maskable-96.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/icons/Icon-maskable-96.png -------------------------------------------------------------------------------- /sudoku/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | Sudoku 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 49 | 51 | 52 | 53 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /sudoku/web/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Sudoku", 3 | "short_name": "Sudoku", 4 | "start_url": ".", 5 | "display": "standalone", 6 | "background_color": "#121212", 7 | "theme_color": "#3880FF", 8 | "description": "A fully fledged Sudoku game.", 9 | "orientation": "portrait-primary", 10 | "prefer_related_applications": false, 11 | "icons": [ 12 | { 13 | "src": "icons/Icon-72.png", 14 | "sizes": "72x72", 15 | "type": "image/png" 16 | }, 17 | { 18 | "src": "icons/Icon-96.png", 19 | "sizes": "96x96", 20 | "type": "image/png" 21 | }, 22 | { 23 | "src": "icons/Icon-128.png", 24 | "sizes": "128x128", 25 | "type": "image/png" 26 | }, 27 | { 28 | "src": "icons/Icon-192.png", 29 | "sizes": "192x192", 30 | "type": "image/png" 31 | }, 32 | { 33 | "src": "icons/Icon-384.png", 34 | "sizes": "384x384", 35 | "type": "image/png" 36 | }, 37 | { 38 | "src": "icons/Icon-512.png", 39 | "sizes": "512x512", 40 | "type": "image/png" 41 | }, 42 | { 43 | "src": "icons/Icon-maskable-72.png", 44 | "sizes": "72x72", 45 | "type": "image/png", 46 | "purpose": "maskable" 47 | }, 48 | { 49 | "src": "icons/Icon-maskable-96.png", 50 | "sizes": "96x96", 51 | "type": "image/png", 52 | "purpose": "maskable" 53 | }, 54 | { 55 | "src": "icons/Icon-maskable-128.png", 56 | "sizes": "128x128", 57 | "type": "image/png", 58 | "purpose": "maskable" 59 | }, 60 | { 61 | "src": "icons/Icon-maskable-192.png", 62 | "sizes": "192x192", 63 | "type": "image/png", 64 | "purpose": "maskable" 65 | }, 66 | { 67 | "src": "icons/Icon-maskable-384.png", 68 | "sizes": "384x384", 69 | "type": "image/png", 70 | "purpose": "maskable" 71 | }, 72 | { 73 | "src": "icons/Icon-maskable-512.png", 74 | "sizes": "512x512", 75 | "type": "image/png", 76 | "purpose": "maskable" 77 | } 78 | ], 79 | "screenshots": [ 80 | { 81 | "src": "screenshots/Solved_Dark_324x648.png", 82 | "type": "image/png", 83 | "sizes": "324x648" 84 | }, 85 | { 86 | "src": "screenshots/Solving_Light_324x648.png", 87 | "type": "image/png", 88 | "sizes": "324x648" 89 | }, 90 | { 91 | "src": "screenshots/Choose_324x648.png", 92 | "type": "image/png", 93 | "sizes": "324x648" 94 | }, 95 | { 96 | "src": "screenshots/Result_324x648.png", 97 | "type": "image/png", 98 | "sizes": "324x648" 99 | }, 100 | { 101 | "src": "screenshots/Options_324x648.png", 102 | "type": "image/png", 103 | "sizes": "324x648" 104 | } 105 | ] 106 | } 107 | -------------------------------------------------------------------------------- /sudoku/web/screenshots/Choose_324x648.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/screenshots/Choose_324x648.png -------------------------------------------------------------------------------- /sudoku/web/screenshots/Options_324x648.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/screenshots/Options_324x648.png -------------------------------------------------------------------------------- /sudoku/web/screenshots/Result_324x648.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/screenshots/Result_324x648.png -------------------------------------------------------------------------------- /sudoku/web/screenshots/Solved_Dark_324x648.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/screenshots/Solved_Dark_324x648.png -------------------------------------------------------------------------------- /sudoku/web/screenshots/Solving_Light_324x648.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/screenshots/Solving_Light_324x648.png -------------------------------------------------------------------------------- /sudoku/web/splash/img/dark-1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/splash/img/dark-1x.png -------------------------------------------------------------------------------- /sudoku/web/splash/img/dark-2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/splash/img/dark-2x.png -------------------------------------------------------------------------------- /sudoku/web/splash/img/dark-3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/splash/img/dark-3x.png -------------------------------------------------------------------------------- /sudoku/web/splash/img/dark-4x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/web/splash/img/dark-4x.png -------------------------------------------------------------------------------- /sudoku/web/splash/splash.js: -------------------------------------------------------------------------------- 1 | function removeSplashFromWeb() { 2 | const elem = document.getElementById("splash"); 3 | if (elem) { 4 | elem.remove(); 5 | } 6 | document.body.style.background = "transparent"; 7 | } 8 | -------------------------------------------------------------------------------- /sudoku/web/splash/style.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin:0; 3 | height:100%; 4 | background: #121212; 5 | 6 | background-size: 100% 100%; 7 | } 8 | 9 | .center { 10 | margin: 0; 11 | position: absolute; 12 | top: 50%; 13 | left: 50%; 14 | -ms-transform: translate(-50%, -50%); 15 | transform: translate(-50%, -50%); 16 | } 17 | 18 | .contain { 19 | display:block; 20 | width:100%; height:100%; 21 | object-fit: contain; 22 | } 23 | 24 | .stretch { 25 | display:block; 26 | width:100%; height:100%; 27 | } 28 | 29 | .cover { 30 | display:block; 31 | width:100%; height:100%; 32 | object-fit: cover; 33 | } 34 | 35 | @media (prefers-color-scheme: dark) { 36 | body { 37 | margin:0; 38 | height:100%; 39 | background: #121212; 40 | 41 | background-size: 100% 100%; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /sudoku/windows/.gitignore: -------------------------------------------------------------------------------- 1 | flutter/ephemeral/ 2 | 3 | # Visual Studio user-specific files. 4 | *.suo 5 | *.user 6 | *.userosscache 7 | *.sln.docstates 8 | 9 | # Visual Studio build-related files. 10 | x64/ 11 | x86/ 12 | 13 | # Visual Studio cache files 14 | # files ending in .cache can be ignored 15 | *.[Cc]ache 16 | # but keep track of directories ending in .cache 17 | !*.[Cc]ache/ 18 | -------------------------------------------------------------------------------- /sudoku/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(sudoku LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "sudoku") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /sudoku/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # === Flutter Library === 14 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 15 | 16 | # Published to parent scope for install step. 17 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 18 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 19 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 20 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 21 | 22 | list(APPEND FLUTTER_LIBRARY_HEADERS 23 | "flutter_export.h" 24 | "flutter_windows.h" 25 | "flutter_messenger.h" 26 | "flutter_plugin_registrar.h" 27 | "flutter_texture_registrar.h" 28 | ) 29 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 30 | add_library(flutter INTERFACE) 31 | target_include_directories(flutter INTERFACE 32 | "${EPHEMERAL_DIR}" 33 | ) 34 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 35 | add_dependencies(flutter flutter_assemble) 36 | 37 | # === Wrapper === 38 | list(APPEND CPP_WRAPPER_SOURCES_CORE 39 | "core_implementations.cc" 40 | "standard_codec.cc" 41 | ) 42 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 43 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 44 | "plugin_registrar.cc" 45 | ) 46 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 47 | list(APPEND CPP_WRAPPER_SOURCES_APP 48 | "flutter_engine.cc" 49 | "flutter_view_controller.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 52 | 53 | # Wrapper sources needed for a plugin. 54 | add_library(flutter_wrapper_plugin STATIC 55 | ${CPP_WRAPPER_SOURCES_CORE} 56 | ${CPP_WRAPPER_SOURCES_PLUGIN} 57 | ) 58 | apply_standard_settings(flutter_wrapper_plugin) 59 | set_target_properties(flutter_wrapper_plugin PROPERTIES 60 | POSITION_INDEPENDENT_CODE ON) 61 | set_target_properties(flutter_wrapper_plugin PROPERTIES 62 | CXX_VISIBILITY_PRESET hidden) 63 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 64 | target_include_directories(flutter_wrapper_plugin PUBLIC 65 | "${WRAPPER_ROOT}/include" 66 | ) 67 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 68 | 69 | # Wrapper sources needed for the runner. 70 | add_library(flutter_wrapper_app STATIC 71 | ${CPP_WRAPPER_SOURCES_CORE} 72 | ${CPP_WRAPPER_SOURCES_APP} 73 | ) 74 | apply_standard_settings(flutter_wrapper_app) 75 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 76 | target_include_directories(flutter_wrapper_app PUBLIC 77 | "${WRAPPER_ROOT}/include" 78 | ) 79 | add_dependencies(flutter_wrapper_app flutter_assemble) 80 | 81 | # === Flutter tool backend === 82 | # _phony_ is a non-existent file to force this command to run every time, 83 | # since currently there's no way to get a full input/output list from the 84 | # flutter tool. 85 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 86 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 87 | add_custom_command( 88 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 89 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 90 | ${CPP_WRAPPER_SOURCES_APP} 91 | ${PHONY_OUTPUT} 92 | COMMAND ${CMAKE_COMMAND} -E env 93 | ${FLUTTER_TOOL_ENVIRONMENT} 94 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 95 | windows-x64 $ 96 | VERBATIM 97 | ) 98 | add_custom_target(flutter_assemble DEPENDS 99 | "${FLUTTER_LIBRARY}" 100 | ${FLUTTER_LIBRARY_HEADERS} 101 | ${CPP_WRAPPER_SOURCES_CORE} 102 | ${CPP_WRAPPER_SOURCES_PLUGIN} 103 | ${CPP_WRAPPER_SOURCES_APP} 104 | ) 105 | -------------------------------------------------------------------------------- /sudoku/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | #include 10 | #include 11 | 12 | void RegisterPlugins(flutter::PluginRegistry* registry) { 13 | BitsdojoWindowPluginRegisterWithRegistrar( 14 | registry->GetRegistrarForPlugin("BitsdojoWindowPlugin")); 15 | UrlLauncherWindowsRegisterWithRegistrar( 16 | registry->GetRegistrarForPlugin("UrlLauncherWindows")); 17 | } 18 | -------------------------------------------------------------------------------- /sudoku/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /sudoku/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | bitsdojo_window_windows 7 | url_launcher_windows 8 | ) 9 | 10 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 11 | ) 12 | 13 | set(PLUGIN_BUNDLED_LIBRARIES) 14 | 15 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 16 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 17 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 18 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 19 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 20 | endforeach(plugin) 21 | 22 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 23 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 24 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 25 | endforeach(ffi_plugin) 26 | -------------------------------------------------------------------------------- /sudoku/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Disable Windows macros that collide with C++ standard library functions. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 25 | 26 | # Add dependency libraries and include directories. Add any application-specific 27 | # dependencies here. 28 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 29 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 30 | 31 | # Run the Flutter tool portions of the build. This must not be removed. 32 | add_dependencies(${BINARY_NAME} flutter_assemble) 33 | -------------------------------------------------------------------------------- /sudoku/windows/runner/Runner.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #pragma code_page(65001) 4 | #include "resource.h" 5 | 6 | #define APSTUDIO_READONLY_SYMBOLS 7 | ///////////////////////////////////////////////////////////////////////////// 8 | // 9 | // Generated from the TEXTINCLUDE 2 resource. 10 | // 11 | #include "winres.h" 12 | 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (United States) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 21 | 22 | #ifdef APSTUDIO_INVOKED 23 | ///////////////////////////////////////////////////////////////////////////// 24 | // 25 | // TEXTINCLUDE 26 | // 27 | 28 | 1 TEXTINCLUDE 29 | BEGIN 30 | "resource.h\0" 31 | END 32 | 33 | 2 TEXTINCLUDE 34 | BEGIN 35 | "#include ""winres.h""\r\n" 36 | "\0" 37 | END 38 | 39 | 3 TEXTINCLUDE 40 | BEGIN 41 | "\r\n" 42 | "\0" 43 | END 44 | 45 | #endif // APSTUDIO_INVOKED 46 | 47 | 48 | ///////////////////////////////////////////////////////////////////////////// 49 | // 50 | // Icon 51 | // 52 | 53 | // Icon with lowest ID value placed first to ensure application icon 54 | // remains consistent on all systems. 55 | IDI_APP_ICON ICON "resources\\app_icon.ico" 56 | 57 | 58 | ///////////////////////////////////////////////////////////////////////////// 59 | // 60 | // Version 61 | // 62 | 63 | #ifdef FLUTTER_BUILD_NUMBER 64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER 65 | #else 66 | #define VERSION_AS_NUMBER 2,4,1,0 67 | #endif 68 | 69 | #ifdef FLUTTER_BUILD_NAME 70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME 71 | #else 72 | #define VERSION_AS_STRING "2.4.1\0" 73 | #endif 74 | 75 | VS_VERSION_INFO VERSIONINFO 76 | FILEVERSION VERSION_AS_NUMBER 77 | PRODUCTVERSION VERSION_AS_NUMBER 78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK 79 | #ifdef _DEBUG 80 | FILEFLAGS VS_FF_DEBUG 81 | #else 82 | FILEFLAGS 0x0L 83 | #endif 84 | FILEOS VOS__WINDOWS32 85 | FILETYPE VFT_APP 86 | FILESUBTYPE 0x0L 87 | BEGIN 88 | BLOCK "StringFileInfo" 89 | BEGIN 90 | BLOCK "040904e4" 91 | BEGIN 92 | VALUE "CompanyName", "VarunS2002" "\0" 93 | VALUE "FileDescription", "A fully fledged Sudoku game." "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "sudoku" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 VarunS2002. All rights reserved." "\0" 97 | VALUE "OriginalFilename", "sudoku.exe" "\0" 98 | VALUE "ProductName", "Sudoku" "\0" 99 | VALUE "ProductVersion", VERSION_AS_STRING "\0" 100 | END 101 | END 102 | BLOCK "VarFileInfo" 103 | BEGIN 104 | VALUE "Translation", 0x409, 1252 105 | END 106 | END 107 | 108 | #endif // English (United States) resources 109 | ///////////////////////////////////////////////////////////////////////////// 110 | 111 | 112 | 113 | #ifndef APSTUDIO_INVOKED 114 | ///////////////////////////////////////////////////////////////////////////// 115 | // 116 | // Generated from the TEXTINCLUDE 3 resource. 117 | // 118 | 119 | 120 | ///////////////////////////////////////////////////////////////////////////// 121 | #endif // not APSTUDIO_INVOKED 122 | -------------------------------------------------------------------------------- /sudoku/windows/runner/flutter_window.cpp: -------------------------------------------------------------------------------- 1 | #include "flutter_window.h" 2 | 3 | #include 4 | 5 | #include "flutter/generated_plugin_registrant.h" 6 | 7 | FlutterWindow::FlutterWindow(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /sudoku/windows/runner/flutter_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_FLUTTER_WINDOW_H_ 2 | #define RUNNER_FLUTTER_WINDOW_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include 8 | 9 | #include "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /sudoku/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | #include 9 | auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME); 10 | 11 | 12 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 13 | _In_ wchar_t *command_line, _In_ int show_command) { 14 | // Attach to console when present (e.g., 'flutter run') or create a 15 | // new console when running with a debugger. 16 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 17 | CreateAndAttachConsole(); 18 | } 19 | 20 | // Initialize COM, so that it is available for use in the library and/or 21 | // plugins. 22 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 23 | 24 | flutter::DartProject project(L"data"); 25 | 26 | std::vector command_line_arguments = 27 | GetCommandLineArguments(); 28 | 29 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 30 | 31 | FlutterWindow window(project); 32 | Win32Window::Point origin(10, 10); 33 | Win32Window::Size size(700, 700); 34 | if (!window.CreateAndShow(L"Sudoku", origin, size)) { 35 | return EXIT_FAILURE; 36 | } 37 | window.SetQuitOnClose(true); 38 | 39 | ::MSG msg; 40 | while (::GetMessage(&msg, nullptr, 0, 0)) { 41 | ::TranslateMessage(&msg); 42 | ::DispatchMessage(&msg); 43 | } 44 | 45 | ::CoUninitialize(); 46 | return EXIT_SUCCESS; 47 | } 48 | -------------------------------------------------------------------------------- /sudoku/windows/runner/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by Runner.rc 4 | // 5 | #define IDI_APP_ICON 101 6 | 7 | // Next default values for new objects 8 | // 9 | #ifdef APSTUDIO_INVOKED 10 | #ifndef APSTUDIO_READONLY_SYMBOLS 11 | #define _APS_NEXT_RESOURCE_VALUE 102 12 | #define _APS_NEXT_COMMAND_VALUE 40001 13 | #define _APS_NEXT_CONTROL_VALUE 1001 14 | #define _APS_NEXT_SYMED_VALUE 101 15 | #endif 16 | #endif 17 | -------------------------------------------------------------------------------- /sudoku/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/VarunS2002/Flutter-Sudoku/9e5a98e0a7a7c428e0a4d527d9c33ce0b7957e37/sudoku/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /sudoku/windows/runner/runner.exe.manifest: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PerMonitorV2 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /sudoku/windows/runner/utils.cpp: -------------------------------------------------------------------------------- 1 | #include "utils.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | 10 | void CreateAndAttachConsole() { 11 | if (::AllocConsole()) { 12 | FILE *unused; 13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) { 14 | _dup2(_fileno(stdout), 1); 15 | } 16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) { 17 | _dup2(_fileno(stdout), 2); 18 | } 19 | std::ios::sync_with_stdio(); 20 | FlutterDesktopResyncOutputStreams(); 21 | } 22 | } 23 | 24 | std::vector GetCommandLineArguments() { 25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use. 26 | int argc; 27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc); 28 | if (argv == nullptr) { 29 | return std::vector(); 30 | } 31 | 32 | std::vector command_line_arguments; 33 | 34 | // Skip the first argument as it's the binary name. 35 | for (int i = 1; i < argc; i++) { 36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i])); 37 | } 38 | 39 | ::LocalFree(argv); 40 | 41 | return command_line_arguments; 42 | } 43 | 44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) { 45 | if (utf16_string == nullptr) { 46 | return std::string(); 47 | } 48 | int target_length = ::WideCharToMultiByte( 49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 50 | -1, nullptr, 0, nullptr, nullptr); 51 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 55 | utf8_string.resize(target_length); 56 | int converted_length = ::WideCharToMultiByte( 57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string, 58 | -1, utf8_string.data(), 59 | target_length, nullptr, nullptr); 60 | if (converted_length == 0) { 61 | return std::string(); 62 | } 63 | return utf8_string; 64 | } 65 | -------------------------------------------------------------------------------- /sudoku/windows/runner/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_UTILS_H_ 2 | #define RUNNER_UTILS_H_ 3 | 4 | #include 5 | #include 6 | 7 | // Creates a console for the process, and redirects stdout and stderr to 8 | // it for both the runner and the Flutter library. 9 | void CreateAndAttachConsole(); 10 | 11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string 12 | // encoded in UTF-8. Returns an empty std::string on failure. 13 | std::string Utf8FromUtf16(const wchar_t* utf16_string); 14 | 15 | // Gets the command line arguments passed in as a std::vector, 16 | // encoded in UTF-8. Returns an empty std::vector on failure. 17 | std::vector GetCommandLineArguments(); 18 | 19 | #endif // RUNNER_UTILS_H_ 20 | -------------------------------------------------------------------------------- /sudoku/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /sudoku/windows/runner/win32_window.h: -------------------------------------------------------------------------------- 1 | #ifndef RUNNER_WIN32_WINDOW_H_ 2 | #define RUNNER_WIN32_WINDOW_H_ 3 | 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be 11 | // inherited from by classes that wish to specialize with custom 12 | // rendering and input handling 13 | class Win32Window { 14 | public: 15 | struct Point { 16 | unsigned int x; 17 | unsigned int y; 18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {} 19 | }; 20 | 21 | struct Size { 22 | unsigned int width; 23 | unsigned int height; 24 | Size(unsigned int width, unsigned int height) 25 | : width(width), height(height) {} 26 | }; 27 | 28 | Win32Window(); 29 | virtual ~Win32Window(); 30 | 31 | // Creates and shows a win32 window with |title| and position and size using 32 | // |origin| and |size|. New windows are created on the default monitor. Window 33 | // sizes are specified to the OS in physical pixels, hence to ensure a 34 | // consistent size to will treat the width height passed in to this function 35 | // as logical pixels and scale to appropriate for the default monitor. Returns 36 | // true if the window was created successfully. 37 | bool CreateAndShow(const std::wstring& title, 38 | const Point& origin, 39 | const Size& size); 40 | 41 | // Release OS resources associated with window. 42 | void Destroy(); 43 | 44 | // Inserts |content| into the window tree. 45 | void SetChildContent(HWND content); 46 | 47 | // Returns the backing Window handle to enable clients to set icon and other 48 | // window properties. Returns nullptr if the window has been destroyed. 49 | HWND GetHandle(); 50 | 51 | // If true, closing this window will quit the application. 52 | void SetQuitOnClose(bool quit_on_close); 53 | 54 | // Return a RECT representing the bounds of the current client area. 55 | RECT GetClientArea(); 56 | 57 | protected: 58 | // Processes and route salient window messages for mouse handling, 59 | // size change and DPI. Delegates handling of these to member overloads that 60 | // inheriting classes can handle. 61 | virtual LRESULT MessageHandler(HWND window, 62 | UINT const message, 63 | WPARAM const wparam, 64 | LPARAM const lparam) noexcept; 65 | 66 | // Called when CreateAndShow is called, allowing subclass window-related 67 | // setup. Subclasses should return false if setup fails. 68 | virtual bool OnCreate(); 69 | 70 | // Called when Destroy is called. 71 | virtual void OnDestroy(); 72 | 73 | private: 74 | friend class WindowClassRegistrar; 75 | 76 | // OS callback called by message pump. Handles the WM_NCCREATE message which 77 | // is passed when the non-client area is being created and enables automatic 78 | // non-client DPI scaling so that the non-client area automatically 79 | // responsponds to changes in DPI. All other messages are handled by 80 | // MessageHandler. 81 | static LRESULT CALLBACK WndProc(HWND const window, 82 | UINT const message, 83 | WPARAM const wparam, 84 | LPARAM const lparam) noexcept; 85 | 86 | // Retrieves a class instance pointer for |window| 87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept; 88 | 89 | bool quit_on_close_ = false; 90 | 91 | // window handle for top level window. 92 | HWND window_handle_ = nullptr; 93 | 94 | // window handle for hosted content. 95 | HWND child_content_ = nullptr; 96 | }; 97 | 98 | #endif // RUNNER_WIN32_WINDOW_H_ 99 | --------------------------------------------------------------------------------