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-03-09 19:58:44 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             :   /// Create style builder.
      21           1 :   ReactCircleTabStyle({
      22             :     List<TabItem> items,
      23             :     Color activeColor,
      24             :     Color color,
      25             :     this.backgroundColor,
      26             :     this.curve,
      27           1 :   }) : super(items: items, activeColor: activeColor, color: color);
      28             : 
      29           1 :   @override
      30             :   Widget build(BuildContext context, int index, bool active) {
      31           2 :     var item = items[index];
      32             :     if (active) {
      33           2 :       final item = items[index];
      34           1 :       return TransitionContainer.scale(
      35           1 :         child: Container(
      36             :           width: ACTION_LAYOUT_SIZE,
      37             :           height: ACTION_LAYOUT_SIZE,
      38           2 :           margin: EdgeInsets.all(margin),
      39           1 :           decoration: BoxDecoration(
      40             :             shape: BoxShape.circle,
      41           1 :             color: active ? activeColor : color,
      42             :           ),
      43           1 :           child: BlendImageIcon(
      44           2 :             active ? item.activeIcon ?? item.icon : item.icon,
      45             :             size: ACTION_INNER_BUTTON_SIZE,
      46           2 :             color: item.blend ? backgroundColor : null,
      47             :           ),
      48             :         ),
      49           1 :         curve: curve,
      50             :       );
      51             :     }
      52           1 :     return Container(
      53           1 :       padding: EdgeInsets.only(bottom: 2),
      54           1 :       child: Column(
      55             :         mainAxisAlignment: MainAxisAlignment.end,
      56           1 :         children: <Widget>[
      57           1 :           BlendImageIcon(
      58           1 :             active ? item.activeIcon ?? item.icon : item.icon,
      59           2 :             color: item.blend ? color : null,
      60             :           ),
      61           4 :           Text(item.title, style: TextStyle(color: color))
      62             :         ],
      63             :       ),
      64             :     );
      65             :   }
      66             : }

Generated by: LCOV version 1.14