chore: Animated FAB

pull/3002/head
Christian Kußowski 15 hours ago
parent cc470e880f
commit b2b75306e4
No known key found for this signature in database

@ -69,7 +69,11 @@ class ChatListView extends StatelessWidget {
!controller.isSearchMode &&
controller.activeSpaceId == null &&
!FluffyThemes.isColumnMode(context)
? StartChatFab()
? ValueListenableBuilder(
valueListenable: controller.scrolledToTop,
builder: (context, scrolledToTop, _) =>
StartChatFab(extended: scrolledToTop),
)
: const SizedBox.shrink(),
),
),

@ -3,22 +3,33 @@
//
// SPDX-License-Identifier: AGPL-3.0-or-later
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/l10n/l10n.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
class StartChatFab extends StatelessWidget {
const StartChatFab({super.key});
final bool extended;
const StartChatFab({this.extended = false, super.key});
@override
Widget build(BuildContext context) {
return FloatingActionButton(
return FloatingActionButton.extended(
heroTag: 'start_chat_fab',
backgroundColor: Theme.of(context).colorScheme.primary,
foregroundColor: Theme.of(context).colorScheme.onPrimary,
onPressed: () => context.go('/rooms/newprivatechat'),
tooltip: L10n.of(context).newChat,
child: const Icon(Icons.edit_square),
extendedIconLabelSpacing: extended ? 10 : 0,
extendedPadding: extended
? null
: const EdgeInsets.symmetric(horizontal: 16),
label: AnimatedSize(
alignment: Alignment.centerLeft,
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
child: extended ? Text(L10n.of(context).newChat) : SizedBox.shrink(),
),
icon: const Icon(Icons.edit_square),
);
}
}

Loading…
Cancel
Save