{"id":22525314,"url":"https://github.com/plugfox/repaint","last_synced_at":"2025-09-06T15:35:16.885Z","repository":{"id":266412964,"uuid":"898268886","full_name":"PlugFox/repaint","owner":"PlugFox","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-04T06:18:11.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-04T06:28:08.529Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PlugFox.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","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},"funding":{"patreon":"plugfox","custom":["https://www.buymeacoffee.com/plugfox","https://boosty.to/plugfox"]}},"created_at":"2024-12-04T05:04:05.000Z","updated_at":"2024-12-04T06:28:08.000Z","dependencies_parsed_at":"2024-12-04T06:28:22.613Z","dependency_job_id":"ac895589-af03-438d-ad48-b9925e20b9ae","html_url":"https://github.com/PlugFox/repaint","commit_stats":null,"previous_names":["plugfox/repaint"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Frepaint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Frepaint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Frepaint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PlugFox%2Frepaint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PlugFox","download_url":"https://codeload.github.com/PlugFox/repaint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228567024,"owners_count":17937986,"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-12-07T06:09:50.155Z","updated_at":"2025-08-03T21:32:27.602Z","avatar_url":"https://github.com/PlugFox.png","language":"Dart","readme":"# RePaint\n\n[![Pub](https://img.shields.io/pub/v/repaint.svg)](https://pub.dev/packages/repaint)\n[![Actions Status](https://github.com/PlugFox/repaint/actions/workflows/checkout.yml/badge.svg)](https://github.com/PlugFox/repaint/actions)\n[![Coverage](https://codecov.io/gh/PlugFox/repaint/branch/master/graph/badge.svg)](https://codecov.io/gh/PlugFox/repaint)\n[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT)\n[![Linter](https://img.shields.io/badge/style-linter-40c4ff.svg)](https://pub.dev/packages/linter)\n[![GitHub stars](https://img.shields.io/github/stars/plugfox/repaint?style=social)](https://github.com/plugfox/repaint/)\n\nLibrary for creating and managing a canvas similar to CustomPaint but with more features.\n\n## How to\n\n### Handle mouse events\n\n```dart\n@override\n@mustCallSuper\nvoid onPointerEvent(PointerEvent event) {\n  case (event) {\n    case PointerDownEvent e:\n    case PointerUpEvent e:\n    case PointerCancelEvent e:\n    case PointerPanZoomStartEvent e:\n    case PointerPanZoomUpdateEvent e:\n    case PointerPanZoomEndEvent e:\n    case PointerScrollEvent e:\n    case PointerSignalEvent e:\n    case PointerHoverEvent e:\n      break;\n    case PointerMoveEvent e:\n      // Move the [_rect] by the [_offset] on mouse drag\n      final rect = _rect.shift(_offset);\n      if (!rect.contains(e.localPosition)) return;\n      _offset += move.delta;\n  }\n}\n```\n\n### Handle keyboard events\n\nTo handle keyboard events you can use [HardwareKeyboard](https://api.flutter.dev/flutter/services/HardwareKeyboard-class.html) manager:\n\n```dart\nbool _onKeyEvent(KeyEvent event) {\n  if (event.deviceType != KeyEventDeviceType.keyboard) return false;\n  if (event is! KeyDownEvent) return false;\n  // F1 - do something\n  switch (event.logicalKey) {\n    case LogicalKeyboardKey.f1:\n      doSomething();\n      return true;\n    default:\n      return false;\n  }\n}\n\n@override\nvoid mount(_, __) {\n  HardwareKeyboard.instance.addHandler(_onKeyEvent);\n}\n\n@override\nvoid unmount() {\n  HardwareKeyboard.instance.removeHandler(_onKeyEvent);\n}\n```\n\nor wrap RePaint with [Focus](https://api.flutter.dev/flutter/widgets/Focus-class.html) widget and use [onKeyEvent](https://api.flutter.dev/flutter/widgets/Focus/onKeyEvent.html) to handle keyboard events:\n\n```dart\nfinal painter = RePainterImpl();\n\nWidget build(BuildContext context) {\n  return Focus(\n    onKeyEvent: painter.onKeyEvent,\n    child: RePaint(\n      painter: painter,\n    ),\n  );\n}\n```\n","funding_links":["https://patreon.com/plugfox","https://www.buymeacoffee.com/plugfox","https://boosty.to/plugfox"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplugfox%2Frepaint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplugfox%2Frepaint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplugfox%2Frepaint/lists"}