{"id":21065090,"url":"https://github.com/prolificinteractive/flutter_debug_menu","last_synced_at":"2025-03-14T01:43:10.251Z","repository":{"id":147516540,"uuid":"182835917","full_name":"prolificinteractive/flutter_debug_menu","owner":"prolificinteractive","description":"Flutter Debug Menu","archived":false,"fork":false,"pushed_at":"2019-05-10T17:48:16.000Z","size":99,"stargazers_count":2,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-20T20:53:43.381Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prolificinteractive.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-04-22T17:32:20.000Z","updated_at":"2019-06-13T02:05:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"8211e1fb-3d68-43a7-90ea-c2438d972a8f","html_url":"https://github.com/prolificinteractive/flutter_debug_menu","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2Fflutter_debug_menu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2Fflutter_debug_menu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2Fflutter_debug_menu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prolificinteractive%2Fflutter_debug_menu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prolificinteractive","download_url":"https://codeload.github.com/prolificinteractive/flutter_debug_menu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243508986,"owners_count":20302106,"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-19T17:53:32.729Z","updated_at":"2025-03-14T01:43:10.230Z","avatar_url":"https://github.com/prolificinteractive.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# debug_menu\n\nA debug menu for Flutter\n\n## Getting Started\n\nThis project is a starting point for a Dart\n[package](https://flutter.io/developing-packages/),\na library module containing code that can be shared easily across\nmultiple Flutter or Dart projects.\n\nFor help getting started with Flutter, view our\n[online documentation](https://flutter.io/docs), which offers tutorials,\nsamples, guidance on mobile development, and a full API reference.\n\n## Implementation\n\nAdd `RootDebugContainer` as the root object in the application's main build function.\n\n```\n @override\n  Widget build(BuildContext context) {\n    return RootDebugContainer(\n        child: AppContainer(\n            application: _application,\n            child: MaterialApp( ... )),\n        title: 'AT\u0026T Thanks',\n        menuActions: _debugActions(),\n        isProduction: false,\n        gestureType: GestureType.doubleTap,\n        logNetworkRequests: true);\n  }\n```\n\nThe `child` can be the standard application container of the app. Other options of the RootDebugContainer include:\n\n- `title` - Title of the application. Sets the app bar of the debug menu.\n- `menuActions` - Actions of the debug menu. More information below.\n- `isProduction` - Flag to determine if the application is in production. Will disable the debug menu if the app is in production.\n- `gestureType` - Debug menu activation gesture. Current options: `longPress` or `doubleTap`.\n- `logNetworkRequests` - Flag to determine if the debug menu should log network requests and responses.\n\n## Menu Actions\n\nAdd `menuActions` to the `RootDebugContainer`. Actions can be added in the form of a `List\u003cMenuAction\u003e`.\n\n### `MultiMenuAction`\n`MultiMenuAction` can be used for menu actions that require a selection from a menu. A `MultiMenuAction` is useful for changing the API environment.\n\n```\n List\u003cMenuAction\u003e _debugActions() {\n    final List\u003cMenuAction\u003e actions = List\u003cMenuAction\u003e();\n    final List\u003cMenuAction\u003e subActions = List\u003cMenuAction\u003e();\n\n    final MenuAction stagingAction = ToggleMenuAction(\n        'Staging',\n        'Development API Environment',\n        () =\u003e {_application = ATTApplication(Staging())},\n        true);\n\n    final MenuAction developmentAction = ToggleMenuAction(\n        'Development',\n        'Development API Environment',\n        () =\u003e {_application = ATTApplication(Dev())},\n        false);\n\n    final MenuAction productionAction = ToggleMenuAction(\n        'Production',\n        'Production API Environment',\n        () =\u003e {_application = ATTApplication(Production())},\n        false);\n\n    subActions.add(stagingAction);\n    subActions.add(developmentAction);\n    subActions.add(productionAction);\n\n    final MultiMenuAction multiMenuAction =\n        MultiMenuAction('API Environments', subActions);\n\n    actions.add(multiMenuAction);\n    return actions;\n  }\n```\nAs shown above, a `MultiMenuAction`, takes in a the name of the action with a list of subActions. A subAction can be in the form of the abstract class `MenuAction`\n\n```\nabstract class MenuAction {\n  /// Title of the menu action.\n  String title;\n\n  /// Description of the menu action.\n  String description;\n}\n```\n\n### `ToggleMenuAction`\nA `ToggleMenuAction` can either be selected or unselected. It can be used in a `MultiMenuAction` or by itself to select an option.\n\n```\nfinal MenuAction productionAction = ToggleMenuAction(\n    'Production',\n    'Production API Environment',\n    () =\u003e {_application = ATTApplication(Production())},\n    false);\n```\n\nParameters:\n - title - The title of the action.\n - description - SubTitle description of the action.\n - actionSelectedCallback - Callback when the action is selected.\n\nA `ToggleMenuAction` can be used with a `MultiMenuAction` to change the API environment when its selected.\n\n### `SingleMenuAction`\nA `SingleMenuAction` is similar to a `ToggleMenuAction`, except it doesn't have a selected / unselected state.\nThe `actionSelectedCallback` is called whenever the item is selected.\n\n```\nfinal SingleMenuAction singleMenuAction = SingleMenuAction(\n    'Show a toast',\n    'Sample display for a toast',\n    () =\u003e {print('Selected Single Menu Action')});\n```\n\n### Network Activity Monitor\n\nNetwork Activity can be monitored and displayed in the debug menu by adding the following line to dio.\n\n```\n_dio.interceptors.add(DebugMenuInterceptor(isProduction: false));\n```\n\nThe `isProduction` boolean flag will allow the ability to prevent any network logging if it is in production.\nTo enable network logging, ensure `isProduction` is set to false and the `logNetworkRequests` is enabled in the `RootDebugContainer`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprolificinteractive%2Fflutter_debug_menu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprolificinteractive%2Fflutter_debug_menu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprolificinteractive%2Fflutter_debug_menu/lists"}