LCOV - code coverage report
Current view: top level - src/ui/editor/pages/helper_editor/widgets - editor_button.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 19 23 82.6 %
Date: 2020-12-04 18:41:24 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:flutter/cupertino.dart';
       2             : import 'package:flutter/material.dart';
       3             : import 'package:flutter/services.dart';
       4             : import 'package:pal/src/theme.dart';
       5             : import 'package:pal/src/ui/shared/widgets/circle_button.dart';
       6             : 
       7             : class EditorButton extends StatelessWidget {
       8             :   final Function onPressed;
       9             :   final double size;
      10             :   final Icon icon;
      11             :   final Color bgColor, iconColor;
      12             :   final bool bordered;
      13             :   final bool isEnabled;
      14             : 
      15           3 :   EditorButton(
      16             :       {this.onPressed,
      17             :       this.size,
      18             :       this.icon,
      19             :       this.bgColor,
      20             :       this.iconColor,
      21             :       this.bordered = false,
      22             :       this.isEnabled = true,
      23             :       Key key})
      24           3 :       : super(key: key);
      25             : 
      26           3 :   factory EditorButton.validate(PalThemeData theme, Function onPressed,
      27             :           {Key key, bool isEnabled = true}) =>
      28           3 :       EditorButton(
      29             :           onPressed: onPressed,
      30             :           size: 52,
      31             :           isEnabled: isEnabled,
      32           9 :           icon: Icon(Icons.check, size: 32, color: theme.colors.dark),
      33           6 :           bgColor: theme.colors.color3,
      34             :           key: key);
      35             : 
      36           3 :   factory EditorButton.cancel(PalThemeData theme, Function onPressed,
      37             :           {Key key, bool isEnabled = true}) =>
      38           3 :       EditorButton(
      39             :           onPressed: onPressed,
      40             :           size: 40,
      41             :           isEnabled: isEnabled,
      42           9 :           icon: Icon(Icons.close, size: 24, color: theme.colors.accent),
      43           6 :           bgColor: theme.colors.light,
      44             :           key: key);
      45             : 
      46           0 :   factory EditorButton.editMode(PalThemeData theme, Function onPressed,
      47             :           {Key key, bool isEnabled = true}) =>
      48           0 :       EditorButton(
      49             :         onPressed: onPressed,
      50             :         size: 52,
      51             :         isEnabled: isEnabled,
      52           0 :         icon: Icon(Icons.mode_edit, size: 32, color: theme.colors.light),
      53           0 :         bgColor: theme.colors.color3,
      54             :         bordered: true,
      55             :         key: key,
      56             :       );
      57             : 
      58           3 :   @override
      59             :   Widget build(BuildContext context) {
      60           3 :     return CircleIconButton(
      61           3 :       icon: icon,
      62           6 :       radius: size / 2,
      63           3 :       backgroundColor: bgColor,
      64           6 :       onTapCallback: (onPressed != null && this.isEnabled)
      65           2 :           ? () {
      66           2 :               HapticFeedback.selectionClick();
      67             : 
      68           4 :               onPressed();
      69             :             }
      70             :           : null,
      71             :     );
      72             :   }
      73             : }

Generated by: LCOV version 1.14