implement dynamic zone label and title shared component

This commit is contained in:
WilsonLe 2024-08-07 11:27:22 -04:00
parent 49921e47e4
commit c193c928a1
5 changed files with 82 additions and 88 deletions

View file

@ -1,5 +1,7 @@
import 'package:fluffychat/pangea/models/bot_options_model.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_custom_system_prompt_input.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_dynamic_zone_label.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_dynamic_zone_title.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -18,32 +20,12 @@ class ConversationBotCustomZone extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
children: [
const SizedBox(height: 12),
Text(
L10n.of(context)!.conversationBotCustomZone_title,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
ConversationBotDynamicZoneTitle(
title: L10n.of(context)!.conversationBotCustomZone_title,
),
const Divider(
color: Colors.grey,
thickness: 1,
),
const SizedBox(height: 12),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 0, 0),
child: Text(
L10n.of(context)!
.conversationBotCustomZone_customSystemPromptLabel,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
),
ConversationBotDynamicZoneLabel(
label: L10n.of(context)!
.conversationBotCustomZone_customSystemPromptLabel,
),
Padding(
padding: const EdgeInsets.all(8),

View file

@ -1,6 +1,8 @@
import 'package:fluffychat/pangea/models/bot_options_model.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_discussion_keywords_input.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_discussion_topic_input.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_dynamic_zone_label.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_dynamic_zone_title.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -19,32 +21,12 @@ class ConversationBotDiscussionZone extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
children: [
const SizedBox(height: 12),
Text(
L10n.of(context)!.conversationBotDiscussionZone_title,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
ConversationBotDynamicZoneTitle(
title: L10n.of(context)!.conversationBotDiscussionZone_title,
),
const Divider(
color: Colors.grey,
thickness: 1,
),
const SizedBox(height: 12),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 0, 0),
child: Text(
L10n.of(context)!
.conversationBotDiscussionZone_discussionTopicLabel,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
),
ConversationBotDynamicZoneLabel(
label: L10n.of(context)!
.conversationBotDiscussionZone_discussionTopicLabel,
),
Padding(
padding: const EdgeInsets.all(8),
@ -54,19 +36,9 @@ class ConversationBotDiscussionZone extends StatelessWidget {
),
),
const SizedBox(height: 12),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 0, 0),
child: Text(
L10n.of(context)!
.conversationBotDiscussionZone_discussionKeywordsLabel,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
),
ConversationBotDynamicZoneLabel(
label: L10n.of(context)!
.conversationBotDiscussionZone_discussionKeywordsLabel,
),
Padding(
padding: const EdgeInsets.all(8),

View file

@ -0,0 +1,27 @@
import 'package:flutter/material.dart';
class ConversationBotDynamicZoneLabel extends StatelessWidget {
final String label;
const ConversationBotDynamicZoneLabel({
super.key,
required this.label,
});
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 0, 0),
child: Text(
label,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
),
);
}
}

View file

@ -0,0 +1,31 @@
import 'package:flutter/material.dart';
class ConversationBotDynamicZoneTitle extends StatelessWidget {
final String title;
const ConversationBotDynamicZoneTitle({
super.key,
required this.title,
});
@override
Widget build(BuildContext context) {
return Column(
children: [
const SizedBox(height: 12),
Text(
title,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
const Divider(
color: Colors.grey,
thickness: 1,
),
const SizedBox(height: 12),
],
);
}
}

View file

@ -1,4 +1,6 @@
import 'package:fluffychat/pangea/models/bot_options_model.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_dynamic_zone_label.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_dynamic_zone_title.dart';
import 'package:fluffychat/pangea/widgets/conversation_bot/conversation_bot_text_adventure_game_master_instruction_input.dart';
import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
@ -18,32 +20,12 @@ class ConversationBotTextAdventureZone extends StatelessWidget {
Widget build(BuildContext context) {
return Column(
children: [
const SizedBox(height: 12),
Text(
L10n.of(context)!.conversationBotTextAdventureZone_title,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
ConversationBotDynamicZoneTitle(
title: L10n.of(context)!.conversationBotTextAdventureZone_title,
),
const Divider(
color: Colors.grey,
thickness: 1,
),
const SizedBox(height: 12),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.fromLTRB(12, 0, 0, 0),
child: Text(
L10n.of(context)!
.conversationBotTextAdventureZone_instructionLabel,
style: TextStyle(
color: Theme.of(context).colorScheme.secondary,
fontWeight: FontWeight.bold,
),
),
),
ConversationBotDynamicZoneLabel(
label: L10n.of(context)!
.conversationBotTextAdventureZone_instructionLabel,
),
Padding(
padding: const EdgeInsets.all(8),