You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/pangea/widgets/conversation_bot/conversation_bot_mode_selec...

47 lines
1.4 KiB
Dart

import 'package:dropdown_button2/dropdown_button2.dart';
import 'package:fluffychat/pangea/constants/bot_mode.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
class ConversationBotModeSelect extends StatelessWidget {
final String? initialMode;
final void Function(String?) onChanged;
final bool enabled;
const ConversationBotModeSelect({
super.key,
this.initialMode,
required this.onChanged,
this.enabled = true,
});
@override
Widget build(BuildContext context) {
final Map<String, String> options = {
BotMode.discussion:
L10n.of(context)!.conversationBotModeSelectOption_discussion,
BotMode.custom: L10n.of(context)!.conversationBotModeSelectOption_custom,
// BotMode.textAdventure:
// L10n.of(context)!.conversationBotModeSelectOption_textAdventure,
// BotMode.storyGame:
// L10n.of(context)!.conversationBotModeSelectOption_storyGame,
};
return DropdownButtonFormField2(
hint: Text(L10n.of(context)!.selectBotChatMode),
items: [
for (final entry in options.entries)
DropdownMenuItem(
value: entry.key,
child: Text(
entry.value,
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
),
),
],
onChanged: enabled ? onChanged : null,
);
}
}