SimpleCloudNotifier/flutter/lib/components/hidable_fab/hidable_fab.dart
Mike Schwörer ac299ec7ba
All checks were successful
Build Docker and Deploy / Build Docker Container (push) Successful in 2m58s
Build Docker and Deploy / Deploy to Server (push) Successful in 32s
Better client/login/authState handling
2024-06-02 17:09:57 +02:00

25 lines
620 B
Dart

import 'package:flutter/material.dart';
class HidableFAB extends StatelessWidget {
final VoidCallback? onPressed;
final IconData icon;
const HidableFAB({
super.key,
this.onPressed,
required this.icon,
});
Widget build(BuildContext context) {
return Visibility(
visible: MediaQuery.viewInsetsOf(context).bottom == 0.0, // hide when keyboard is shown
child: FloatingActionButton(
onPressed: onPressed,
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.all(Radius.circular(17))),
elevation: 2.0,
child: Icon(icon),
),
);
}
}