LCOV - code coverage report
Current view: top level - src/style - react_circle_tab_style.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 22 22 100.0 %
Date: 2020-02-24 15:58:08 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:flutter/cupertino.dart';
       2             : import 'package:flutter/material.dart';
       3             : 
       4             : import '../../convex_bottom_bar.dart';
       5             : import 'blend_image_icon.dart';
       6             : import 'inner_builder.dart';
       7             : import 'transition_container.dart';
       8             : 
       9             : /// Convex shape is moved after selection.
      10             : class ReactCircleTabStyle extends InnerBuilder {
      11             :   /// Color used as background of appbar and circle icon.
      12             :   final Color backgroundColor;
      13             : 
      14             :   /// Curve for tab transition.
      15             :   final Curve curve;
      16             : 
      17             :   /// Margin of tab.
      18             :   final margin = (ACTION_LAYOUT_SIZE - ACTION_INNER_BUTTON_SIZE) / 4;
      19             : 
      20           1 :   ReactCircleTabStyle({
      21             :     List<TabItem> items,
      22             :     Color activeColor,
      23             :     Color color,
      24             :     this.backgroundColor,
      25             :     this.curve,
      26           1 :   }) : super(items: items, activeColor: activeColor, color: color);
      27             : 
      28           1 :   @override
      29             :   Widget build(BuildContext context, int index, bool active) {
      30           2 :     var item = items[index];
      31             :     if (active) {
      32           2 :       final item = items[index];
      33           1 :       return TransitionContainer.scale(
      34           1 :         child: Container(
      35             :           width: ACTION_LAYOUT_SIZE,
      36             :           height: ACTION_LAYOUT_SIZE,
      37           2 :           margin: EdgeInsets.all(margin),
      38           1 :           decoration: BoxDecoration(
      39             :             shape: BoxShape.circle,
      40           1 :             color: active ? activeColor : color,
      41             :           ),
      42           1 :           child: BlendImageIcon(
      43           2 :             active ? item.activeIcon ?? item.icon : item.icon,
      44             :             size: ACTION_INNER_BUTTON_SIZE,
      45           2 :             color: item.blend ? backgroundColor : null,
      46             :           ),
      47             :         ),
      48           1 :         curve: curve,
      49             :       );
      50             :     }
      51           1 :     return Container(
      52           1 :       padding: EdgeInsets.only(bottom: 2),
      53           1 :       child: Column(
      54             :         mainAxisAlignment: MainAxisAlignment.end,
      55           1 :         children: <Widget>[
      56           1 :           BlendImageIcon(
      57           1 :             active ? item.activeIcon ?? item.icon : item.icon,
      58           2 :             color: item.blend ? color : null,
      59             :           ),
      60           4 :           Text(item.title, style: TextStyle(color: color))
      61             :         ],
      62             :       ),
      63             :     );
      64             :   }
      65             : }

Generated by: LCOV version 1.14