57 lines
1.4 KiB
Dart
57 lines
1.4 KiB
Dart
import 'package:didvan/config/theme_data.dart';
|
|
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_spinkit/flutter_spinkit.dart';
|
|
|
|
class MessageBarBtn extends StatelessWidget {
|
|
final bool enable;
|
|
final IconData icon;
|
|
final Function()? click;
|
|
final Color? color;
|
|
final bool loading;
|
|
const MessageBarBtn(
|
|
{Key? key,
|
|
required this.enable,
|
|
required this.icon,
|
|
this.click,
|
|
this.color,
|
|
this.loading = false})
|
|
: super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: 32,
|
|
height: 32,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: enable
|
|
? color ?? Theme.of(context).colorScheme.primary
|
|
: Theme.of(context).colorScheme.border),
|
|
child: InkWell(
|
|
onTap: click,
|
|
child: Stack(
|
|
children: [
|
|
Positioned.fill(
|
|
child: Icon(
|
|
icon,
|
|
size: 18,
|
|
color: enable ? Theme.of(context).colorScheme.white : null,
|
|
),
|
|
),
|
|
if (loading)
|
|
const Positioned.fill(
|
|
child: Padding(
|
|
padding: EdgeInsets.all(8.0),
|
|
child: SpinKitCircle(
|
|
size: 24,
|
|
color: Colors.white,
|
|
),
|
|
))
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|