mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
Init repo
This commit is contained in:
commit
764b6034e3
566 changed files with 212335 additions and 0 deletions
44
lib/util/fab_extended_anim.dart
Normal file
44
lib/util/fab_extended_anim.dart
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class FloatingActionButtonAnimated extends ConsumerWidget {
|
||||
final Widget label;
|
||||
final Widget icon;
|
||||
final String tooltip;
|
||||
final bool alternate;
|
||||
final bool isExtended;
|
||||
final void Function()? onPressed;
|
||||
const FloatingActionButtonAnimated({
|
||||
required this.label,
|
||||
required this.icon,
|
||||
required this.tooltip,
|
||||
this.alternate = false,
|
||||
this.isExtended = false,
|
||||
required this.onPressed,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return FloatingActionButton.extended(
|
||||
key: key,
|
||||
tooltip: tooltip,
|
||||
onPressed: onPressed,
|
||||
foregroundColor: alternate ? Theme.of(context).colorScheme.onSecondary : null,
|
||||
backgroundColor: alternate ? Theme.of(context).colorScheme.secondary : null,
|
||||
extendedPadding: EdgeInsets.all(14),
|
||||
label: AnimatedSize(
|
||||
duration: const Duration(milliseconds: 250),
|
||||
child: isExtended
|
||||
? Row(
|
||||
children: [
|
||||
icon,
|
||||
const SizedBox(width: 6),
|
||||
label,
|
||||
],
|
||||
)
|
||||
: icon,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue