{"id":32301503,"url":"https://github.com/davidanaya/flutter-circular-slider","last_synced_at":"2026-02-20T22:02:02.195Z","repository":{"id":52230406,"uuid":"179983217","full_name":"davidanaya/flutter-circular-slider","owner":"davidanaya","description":"A customizable circular slider for Flutter.","archived":false,"fork":false,"pushed_at":"2023-01-13T02:47:09.000Z","size":2055,"stargazers_count":203,"open_issues_count":22,"forks_count":70,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-10-23T05:46:39.959Z","etag":null,"topics":["flutter","flutter-widget","slider"],"latest_commit_sha":null,"homepage":"https://pub.dartlang.org/packages/flutter_circular_slider","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/davidanaya.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":"2019-04-07T15:11:34.000Z","updated_at":"2024-08-20T03:06:39.000Z","dependencies_parsed_at":"2023-02-09T14:16:07.337Z","dependency_job_id":null,"html_url":"https://github.com/davidanaya/flutter-circular-slider","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/davidanaya/flutter-circular-slider","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidanaya%2Fflutter-circular-slider","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidanaya%2Fflutter-circular-slider/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidanaya%2Fflutter-circular-slider/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidanaya%2Fflutter-circular-slider/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davidanaya","download_url":"https://codeload.github.com/davidanaya/flutter-circular-slider/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davidanaya%2Fflutter-circular-slider/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29666426,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T19:49:36.704Z","status":"ssl_error","status_checked_at":"2026-02-20T19:44:05.372Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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","slider"],"created_at":"2025-10-23T05:41:45.331Z","updated_at":"2026-02-20T22:02:02.176Z","avatar_url":"https://github.com/davidanaya.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_circular_slider\n\n[![Build Status](https://travis-ci.com/davidanaya/flutter-circular-slider.svg?branch=master)](https://travis-ci.com/davidanaya/flutter-circular-slider) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) [![Pub](https://img.shields.io/pub/v/flutter_circular_slider.svg)](https://pub.dartlang.org/packages/flutter_circular_slider)\n\nA customizable circular slider for Flutter.\n\n## Getting Started\n\n- [Installation](#installation)\n- [Basic Usage](#basic-usage)\n- [Constructor](#constructor)\n- [Use Cases](#use-cases)\n\n### Installation\n\nAdd\n\n```bash\n\nflutter_circular_slider : ^lastest_version\n\n```\n\nto your pubspec.yaml, and run\n\n```bash\nflutter packages get\n```\n\nin your project's root directory.\n\n### Basic Usage\n\nCreate a new project with command\n\n```\nflutter create myapp\n```\n\nEdit lib/main.dart like this:\n\n```dart\nimport 'package:flutter/material.dart';\n\nimport 'package:flutter_circular_slider/flutter_circular_slider.dart';\n\nvoid main() =\u003e runApp(MyApp());\n\nclass MyApp extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      theme: ThemeData(\n        primarySwatch: Colors.blue,\n      ),\n      home: MyHomePage(),\n    );\n  }\n}\n\nclass MyHomePage extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n        backgroundColor: Colors.blueGrey,\n        body: Center(\n          child: Container(child: DoubleCircularSlider(100, 0, 20)),\n        ));\n  }\n}\n```\n\nThere are two different options:\n\n- SingleCircularSlider: has only one handler and can be moved either dragging the handler or just by clicking on different parts of the slider.\n- DoubleCircularSlider: has two handlers and both have to be moved by dragging them.\n\n![Basic Slider](./doc/basic-slider.gif)\n\n### Constructor\n\n| Parameter                 |                       Default                       | Description                                                                                                             |\n| :------------------------ | :-------------------------------------------------: | :---------------------------------------------------------------------------------------------------------------------- |\n| divisions                 |                                                     | The number of sections in which the circle will be divided for selection.                                               |\n| init                      |                                                     | (Only for DoubleCircularSlider) The initial value in the selection. Has to be bigger than 0 and smaller than divisions. |\n| end                       |                                                     | (Only for DoubleCircularSlider) The end value in the selection. Has to be bigger than 0 and smaller than divisions.     |\n| position                  |                                                     | (Only for SingleCircularSlider) The selection. Has to be bigger than 0 and smaller than divisions.                      |\n| height                    |                        220.0                        | Height of the canvas where the slider is rendered.                                                                      |\n| width                     |                        220.0                        | Width of the canvas where the slider is rendered.                                                                       |\n| primarySectors            |                          0                          | Number of sectors painted in the base circle. Painted in selectionColor.                                                |\n| secondarySectors          |                          0                          | Number of secondary sectors painted in the base circle. Painted in baseColor.                                           |\n| child                     |                        null                         | Widget that will be inserted in the center of the circular slider.                                                      |\n| onSelectionChange         | void onSelectionChange(int init, int end, int laps) | Triggered every time the user interacts with the slider and changes the init and end values, and also laps.             |\n| onSelectionEnd            |  void onSelectionEnd(int init, int end, int laps)   | Triggered every time the user finish one interaction with the slider.                                                   |\n| baseColor                 |         Color.fromRGBO(255, 255, 255, 0.1)          | The color used for the base of the circle.                                                                              |\n| selectionColor            |         Color.fromRGBO(255, 255, 255, 0.3)          | The color used for the selection in the circle.                                                                         |\n| handlerColor              |                    Colors.white                     | The color used for the handlers.                                                                                        |\n| handlerOutterRadius       |                        12.0                         | The radius for the outter circle around the handler.                                                                    |\n| showRoundedCapInSelection |                        false                        | (Only for SingleCircularSlider) Shows a rounded cap at the edge of the selection slider with no handler.                |\n| showHandlerOutter         |                        true                         | If true will display an extra ring around the handlers.                                                                 |\n| sliderStrokeWidth         |                        12.0                         | The stroke width for the slider (thickness).                                                                            |\n| shouldCountLaps           |                        false                        | If true, onSelectionChange will also return the updated number of laps.                                                 |\n\n### Use Cases\n\n#### Move complete selection\n\n![Move Selection](./doc/move-selection.gif)\n\n#### Single Handler\n\n![Sleep Single Slider](./doc/single-slider.gif)\n\n#### Laps\n\n![Sleep Single Slider Laps](./doc/single-slider-laps.gif)\n\n![Sleep Double Slider Laps](./doc/double-slider-laps.gif)\n\n#### Sleep Time Selection\n\n```dart\nimport 'dart:math';\n\nimport 'package:flutter/material.dart';\n\nimport 'package:flutter_circular_slider/flutter_circular_slider.dart';\n\nvoid main() =\u003e runApp(MyApp());\n\nclass MyApp extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return MaterialApp(\n      theme: ThemeData(\n        primarySwatch: Colors.blue,\n      ),\n      home: MyHomePage(),\n    );\n  }\n}\n\nclass MyHomePage extends StatelessWidget {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n        body: SafeArea(\n      child: Container(\n          decoration: BoxDecoration(\n            image: DecorationImage(\n              image: AssetImage('images/background_morning.png'),\n              fit: BoxFit.cover,\n            ),\n          ),\n          child: SleepPage()),\n    ));\n  }\n}\n\nclass SleepPage extends StatefulWidget {\n  @override\n  _SleepPageState createState() =\u003e _SleepPageState();\n}\n\nclass _SleepPageState extends State\u003cSleepPage\u003e {\n  final baseColor = Color.fromRGBO(255, 255, 255, 0.3);\n\n  int initTime;\n  int endTime;\n\n  int inBedTime;\n  int outBedTime;\n\n  @override\n  void initState() {\n    super.initState();\n    _shuffle();\n  }\n\n  void _shuffle() {\n    setState(() {\n      initTime = _generateRandomTime();\n      endTime = _generateRandomTime();\n      inBedTime = initTime;\n      outBedTime = endTime;\n    });\n  }\n\n  void _updateLabels(int init, int end) {\n    setState(() {\n      inBedTime = init;\n      outBedTime = end;\n    });\n  }\n\n  @override\n  Widget build(BuildContext context) {\n    return Column(\n      mainAxisAlignment: MainAxisAlignment.spaceEvenly,\n      children: [\n        Text(\n          'How long did you stay in bed?',\n          style: TextStyle(color: Colors.white),\n        ),\n        DoubleCircularSlider(\n          288,\n          initTime,\n          endTime,\n          height: 260.0,\n          width: 260.0,\n          primarySectors: 6,\n          secondarySectors: 24,\n          baseColor: Color.fromRGBO(255, 255, 255, 0.1),\n          selectionColor: baseColor,\n          handlerColor: Colors.white,\n          handlerOutterRadius: 12.0,\n          onSelectionChange: _updateLabels,\n          sliderStrokeWidth: 12.0,\n          child: Padding(\n            padding: const EdgeInsets.all(42.0),\n            child: Center(\n                child: Text('${_formatIntervalTime(inBedTime, outBedTime)}',\n                    style: TextStyle(fontSize: 36.0, color: Colors.white))),\n          ),\n        ),\n        Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [\n          _formatBedTime('IN THE', inBedTime),\n          _formatBedTime('OUT OF', outBedTime),\n        ]),\n        FlatButton(\n          child: Text('S H U F F L E'),\n          color: baseColor,\n          textColor: Colors.white,\n          shape: RoundedRectangleBorder(\n            borderRadius: BorderRadius.circular(50.0),\n          ),\n          onPressed: _shuffle,\n        ),\n      ],\n    );\n  }\n\n  Widget _formatBedTime(String pre, int time) {\n    return Column(\n      children: [\n        Text(pre, style: TextStyle(color: baseColor)),\n        Text('BED AT', style: TextStyle(color: baseColor)),\n        Text(\n          '${_formatTime(time)}',\n          style: TextStyle(color: Colors.white),\n        )\n      ],\n    );\n  }\n\n  String _formatTime(int time) {\n    if (time == 0 || time == null) {\n      return '00:00';\n    }\n    var hours = time ~/ 12;\n    var minutes = (time % 12) * 5;\n    return '$hours:$minutes';\n  }\n\n  String _formatIntervalTime(int init, int end) {\n    var sleepTime = end \u003e init ? end - init : 288 - init + end;\n    var hours = sleepTime ~/ 12;\n    var minutes = (sleepTime % 12) * 5;\n    return '${hours}h${minutes}m';\n  }\n\n  int _generateRandomTime() =\u003e Random().nextInt(288);\n}\n```\n\n![Sleep Slider](./doc/sleep-slider.gif)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidanaya%2Fflutter-circular-slider","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavidanaya%2Fflutter-circular-slider","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavidanaya%2Fflutter-circular-slider/lists"}