{"id":30532701,"url":"https://github.com/esentis/load_switch","last_synced_at":"2025-08-27T10:27:23.786Z","repository":{"id":42074734,"uuid":"481256474","full_name":"esentis/load_switch","owner":"esentis","description":"A highly customizable toggle switch with a loading state.","archived":false,"fork":false,"pushed_at":"2025-07-08T17:10:41.000Z","size":795,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-08-20T05:05:35.235Z","etag":null,"topics":["flutter","flutter-widget","loading-switch","switch","toggle-switch"],"latest_commit_sha":null,"homepage":"https://pub.dev/packages/load_switch","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/esentis.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-04-13T14:46:01.000Z","updated_at":"2025-07-09T07:45:58.000Z","dependencies_parsed_at":"2023-02-12T13:17:34.959Z","dependency_job_id":"459da89b-8975-4417-bac1-2f388e681aa7","html_url":"https://github.com/esentis/load_switch","commit_stats":{"total_commits":24,"total_committers":2,"mean_commits":12.0,"dds":0.125,"last_synced_commit":"755cf5efc1a1637d613d1c6494fb4523dd9140cc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/esentis/load_switch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esentis%2Fload_switch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esentis%2Fload_switch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esentis%2Fload_switch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esentis%2Fload_switch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/esentis","download_url":"https://codeload.github.com/esentis/load_switch/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/esentis%2Fload_switch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272319329,"owners_count":24913230,"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-08-27T02:00:09.397Z","response_time":76,"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":["flutter","flutter-widget","loading-switch","switch","toggle-switch"],"created_at":"2025-08-27T10:27:14.996Z","updated_at":"2025-08-27T10:27:23.771Z","avatar_url":"https://github.com/esentis.png","language":"Dart","readme":"\u003cp align=\"center\"\u003e\n\u003cimg src='https://i.imgur.com/i3rb7YT.gif'\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n \u003cimg src=\"https://img.shields.io/pub/v/load_switch?color=637d0d\u0026style=for-the-badge\u0026logo=flutter\" alt=\"Version\" /\u003e \u003cimg src=\"https://img.shields.io/github/languages/code-size/esentis/load_switch?color=637d0d\u0026style=for-the-badge\u0026label=size\" alt=\"Version\" /\u003e\u003c/br\u003e\u003cimg src=\"https://github.com/esentis/load_switch/actions/workflows/publish.yml/badge.svg\" alt=\"Publish to Pub.dev\" /\u003e\n\u003c/br\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nShow some love by dropping a ⭐ at GitHub \u003c/br\u003e\n\u003ca href=\"https://github.com/esentis/load_switch/stargazers\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/esentis/load_switch?style=for-the-badge\u0026logo=github\u0026color=637d0d\" alt=\"HTML tutorial\"\u003e\u003c/a\u003e\n\n```dart\nbool value = false;\n\nFuture\u003cbool\u003e _getFuture() async {\n    await Future.delayed(const Duration(seconds: 2));\n    return !value;\n}\n```\n\n### Default\n\n\u003cimg src=\"https://i.imgur.com/pD84Oea.gif\" alt=\"Version\" /\u003e\n\n```dart\nLoadSwitch(\n    value: value,\n    future: _getFuture,\n    style: SpinStyle.material\n    onChange: (v) {\n        value = v;\n        print('Value changed to $v');\n        setState(() {});\n    },\n    onTap: (v) {\n        print('Tapping while value is $v');\n    },\n)\n```\n\n### Custom\n\n\u003cimg src=\"https://i.imgur.com/sSecDrP.gif\" alt=\"Version\" /\u003e\n\n```dart\nLoadSwitch(\nvalue: value,\nfuture: _getFuture,\nstyle: SpinStyle.material\ncurveIn: Curves.easeInBack,\ncurveOut: Curves.easeOutBack,\nanimationDuration: const Duration(milliseconds: 500),\nswitchDecoration: (value) =\u003e BoxDecoration(\n    color: value ? Colors.green[100] : Colors.red[100],\n    borderRadius: BorderRadius.circular(30),\n    shape: BoxShape.rectangle,\n    boxShadow: [\n    BoxShadow(\n        color: value\n            ? Colors.green.withOpacity(0.2)\n            : Colors.red.withOpacity(0.2),\n        spreadRadius: 5,\n        blurRadius: 7,\n        offset: const Offset(0, 3), // changes position of shadow\n    ),\n    ],\n),\nspinColor: (value) =\u003e value\n    ? const Color.fromARGB(255, 41, 232, 31)\n    : const Color.fromARGB(255, 255, 77, 77),\nspinStrokeWidth: 3,\nthumbDecoration: (value) =\u003e BoxDecoration(\n    color: Colors.white,\n    borderRadius: BorderRadius.circular(30),\n    shape: BoxShape.rectangle,\n    boxShadow: [\n    BoxShadow(\n        color: value\n            ? Colors.green.withOpacity(0.2)\n            : Colors.red.withOpacity(0.2),\n        spreadRadius: 5,\n        blurRadius: 7,\n        offset: const Offset(0, 3), // changes position of shadow\n    ),\n    ],\n),\nonChange: (v) {\n    value = v;\n    print('Value changed to $v');\n    setState(() {});\n},\nonTap: (v) {\n    print('Tapping while value is $v');\n},\n),\n```\n\n### Controller Features\n\nYou can use the `LoadSwitchController` to control and listen to the switch's state.\n\n| Feature                      | Description                                                    |\n| ---------------------------- | -------------------------------------------------------------- |\n| `toggle()`                   | Toggle the switch value programmatically                       |\n| `executeWithLoading(future)` | Run an async operation with automatic loading state management |\n| `value` (get/set)            | Get or set the current switch value                            |\n| `isLoading` (get/set)        | Get or set the loading state                                   |\n| `isActive` (get/set)         | Get or set whether the switch is active                        |\n| `addListener(listener)`      | Listen to state changes in the controller                      |\n| `dispose()`                  | Clean up resources when no longer needed                       |\n\n## Spin styles\n\nThe library extends [flutter_spinkit](https://pub.dev/packages/flutter_spinkit) internally adding some fancy spin animations. Keep in mind you can also edit the `thumbDecoration` \u0026 `switchDecoration` for different color \u0026 shapes. The examples have the default circular thumb with white color. The default style is `SpinStyle.material`.\n\n| material                                                | cupertino                                                 | chasingDots                                                   |\n| ------------------------------------------------------- | --------------------------------------------------------- | ------------------------------------------------------------- |\n| ![material](https://i.imgur.com/i80tb2n.gif \"material\") | ![cupertino](https://i.imgur.com/ciOjjIx.gif \"cupertino\") | ![chasingDots](https://i.imgur.com/VnVZ7yW.gif \"chasingDots\") |\n\n| circle                                              | cubeGrid                                                | dancingSquare                                                     |\n| --------------------------------------------------- | ------------------------------------------------------- | ----------------------------------------------------------------- |\n| ![circle](https://i.imgur.com/ePBR9xB.gif \"circle\") | ![cubeGrid](https://i.imgur.com/HhoyjuA.gif \"cubeGrid\") | ![dancingSquare](https://i.imgur.com/huQGF7f.gif \"dancingSquare\") |\n\n| doubleBounce                                                    | dualRing                                                | fadingCircle                                                    |\n| --------------------------------------------------------------- | ------------------------------------------------------- | --------------------------------------------------------------- |\n| ![doubleBounce](https://i.imgur.com/XoNKCUb.gif \"doubleBounce\") | ![dualRing](https://i.imgur.com/YODTtaw.gif \"dualRing\") | ![fadingCircle](https://i.imgur.com/xMFMI6F.gif \"fadingCircle\") |\n\n| fadingCube                                                  | fadingFour                                                  | fadingGrid                                                  |\n| ----------------------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------- |\n| ![fadingCube](https://i.imgur.com/s6jqcBy.gif \"fadingCube\") | ![fadingFour](https://i.imgur.com/1gL9G70.gif \"fadingFour\") | ![fadingGrid](https://i.imgur.com/HLHTVRw.gif \"fadingGrid\") |\n\n| foldingCube                                                   | hourGlass                                                 | pianoWave                                                 |\n| ------------------------------------------------------------- | --------------------------------------------------------- | --------------------------------------------------------- |\n| ![foldingCube](https://i.imgur.com/OfOx9Ta.gif \"foldingCube\") | ![hourGlass](https://i.imgur.com/XuOZMuo.gif \"hourGlass\") | ![pianoWave](https://i.imgur.com/4omcY6m.gif \"pianoWave\") |\n\n| pouringHourGlass                                                        | pulse                                             | pulsingGrid                                                   |\n| ----------------------------------------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------- |\n| ![pouringHourGlass](https://i.imgur.com/qaDYkEk.gif \"pouringHourGlass\") | ![pulse](https://i.imgur.com/XviSAH5.gif \"pulse\") | ![pulsingGrid](https://i.imgur.com/XkvLuSm.gif \"pulsingGrid\") |\n\n| pumpingHeart                                                    | ring                                            | ripple                                              |\n| --------------------------------------------------------------- | ----------------------------------------------- | --------------------------------------------------- |\n| ![pumpingHeart](https://i.imgur.com/J6jG4pT.gif \"pumpingHeart\") | ![ring](https://i.imgur.com/nDKRcu9.gif \"ring\") | ![ripple](https://i.imgur.com/Cdz31l9.gif \"ripple\") |\n\n| rotatingCircle                                                      | rotatingPlain                                                     | spinningCircle                                                      |\n| ------------------------------------------------------------------- | ----------------------------------------------------------------- | ------------------------------------------------------------------- |\n| ![rotatingCircle](https://i.imgur.com/HFmZVvd.gif \"rotatingCircle\") | ![rotatingPlain](https://i.imgur.com/ZRw7ZAk.gif \"rotatingPlain\") | ![spinningCircle](https://i.imgur.com/7EvBfP4.gif \"spinningCircle\") |\n\n| spinningLines                                                     | squareCircle                                                    | threeBounce                                                   |\n| ----------------------------------------------------------------- | --------------------------------------------------------------- | ------------------------------------------------------------- |\n| ![spinningLines](https://i.imgur.com/bZdiHNM.gif \"spinningLines\") | ![squareCircle](https://i.imgur.com/OBJsoEO.gif \"squareCircle\") | ![threeBounce](https://i.imgur.com/suMlo79.gif \"threeBounce\") |\n\n| threeInOut                                                  | wanderingCubes                                                      | waveStart                                                 |\n| ----------------------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------- |\n| ![threeInOut](https://i.imgur.com/Vz4QCWh.gif \"threeInOut\") | ![wanderingCubes](https://i.imgur.com/S7W2jHT.gif \"wanderingCubes\") | ![waveStart](https://i.imgur.com/Tnlsbdo.gif \"waveStart\") |\n\n| waveCenter                                                  | waveEnd                                               | waveSpinner                                                   |\n| ----------------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------- |\n| ![waveCenter](https://i.imgur.com/MX7SHbN.gif \"waveCenter\") | ![waveEnd](https://i.imgur.com/BMLUprM.gif \"waveEnd\") | ![waveSpinner](https://i.imgur.com/9geWUc6.gif \"waveSpinner\") |\n\n## Issues / Features\n\nFound a bug or want a new feature? Open an issue in the [Github repository](https://github.com/esentis/load_switch/issues/new/choose) of the project.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesentis%2Fload_switch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fesentis%2Fload_switch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fesentis%2Fload_switch/lists"}