add structure
This commit is contained in:
43
lib/widget/badge.dart
Normal file
43
lib/widget/badge.dart
Normal file
@@ -0,0 +1,43 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
Widget badgeCounter(int counter, {VoidCallback onPressed}) {
|
||||
return InkWell(
|
||||
onTap: () => onPressed(),
|
||||
child: new Stack(
|
||||
children: <Widget>[
|
||||
new IconButton(
|
||||
padding: EdgeInsets.only(top: 10),
|
||||
icon: Icon(Icons.notifications),
|
||||
onPressed: () {
|
||||
onPressed();
|
||||
}),
|
||||
counter != 0
|
||||
? new Positioned(
|
||||
right: 11,
|
||||
top: 11,
|
||||
child: new Container(
|
||||
padding: EdgeInsets.all(2),
|
||||
decoration: new BoxDecoration(
|
||||
color: Colors.blue,
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
),
|
||||
constraints: BoxConstraints(
|
||||
minWidth: 14,
|
||||
minHeight: 14,
|
||||
),
|
||||
child: Text(
|
||||
'+${counter > 99 ? 99 : counter}',
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 10,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
)
|
||||
: new Container()
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user