LCOV - code coverage report
Current view: top level - lib/organisations/widgets - organisation_creator_view.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 1 18 5.6 %
Date: 2022-03-03 12:16:13 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:redfire/extensions.dart';
       5             : 
       6             : import '../../app_state.dart';
       7             : import '../actions/create_organisation_action.dart';
       8             : import '../models/organisation_model.dart';
       9             : 
      10             : class OrganisationCreatorView extends StatefulWidget {
      11           1 :   const OrganisationCreatorView({Key? key}) : super(key: key);
      12             : 
      13           0 :   @override
      14             :   State<OrganisationCreatorView> createState() =>
      15           0 :       _OrganisationCreatorViewState();
      16             : }
      17             : 
      18             : class _OrganisationCreatorViewState extends State<OrganisationCreatorView> {
      19             :   final _controller = TextEditingController();
      20             : 
      21           0 :   @override
      22             :   Widget build(BuildContext context) {
      23           0 :     return StoreConnector<AppState, bool>(
      24             :         distinct: true,
      25           0 :         converter: (store) => store.state.organisations.creator.creating,
      26           0 :         builder: (context, creating) {
      27           0 :           if (!creating) _controller.text = '';
      28           0 :           return SizedBox(
      29             :             height: 50,
      30           0 :             child: Row(
      31           0 :               children: [
      32           0 :                 SizedBox(
      33             :                   width: 200,
      34           0 :                   child: TextField(
      35           0 :                     controller: _controller,
      36             :                     decoration: const InputDecoration(
      37             :                         border: OutlineInputBorder(), hintText: 'Name...'),
      38             :                   ),
      39             :                 ),
      40             :                 (creating)
      41             :                     ? const SizedBox(
      42             :                         width: 30,
      43             :                         height: 30,
      44             :                         child: Center(
      45             :                           child: CircularProgressIndicator(),
      46             :                         ),
      47             :                       )
      48           0 :                     : IconButton(
      49             :                         icon: const Icon(Icons.add),
      50           0 :                         onPressed: () => context.dispatch<AppState>(
      51           0 :                             CreateOrganisationAction(OrganisationModel.init(
      52           0 :                                 name: _controller.text))),
      53             :                         hoverColor: Colors.transparent,
      54             :                         splashRadius: 20,
      55             :                       ),
      56             :               ],
      57             :             ),
      58             :           );
      59             :         });
      60             :   }
      61             : }

Generated by: LCOV version 1.13