LCOV - code coverage report
Current view: top level - lib/shared/widgets - adventure_nodes_drop_down.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 15 19 78.9 %
Date: 2022-03-03 12:16:40 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:flutter/material.dart';
       2             : 
       3             : import 'package:flutter_redux/flutter_redux.dart';
       4             : import 'package:redux/redux.dart';
       5             : 
       6             : import '../../app_state.dart';
       7             : import '../actions/select_adventure_node_action.dart';
       8             : import '../extensions/build_context_extension.dart';
       9             : import '../models/adventure_node.dart';
      10             : import '../models/drop_down_model.dart';
      11             : 
      12             : class AdventureNodesDropDown<N extends AdventureNode> extends StatelessWidget {
      13           1 :   const AdventureNodesDropDown({
      14             :     required DropDownModel<N> Function(Store<AppState>) converter,
      15             :     Key? key,
      16             :   })  : _converter = converter,
      17           1 :         super(key: key);
      18             : 
      19             :   final DropDownModel<N> Function(Store<AppState>) _converter;
      20             : 
      21           1 :   @override
      22             :   Widget build(BuildContext context) {
      23           1 :     return StoreConnector<AppState, DropDownModel<N>>(
      24             :         distinct: true,
      25           1 :         converter: _converter,
      26           1 :         builder: (context, vm) {
      27           1 :           return DropdownButton<N>(
      28             :             iconEnabledColor: Colors.white,
      29             :             iconDisabledColor: Colors.white,
      30           1 :             value: vm.selected,
      31             :             style: const TextStyle(color: Colors.white, fontSize: 12),
      32             :             underline: const SizedBox(),
      33           0 :             onChanged: (N? selection) => (selection != null)
      34           0 :                 ? context.dispatch(SelectAdventureNodeAction(selection))
      35             :                 : null,
      36           1 :             selectedItemBuilder: (BuildContext context) {
      37           1 :               return vm.nodes
      38           1 :                   .map<DropdownMenuItem<N>>((node) => DropdownMenuItem(
      39             :                         value: node,
      40           0 :                         child: Text(node.name,
      41             :                             style: const TextStyle(color: Colors.white)),
      42             :                       ))
      43           1 :                   .toList();
      44             :             },
      45           1 :             items: vm.nodes
      46           1 :                 .map<DropdownMenuItem<N>>((node) => DropdownMenuItem(
      47             :                       value: node,
      48           0 :                       child: Text(node.name,
      49             :                           style: const TextStyle(color: Colors.black)),
      50             :                     ))
      51           1 :                 .toList(),
      52             :           );
      53             :         });
      54             :   }
      55             : }

Generated by: LCOV version 1.13