{"id":21748380,"url":"https://github.com/surfstudio/flutter-surf-mwwm","last_synced_at":"2025-07-19T00:32:00.423Z","repository":{"id":45561621,"uuid":"384333884","full_name":"surfstudio/flutter-surf-mwwm","owner":"surfstudio","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-24T11:08:40.000Z","size":82,"stargazers_count":6,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2023-08-01T12:24:30.350Z","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":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/surfstudio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-07-09T05:43:43.000Z","updated_at":"2023-08-01T12:24:30.350Z","dependencies_parsed_at":"2022-07-20T08:32:04.273Z","dependency_job_id":null,"html_url":"https://github.com/surfstudio/flutter-surf-mwwm","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-surf-mwwm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-surf-mwwm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-surf-mwwm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/surfstudio%2Fflutter-surf-mwwm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/surfstudio","download_url":"https://codeload.github.com/surfstudio/flutter-surf-mwwm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226462286,"owners_count":17629049,"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-26T08:13:18.991Z","updated_at":"2024-11-26T08:13:19.708Z","avatar_url":"https://github.com/surfstudio.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Surf MWWM\n\n[![Build Status](https://shields.io/github/workflow/status/surfstudio/SurfGear/build?logo=github\u0026logoColor=white)](https://github.com/surfstudio/SurfGear/tree/main/packages/surf_mwwm)\n[![Coverage Status](https://img.shields.io/codecov/c/github/surfstudio/SurfGear?flag=surf_mwwm\u0026logo=codecov\u0026logoColor=white)](https://codecov.io/gh/surfstudio/SurfGear)\n[![Pub Version](https://img.shields.io/pub/v/surf_mwwm?logo=dart\u0026logoColor=white)](https://pub.dev/packages/surf_mwwm)\n[![Pub Likes](https://badgen.net/pub/likes/surf_mwwm)](https://pub.dev/packages/surf_mwwm)\n[![Pub popularity](https://badgen.net/pub/popularity/surf_mwwm)](https://pub.dev/packages/surf_mwwm/score)\n![Flutter Platform](https://badgen.net/pub/flutter-platform/surf_mwwm)\n\nThis package made by [Surf](https://surf.ru/).\n\n## Description\n\nReflection of widget in a single entity\n\n## Installation\n\nAdd `surf_mwwm` to your `pubspec.yaml` file:\n\n```yaml\ndependencies:\n  surf_mwwm: ^1.0.0\n```\n\nYou can use both `stable` and `dev` versions of the package listed above in the badges bar.\n\n## Example\n\n1. Create WM class\n\n```dart\nclass CounterWidgetModel extends WidgetModel {\n  CounterWidgetModel(\n    WidgetModelDependencies dependencies,\n    this.navigator,\n    this._key,\n  ) : super(dependencies);\n\n  final NavigatorState navigator;\n  final GlobalKey\u003cScaffoldState\u003e _key;\n\n  StreamedState\u003cint\u003e counterState = StreamedState(0);\n\n  final incrementAction = VoidAction();\n  final showInit = StreamedAction\u003cint\u003e();\n\n  @override\n  void onLoad() {\n    _listenToActions();\n    super.onLoad();\n  }\n\n  void _listenToActions() {\n    incrementAction.bind((_) {\n      counterState.accept(counterState.value + 1);\n    }).listenOn(\n      this,\n      onValue: (_) {},\n    );\n\n    showInit.bind((_) {\n      ScaffoldMessenger.of(_key.currentContext!).showSnackBar(\n        const SnackBar(\n          content: Text('init'),\n        ),\n      );\n    }).listenOn(this, onValue: (_) {});\n\n    counterState.stream.where((c) =\u003e c.isEven).skip(1).listenOn(\n      this,\n      onValue: (c) {\n        navigator.push(\n          MaterialPageRoute\u003cvoid\u003e(\n            builder: (ctx) =\u003e Scaffold(\n              body: Column(\n                children: [\n                  TextField(\n                    autofocus: true,\n                    onChanged: (_) {},\n                  ),\n                ],\n              ),\n            ),\n          ),\n        );\n      },\n    );\n  }\n}\n```\n\n2. Create Screen\n\n```dart\nclass CounterScreen extends MwwmWidget\u003cCounterComponent\u003e {\n  CounterScreen({Key? key})\n      : super(\n          key: key,\n          dependenciesBuilder: (context) =\u003e\n              CounterComponent(Navigator.of(context)),\n          widgetStateBuilder: () =\u003e _CounterScreenState(),\n          widgetModelBuilder: createCounterModel,\n        );\n}\n\nclass _CounterScreenState extends OldWidgetState\u003cCounterWidgetModel\u003e {\n  @override\n  Widget build(BuildContext context) {\n    return Scaffold(\n      key: context.getComponent\u003cCounterComponent\u003e().scaffoldKey,\n      appBar: AppBar(\n        title: const Text('Counter Demo'),\n      ),\n      body: StreamBuilder(\n        stream: wm.counterState.stream,\n        initialData: 0,\n        builder: (context, snapshot) {\n          return Center(\n            child: Column(\n              mainAxisAlignment: MainAxisAlignment.center,\n              children: [\n                const Text('You have pushed the this many times:'),\n                Text(\n                  '${snapshot.data}',\n                  style: Theme.of(context).textTheme.caption,\n                ),\n                TextField(\n                  autofocus: true,\n                  onChanged: (_) {},\n                ),\n              ],\n            ),\n          );\n        },\n      ),\n      floatingActionButton: FloatingActionButton(\n        onPressed: wm.incrementAction,\n        tooltip: 'Increment',\n        child: const Icon(Icons.add),\n      ),\n    );\n  }\n}\n```\n\n3. Create Route\n\n```dart\nclass CounterScreenRoute extends MaterialPageRoute\u003cvoid\u003e {\n  CounterScreenRoute() : super(builder: (ctx) =\u003e CounterScreen());\n}\n```\n\n## Changelog\n\nAll notable changes to this project will be documented in [this file](./CHANGELOG.md).\n\n## Issues\n\nFor issues, file directly in the Issues section.\n\n## Contribute\n\nIf you would like to contribute to the package (e.g. by improving the documentation, solving a bug or adding a cool new feature), please review our [contribution guide](../../CONTRIBUTING.md) first and send us your pull request.\n\nYour PRs are always welcome.\n\n## How to reach us\n\nPlease feel free to ask any questions about this package. Join our community chat on Telegram. We speak English and Russian.\n\n[![Telegram](https://img.shields.io/badge/chat-on%20Telegram-blue.svg)](https://t.me/SurfGear)\n\n## License\n\n[Apache License, Version 2.0](https://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fflutter-surf-mwwm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsurfstudio%2Fflutter-surf-mwwm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsurfstudio%2Fflutter-surf-mwwm/lists"}