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...

80 lines
2.5 KiB
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;
const ConversationBotModeSelect({
super.key,
this.initialMode,
this.onChanged,
});
@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 Padding(
padding: const EdgeInsets.all(12.0),
child: Container(
decoration: BoxDecoration(
border: Border.all(
color: Theme.of(context).colorScheme.secondary,
width: 0.5,
),
borderRadius: const BorderRadius.all(Radius.circular(10)),
),
child: DropdownButton(
// Initial Value
hint: Padding(
padding: const EdgeInsets.only(left: 15),
child: Text(
options[initialMode ?? BotMode.discussion]!,
style: const TextStyle().copyWith(
color: Theme.of(context).textTheme.bodyLarge!.color,
fontSize: 14,
),
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
),
),
isExpanded: true,
underline: Container(),
// Down Arrow Icon
icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: [
for (final entry in options.entries)
DropdownMenuItem(
value: entry.key,
child: Padding(
padding: const EdgeInsets.only(left: 15),
child: Text(
entry.value,
style: const TextStyle().copyWith(
color: Theme.of(context).textTheme.bodyLarge!.color,
fontSize: 14,
),
overflow: TextOverflow.clip,
textAlign: TextAlign.center,
),
),
),
],
onChanged: onChanged,
),
),
);
}
}