84 lines
2.6 KiB
Dart
84 lines
2.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pweb/controllers/dashboard/balance/actions_ui.dart';
|
|
import 'package:pweb/controllers/dashboard/balance/source_actions.dart';
|
|
import 'package:pweb/pages/dashboard/buttons/balance/actions/hover_expandable_action_button.dart';
|
|
|
|
|
|
class BalanceActionsBar extends StatefulWidget {
|
|
final BalanceActionsState state;
|
|
|
|
const BalanceActionsBar({super.key, required this.state});
|
|
|
|
@override
|
|
State<BalanceActionsBar> createState() => _BalanceActionsBarState();
|
|
}
|
|
|
|
class _BalanceActionsBarState extends State<BalanceActionsBar> {
|
|
static const double _buttonHeight = 34.0;
|
|
static const double _buttonGap = 6.0;
|
|
static const double _iconSize = 18.0;
|
|
static const double _textGap = 8.0;
|
|
static const double _horizontalPadding = 6.0;
|
|
|
|
final BalanceActionsUiController _uiController = BalanceActionsUiController();
|
|
|
|
@override
|
|
void dispose() {
|
|
_uiController.dispose();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
final textStyle = Theme.of(context).textTheme.titleSmall?.copyWith(
|
|
fontWeight: FontWeight.w400,
|
|
color: colorScheme.onSecondary,
|
|
fontSize: 14,
|
|
);
|
|
final buttons = <BalanceActionButtonState>[
|
|
widget.state.topLeading,
|
|
widget.state.topTrailing,
|
|
widget.state.bottom,
|
|
];
|
|
|
|
return ListenableBuilder(
|
|
listenable: _uiController,
|
|
builder: (context, _) {
|
|
return Align(
|
|
alignment: Alignment.centerRight,
|
|
child: OverflowBox(
|
|
alignment: Alignment.centerRight,
|
|
minWidth: 0,
|
|
maxWidth: double.infinity,
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
for (var i = 0; i < buttons.length; i++) ...[
|
|
HoverExpandableActionButton(
|
|
height: _buttonHeight,
|
|
icon: buttons[i].icon,
|
|
label: buttons[i].label,
|
|
iconSize: _iconSize,
|
|
textStyle: textStyle,
|
|
expanded: _uiController.isExpanded(i),
|
|
textGap: _textGap,
|
|
horizontalPadding: _horizontalPadding,
|
|
onHoverChanged: (hovered) =>
|
|
_uiController.onHoverChanged(i, hovered),
|
|
onPressed: buttons[i].onPressed,
|
|
),
|
|
if (i != buttons.length - 1)
|
|
const SizedBox(height: _buttonGap),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|