LCOV - code coverage report
Current view: | top level - src/models/organizers/organizer_helper - widget_helper.dart (source / functions) |  |  | Hit | Total | Coverage
Test: | lcov.info |  | Lines: | 19 | 19 | 100.0 %
Date: | 2021-10-11 06:57:03 |  | Functions: | 0 | 0 | -

              Line data    Source code
           1             : import 'package:widgetbook/widgetbook.dart';
           2             :
           3             : /// helper to obtain all WidgetElements in the navigation tree.
           4             : class WidgetHelper {
           5           1 :   static List<WidgetElement> getAllWidgetElementsFromCategories(
           6             :       List<Category> categories) {
           7           1 :     final widgets = <WidgetElement>[];
           8           2 :     for (final category in categories) {
           9           1 :       widgets.addAll(
          10           1 :         getAllWidgetElementsFromCategory(category),
          11             :       );
          12             :     }
          13             :     return widgets;
          14             :   }
          15             :
          16           1 :   static List<WidgetElement> getAllWidgetElementsFromCategory(
          17             :       Category category) {
          18           1 :     final widgetList = List<WidgetElement>.from(
          19           1 :       category.widgets,
          20           1 :     )..addAll(
          21           2 :         getAllWidgetElementsFromFolders(category.folders),
          22             :       );
          23             :     return widgetList;
          24             :   }
          25             :
          26           1 :   static List<WidgetElement> getAllWidgetElementsFromFolders(
          27             :       List<Folder> folders) {
          28           1 :     final widgetList = <WidgetElement>[];
          29           2 :     for (final folder in folders) {
          30           1 :       widgetList.addAll(
          31           1 :         getAllWidgetElementsFromFolder(folder),
          32             :       );
          33             :     }
          34             :     return widgetList;
          35             :   }
          36             :
          37           1 :   static List<WidgetElement> getAllWidgetElementsFromFolder(Folder folder) {
          38           2 :     final widgetList = List<WidgetElement>.from(folder.widgets)
          39           1 :       ..addAll(
          40           2 :         getAllWidgetElementsFromFolders(folder.folders),
          41             :       );
          42             :     return widgetList;
          43             :   }
          44             : }

Generated by: LCOV version 1.15