LCOV - code coverage report
Current view: top level - src/ui/editor/pages/create_helper/widgets/preview_card_swiper - dot_indicators.dart (source / functions) Hit Total Coverage
Test: lcov.info Lines: 20 20 100.0 %
Date: 2020-12-04 18:41:24 Functions: 0 0 -

          Line data    Source code
       1             : import 'package:flutter/widgets.dart';
       2             : import 'package:pal/src/theme.dart';
       3             : 
       4             : class DotIndicatorsWidget extends StatelessWidget {
       5             :   final int pagesCount;
       6             :   final int activePage;
       7           2 :   const DotIndicatorsWidget({
       8             :     Key key,
       9             :     @required this.pagesCount,
      10             :     @required this.activePage,
      11           2 :   }) : super(key: key);
      12             : 
      13           2 :   @override
      14             :   Widget build(BuildContext context) {
      15           2 :     return Wrap(
      16             :       spacing: 5.0,
      17             :       runSpacing: 5.0,
      18             :       alignment: WrapAlignment.center,
      19             :       crossAxisAlignment: WrapCrossAlignment.center,
      20           2 :       children: _buildDots(context),
      21             :     );
      22             :   }
      23             : 
      24           2 :   List<Widget> _buildDots(BuildContext context) {
      25           2 :     List<Widget> dots = [];
      26           6 :     for (int i = 0; i < pagesCount; i++) {
      27           4 :       Widget dot = activePage == i
      28           2 :           ? _buildActiveDot(context)
      29           1 :           : _buildDisabledDot(context);
      30           2 :       dots.add(dot);
      31             :     }
      32             :     return dots;
      33             :   }
      34             : 
      35           2 :   Widget _buildActiveDot(BuildContext context) {
      36           2 :     return Container(
      37             :       width: 20,
      38             :       height: 20,
      39           2 :       decoration: BoxDecoration(
      40             :         shape: BoxShape.circle,
      41           6 :         color: PalTheme.of(context).colors.dark,
      42             :       ),
      43             :     );
      44             :   }
      45             : 
      46           1 :   Widget _buildDisabledDot(BuildContext context) {
      47           1 :     return Container(
      48             :       width: 10,
      49             :       height: 10,
      50           1 :       decoration: BoxDecoration(
      51             :         shape: BoxShape.circle,
      52           4 :         color: PalTheme.of(context).colors.dark.withAlpha(50),
      53             :       ),
      54             :     );
      55             :   }
      56             : }

Generated by: LCOV version 1.14