From f2ce208e96fa26123aebfb86a254e699c4cbd166 Mon Sep 17 00:00:00 2001 From: jokimina Date: Sun, 4 Jun 2023 10:56:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=AA=97=E5=8F=A3=E5=A4=A7=E5=B0=8F?= =?UTF-8?q?=E5=8F=98=E5=8C=96=E6=97=B6prompt=E8=83=8C=E6=99=AF=E8=89=B2?= =?UTF-8?q?=E9=97=AA=E7=83=81=20#13?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/components/prompts.dart | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/components/prompts.dart b/lib/components/prompts.dart index 0e7d1ce..651484c 100644 --- a/lib/components/prompts.dart +++ b/lib/components/prompts.dart @@ -7,8 +7,13 @@ import 'package:get/get.dart'; class PromptsView extends GetResponsiveView { final List prompts; final ValueChanged onPromptClick; + final promptBgColorMap = {}; - PromptsView(this.prompts, this.onPromptClick); + PromptsView(this.prompts, this.onPromptClick, {super.key}) { + for (var element in prompts) { + promptBgColorMap[element.act] = getRandomColor() as Color; + } + } final _scrollController = ScrollController(); @@ -27,7 +32,7 @@ class PromptsView extends GetResponsiveView { margin: const EdgeInsets.all(8), padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: getRandomColor() as Color, + color: promptBgColorMap[prompts[index].act], borderRadius: BorderRadius.circular(8), ), child: Column( @@ -72,7 +77,7 @@ class PromptsView extends GetResponsiveView { margin: const EdgeInsets.all(8), padding: const EdgeInsets.all(8), decoration: BoxDecoration( - color: getRandomColor() as Color, + color: promptBgColorMap[prompts[index].act], borderRadius: BorderRadius.circular(8), ), child: Column(