Files
fcs/lib/pages/widgets/badge.dart

39 lines
1.1 KiB
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
2020-09-20 05:34:49 +06:30
import 'package:flutter/material.dart';
Widget badgeCounter(Widget child, int counter) {
return Container(
width: 120,
2020-10-07 02:33:06 +06:30
height: 140,
2020-09-20 05:34:49 +06:30
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()
],
),
);
}