import 'package:fcs/helpers/theme.dart';
import 'package:flutter/material.dart';

Widget badgeCounter(Widget child, int counter) {
  return Container(
    width: 120,
    child: new Stack(
      children: <Widget>[
        child,
        counter != null && counter != 0
            ? new Positioned(
                right: 12,
                top: 12,
                child: new Container(
                  padding: EdgeInsets.all(8),
                  decoration: new BoxDecoration(
                    shape: BoxShape.circle,
                    color: secondaryColor,
                  ),
                  constraints: BoxConstraints(
                    minWidth: 14,
                    minHeight: 14,
                  ),
                  child: Text(
                    counter > 99 ? '+99' : '$counter',
                    style: TextStyle(
                      color: Colors.white,
                    ),
                    textAlign: TextAlign.center,
                  ),
                ),
              )
            : new Container()
      ],
    ),
  );
}
