mangayomi/lib/modules/manga/detail/widgets/custom_floating_action_btn.dart
kodjomoustapha 9d55733e97 Relocate extensions
-refactor
-also modify display widget in library draggabalble menu
2024-01-09 12:06:39 +01:00

60 lines
1.7 KiB
Dart

import 'package:flutter/material.dart';
import 'package:mangayomi/utils/extensions/build_context_extensions.dart';
class CustomFloatingActionBtn extends StatelessWidget {
final bool isExtended;
final VoidCallback onPressed;
final String label;
final double width;
final double textWidth;
const CustomFloatingActionBtn(
{super.key,
required this.isExtended,
required this.onPressed,
required this.label,
required this.width,
required this.textWidth});
@override
Widget build(BuildContext context) {
return AnimatedContainer(
height: 55,
width: !isExtended ? 63 : width,
duration: const Duration(milliseconds: 200),
curve: Curves.easeIn,
child: FloatingActionButton(
backgroundColor: context.primaryColor,
onPressed: onPressed,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Row(
children: [
const Icon(
Icons.play_arrow,
color: Colors.white,
),
AnimatedContainer(
curve: Curves.easeIn,
width: !isExtended ? 0 : 5,
duration: const Duration(milliseconds: 200),
),
],
),
AnimatedContainer(
curve: Curves.easeIn,
width: !isExtended ? 0 : textWidth,
duration: const Duration(milliseconds: 200),
child: Text(
label,
overflow: TextOverflow.ellipsis,
style: const TextStyle(fontSize: 14, color: Colors.white),
),
),
],
),
),
);
}
}