{"id":18000762,"url":"https://github.com/norbert515/dynamic_theme","last_synced_at":"2025-04-04T19:14:47.634Z","repository":{"id":33929991,"uuid":"135584873","full_name":"Norbert515/dynamic_theme","owner":"Norbert515","description":"Dynamically changing your theme without hassle","archived":false,"fork":false,"pushed_at":"2021-12-20T10:11:54.000Z","size":194,"stargazers_count":322,"open_issues_count":31,"forks_count":67,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-28T18:17:35.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Norbert515.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-05-31T13:06:16.000Z","updated_at":"2024-05-11T15:22:00.000Z","dependencies_parsed_at":"2022-07-15T20:00:38.174Z","dependency_job_id":null,"html_url":"https://github.com/Norbert515/dynamic_theme","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Norbert515%2Fdynamic_theme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Norbert515%2Fdynamic_theme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Norbert515%2Fdynamic_theme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Norbert515%2Fdynamic_theme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Norbert515","download_url":"https://codeload.github.com/Norbert515/dynamic_theme/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247234923,"owners_count":20905854,"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","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":[],"created_at":"2024-10-29T23:13:56.880Z","updated_at":"2025-04-04T19:14:47.612Z","avatar_url":"https://github.com/Norbert515.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# dynamic_theme\n## Dynamically changing your theme without hassle\n\n![](https://github.com/Norbert515/dynamic_theme/blob/master/assets/theme.png)\n\nThis packages manages changing your theme during runtime and persiting that theme.\n\n### I wrote a medium post about this, check it out [here](https://proandroiddev.com/how-to-dynamically-change-the-theme-in-flutter-698bd022d0f0)!\n\n## Include in your project\n```\ndependencies:\n  dynamic_theme: ^1.0.1\n```\nrun packages get and import it\n```\nimport 'package:dynamic_theme/dynamic_theme.dart';\n```\nif you want the dialog:\n```\nimport 'package:dynamic_theme/theme_switcher_widgets.dart';\n```\n\n## Usage\nWrap your material app like this:\n```dart\n\nclass MyApp extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return new DynamicTheme(\n      defaultBrightness: Brightness.light,\n      data: (brightness) =\u003e new ThemeData(\n        primarySwatch: Colors.indigo,\n        brightness: brightness,\n      ),\n      themedWidgetBuilder: (context, theme) {\n        return new MaterialApp(\n          title: 'Flutter Demo',\n          theme: theme,\n          home: new MyHomePage(title: 'Flutter Demo Home Page'),\n        );\n      }\n    );\n  }\n}\n\n```\n\nChange the theme like this:\n```dart\n  void changeBrightness() {\n    DynamicTheme.of(context).setBrightness(Theme.of(context).brightness == Brightness.dark? Brightness.light: Brightness.dark);\n  }\n  \n  void changeColor() {\n    DynamicTheme.of(context).setThemeData(new ThemeData(\n        primaryColor: Theme.of(context).primaryColor == Colors.indigo? Colors.red: Colors.indigo\n    ));\n  }\n\n```\n\nWhen changing the brightness with `setBrightness`, it is additionally stored in the shared preferences.\n\n## Also included\n\n### A dialog widget to change the brightness!\n![](https://github.com/Norbert515/dynamic_theme/blob/master/assets/dialogs.png)\n\n## Getting Started\n\nFor help getting started with Flutter, view our online [documentation](https://flutter.io/).\n\nFor help on editing package code, view the [documentation](https://flutter.io/developing-packages/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnorbert515%2Fdynamic_theme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnorbert515%2Fdynamic_theme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnorbert515%2Fdynamic_theme/lists"}