{"id":19376306,"url":"https://github.com/cobinja/cobi-flutter-settings","last_synced_at":"2025-10-28T02:40:49.107Z","repository":{"id":56827106,"uuid":"374314044","full_name":"Cobinja/cobi-flutter-settings","owner":"Cobinja","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-15T11:00:50.000Z","size":112,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-07T04:43:40.181Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Cobinja.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}},"created_at":"2021-06-06T09:03:19.000Z","updated_at":"2024-03-30T16:37:41.000Z","dependencies_parsed_at":"2024-11-10T08:43:52.972Z","dependency_job_id":"22fe6ac7-fea9-4122-9408-38ca55eb4fc2","html_url":"https://github.com/Cobinja/cobi-flutter-settings","commit_stats":{"total_commits":17,"total_committers":1,"mean_commits":17.0,"dds":0.0,"last_synced_commit":"7c116688821ad45661411de8801aa0f99b51ae4e"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobinja%2Fcobi-flutter-settings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobinja%2Fcobi-flutter-settings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobinja%2Fcobi-flutter-settings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cobinja%2Fcobi-flutter-settings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cobinja","download_url":"https://codeload.github.com/Cobinja/cobi-flutter-settings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240507890,"owners_count":19812873,"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-11-10T08:43:25.635Z","updated_at":"2025-10-28T02:40:49.057Z","avatar_url":"https://github.com/Cobinja.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cobi_flutter_settings\nAn application settings screen that persists values via the [shared_preferences](https://pub.dev/packages/shared_preferences) package.\nThis is a material-only version of [cobi_flutter_platform_settings](https://pub.dev/packages/cobi_flutter_platform_settings)\n## Getting Started\nAll widgets come with a property 'settingsKey' which is used to store them in shared_preferences, so you can retrieve the value from anywhere using the same key. The only exceptions from this are SettingsScreen, SettingsGroup and CustomSetting (which is intended to launch navigation routes or to just show some information).\n\n## Widgets\n### SettingsScreen\nThe uppermost settings container. Use this as a starting point.\n```dart\nSettingsScreen (\n  title: 'App Settings',\n  children: [],\n)\n```\n### SettingsGroup\nA container that groups various settings together\n```dart\nSettingsGroup (\n  title: 'First Group',\n  children: [],\n)\n```\n### CustomSetting\nA settings widget that takes an onPressed action, useful e.g. to launch navigation routes.\n```dart\nCustomSetting (\n  title: 'My Custom Setting',\n  subtitle: 'My subtitle',\n  onPressed: () =\u003e debugPrint('hello world!'),\n)\n```\n### TextSetting\nA widget that shows a textfield\n```dart\nTextSetting\u003cint\u003e(\n  settingsKey: 'text-setting',\n  title: 'A text setting for integers only',\n  keyboardType: TextInputType.number,\n  defaultValue: 42000,\n  validator: (value) {\n    if (value == null || value \u003c 1024 || value \u003e 65536) {\n      return 'Integer number between 1024 and 65536 expected';\n    }\n  },\n),\n```\n### ImageSetting\nA widget with an image picker that stores the filename as a string\n```dart\nImageSetting(\n  settingsKey: 'image-setting',\n  title: 'This is an image setting'\n),\n```\n### SwitchSetting\nA widget with a two-state switch\n```dart\nSwitchSetting(\n  settingsKey: 'switch-setting',\n  title: 'This is a switch setting',\n  defaultValue: true,\n)\n```\n### CheckboxSetting\nA widget with a checkbox\n```dart\nCheckboxSetting(\n  settingsKey: 'checkbox-setting',\n  title: 'This is a checkbox setting',\n  defaultValue: false,\n),\n```\n### RadioSetting\nThis shows a list of radio buttons\n```dart\nRadioSetting\u003cint\u003e(\n  settingsKey:  'radio-setting',\n  title:  'This is a radio setting',\n  items: [\n    ListItem\u003cint\u003e(value: 1, caption: 'One'),\n    ListItem\u003cint\u003e(value: 2, caption: 'Two'),\n    ListItem\u003cint\u003e(value: 3, caption: 'Three'),\n    ListItem\u003cint\u003e(value: 4, caption: 'Four'),\n    ListItem\u003cint\u003e(value: 5, caption: 'Five'),\n  ],\n),\n```\n### RadioModalSetting\nThe radio buttons in this one are shown in a dialog\n```dart\nRadioModalSetting\u003cint\u003e(\n  settingsKey: 'radio-modal-setting',\n  title: 'This is a modal radio setting',\n  defaultValue: 5,\n  items: [\n    ListItem\u003cint\u003e(value: 1, caption: 'One'),\n    ListItem\u003cint\u003e(value: 2, caption: 'Two'),\n    ListItem\u003cint\u003e(value: 3, caption: 'Three'),\n    ListItem\u003cint\u003e(value: 4, caption: 'Four'),\n    ListItem\u003cint\u003e(value: 5, caption: 'Five'),\n    ListItem\u003cint\u003e(value: 6, caption: 'Six'),\n  ],\n),\n```\n### SliderSetting\nYou guessed right, a widget with a slider\n```dart\nSliderSetting(\n  settingsKey: 'slider-setting',\n  title: 'This is a slider setting',\n  minValue: 0.0,\n  maxValue: 100.0,\n  divisions: 100,\n  defaultValue: 25.0,\n),\n```\n### MultiSelectSetting\nA setting that shows a multi-selection list\n```dart\nMultiSelectSetting\u003cString\u003e(\n  settingsKey: 'multi-select-setting',\n  title: \"A multi-select setting\",\n  items: [\n    ListItem(value: \"hello\", caption: \"Hello\"),\n    ListItem(value: \"world\", caption: \"World\"),\n    ListItem(value: \"foo\", caption: \"foo\"),\n    ListItem(value: \"bar\", caption: \"bar\"),\n  ]\n),\n```\n#### You can find more example use cases in the included example app.\n## Extensibility\nYou can define your own widgets by subclassing ``SettingsWidgetBase\u003cT\u003e`` and ``SettingsWidgetBaseState\u003cT, YourSettingsWidgetClass\u003e`` with ``T`` being the type stored via shared_preferences.\n\nIf you need a data type *not* supplied by shared_preferences, you can override ``SettingsWidgetBaseState::serialize()`` and ``SettingsWidgetBaseState::deserialize()`` and do the serialization yourself.\n#### Note: Serialization and deserialization behave different since version 2.0.0. See the included example\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcobinja%2Fcobi-flutter-settings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcobinja%2Fcobi-flutter-settings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcobinja%2Fcobi-flutter-settings/lists"}