Files
pipelines/app/lib/features/chat/conversation/chat_next_chat_button.dart
T

39 lines
1.2 KiB
Dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import '../ui/sessions/chat_adaptive.dart';
/// The open chat's Next chat button: the platform's icon button, labelled
/// "Next chat", that opens the chat after this one in the list.
///
/// It stays in the bar rather than leaving for the More menu on a narrow
/// bar (it is not [SegmentedOverflowable]): it is the one-tap way to cycle
/// chats on a phone, so the title gives up the room instead.
class ChatNextChatButton extends StatelessWidget {
const ChatNextChatButton({super.key, required this.onPressed});
static const label = 'Next chat';
final VoidCallback onPressed;
@override
Widget build(BuildContext context) {
if (chatControlsStyleOf(context) == ChatControlsStyle.cupertino) {
return Semantics(
label: label,
button: true,
child: CupertinoButton(
padding: EdgeInsets.zero,
onPressed: onPressed,
child: const Icon(CupertinoIcons.arrow_right_to_line),
),
);
}
return IconButton(
tooltip: label,
onPressed: onPressed,
icon: const Icon(Icons.keyboard_tab),
);
}
}