refactor: Remove unnecessary setState in ChatPage for better performance

This commit is contained in:
krille-chan 2023-12-23 07:38:45 +01:00
commit 63d7bef515
No known key found for this signature in database
3 changed files with 221 additions and 214 deletions

View file

@ -105,7 +105,7 @@ class ChatInputRow extends StatelessWidget {
duration: FluffyThemes.animationDuration,
curve: FluffyThemes.animationCurve,
height: 56,
width: controller.inputText.isEmpty ? 56 : 0,
width: controller.sendController.text.isEmpty ? 56 : 0,
alignment: Alignment.center,
clipBehavior: Clip.hardEdge,
decoration: const BoxDecoration(),
@ -268,7 +268,7 @@ class ChatInputRow extends StatelessWidget {
),
),
if (PlatformInfos.platformCanRecord &&
controller.inputText.isEmpty)
controller.sendController.text.isEmpty)
Container(
height: 56,
alignment: Alignment.center,
@ -278,7 +278,8 @@ class ChatInputRow extends StatelessWidget {
onPressed: controller.voiceMessageAction,
),
),
if (!PlatformInfos.isMobile || controller.inputText.isNotEmpty)
if (!PlatformInfos.isMobile ||
controller.sendController.text.isNotEmpty)
Container(
height: 56,
alignment: Alignment.center,