{"id":22945422,"url":"https://github.com/ankit-slnk/flutter-dark-theme-demo","last_synced_at":"2026-04-11T12:02:37.351Z","repository":{"id":226941640,"uuid":"292711655","full_name":"Ankit-Slnk/flutter-dark-theme-demo","owner":"Ankit-Slnk","description":"Flutter Dark Theme Demo","archived":false,"fork":false,"pushed_at":"2022-02-23T17:21:33.000Z","size":2518,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-01T21:50:40.365Z","etag":null,"topics":["android","dark-theme","dart","demo","flutter","ios","java","swift","web"],"latest_commit_sha":null,"homepage":"https://ankitsolanki.dev","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ankit-Slnk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-09-04T00:44:02.000Z","updated_at":"2022-03-29T16:34:10.000Z","dependencies_parsed_at":"2024-03-10T18:45:25.480Z","dependency_job_id":null,"html_url":"https://github.com/Ankit-Slnk/flutter-dark-theme-demo","commit_stats":null,"previous_names":["ankit-slnk/flutter-dark-theme-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Ankit-Slnk/flutter-dark-theme-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-dark-theme-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-dark-theme-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-dark-theme-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-dark-theme-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ankit-Slnk","download_url":"https://codeload.github.com/Ankit-Slnk/flutter-dark-theme-demo/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ankit-Slnk%2Fflutter-dark-theme-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279104149,"owners_count":26104450,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-15T02:00:07.814Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","dark-theme","dart","demo","flutter","ios","java","swift","web"],"created_at":"2024-12-14T14:32:27.139Z","updated_at":"2025-10-15T19:08:21.480Z","avatar_url":"https://github.com/Ankit-Slnk.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flutter Dark Theme Demo\n\n![Flutter Dark Theme Demo](flutter-dark-theme.png)\n\nThis demo will show us how to implement dark theme in flutter projects.\n\n![Flutter Dark Theme Demo](flutter_dark_theme.gif)\n\n## Setup\n\nUse latest versions of below mentioned plugins in `pubspec.yaml`.\n\n| Plugin | Pub | Explanation |\n|--------|-----|-------------|\n| [shared_preferences](https://github.com/flutter/plugins) | [![pub package](https://img.shields.io/pub/v/shared_preferences.svg)](https://pub.dev/packages/shared_preferences) | Used to store data locally in key-value pairs.\n| [provider](https://github.com/PonnamKarthik/provider) | [![pub package](https://img.shields.io/pub/v/provider.svg)](https://pub.dev/packages/provider) | A wrapper around InheritedWidget to make them easier to use and more reusable.\n\nAnd then\n\n    flutter pub get\n    \n### DarkThemePreference\n\nThis will save current selected theme locally.\n\n    class DarkThemePreference {\n        static const THEME_STATUS = \"THEMESTATUS\";\n\n        setDarkTheme(bool value) async {\n            SharedPreferences prefs = await SharedPreferences.getInstance();\n            prefs.setBool(THEME_STATUS, value);\n        }\n\n        Future\u003cbool\u003e getTheme() async {\n            SharedPreferences prefs = await SharedPreferences.getInstance();\n            return prefs.getBool(THEME_STATUS) ?? false;\n        }\n    }\n\n### DarkThemeProvider\n\nThis changenotifier will help us to check whether current theme is dark or not.\n\n    class DarkThemeProvider with ChangeNotifier {\n        DarkThemePreference darkThemePreference = DarkThemePreference();\n        bool _darkTheme = false;\n\n        bool get darkTheme =\u003e _darkTheme;\n\n        set darkTheme(bool value) {\n            _darkTheme = value;\n            darkThemePreference.setDarkTheme(value);\n            notifyListeners();\n        }\n    }\n\n### DarkThemeStyle\n\nWe need to define what colors to use when having dark and light theme.\n\n### Check Dark Theme\n\n    Provider.of\u003cDarkThemeProvider\u003e(context).darkTheme\n\nFinally\n\n    flutter run\n\n\u003c!-- ##### Please refer to my [blogs](https://ankitsolanki.netlify.app/blog.html) for more information. --\u003e\n\nCheckout [this demo](https://flutter-web-dark-theme.netlify.app/#/) in [Flutter Web](https://flutter.dev/docs/get-started/web).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankit-slnk%2Fflutter-dark-theme-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fankit-slnk%2Fflutter-dark-theme-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fankit-slnk%2Fflutter-dark-theme-demo/lists"}