From 00e3ae0ac2831cfd57a08dc90b4f27a065054c28 Mon Sep 17 00:00:00 2001 From: Rafael <1024481@stud.hs-mannheim.de> Date: Fri, 12 Jul 2024 22:55:41 +0200 Subject: [PATCH] Fix: Rendering Overflow --- lib/forms/matched_screen.dart | 102 +++++++++++++++++----------------- lib/pages/chat_page.dart | 12 +++- 2 files changed, 63 insertions(+), 51 deletions(-) diff --git a/lib/forms/matched_screen.dart b/lib/forms/matched_screen.dart index 62743c3..7eb0b3c 100644 --- a/lib/forms/matched_screen.dart +++ b/lib/forms/matched_screen.dart @@ -24,56 +24,58 @@ class MatchedScreen extends StatelessWidget { appBar: AppBar(title: const Text('It\'s a Match!')), body: Padding( padding: const EdgeInsets.all(16.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - 'You and $otherUserName have liked each other!', - style: const TextStyle(fontSize: 24), - textAlign: TextAlign.center, - ), - const SizedBox(height: 24), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - CircleAvatar( - backgroundImage: (currentUserImageUrl.isEmpty) - ? null - : NetworkImage(currentUserImageUrl), - radius: 50, - child: (currentUserImageUrl.isEmpty) - ? const Icon(Icons.person, size: 50) - : null, - ), - const SizedBox(width: 24), - CircleAvatar( - backgroundImage: (otherUserImageUrl.isEmpty) - ? null - : NetworkImage(otherUserImageUrl), - radius: 50, - child: (otherUserImageUrl.isEmpty) - ? const Icon(Icons.person, size: 50) - : null, - ), - ], - ), - const SizedBox(height: 24), - Text( - '$currentUserName and $otherUserName', - style: const TextStyle(fontSize: 20), - textAlign: TextAlign.center, - ), - const SizedBox(height: 24), - ElevatedButton( - onPressed: onMessageButtonPressed, - child: const Text('Send a Message'), - ), - const SizedBox(height: 16), - ElevatedButton( - onPressed: onContinueButtonPressed, - child: const Text('Continue Swiping'), - ), - ], + child: SingleChildScrollView( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + 'You and $otherUserName have liked each other!', + style: const TextStyle(fontSize: 24), + textAlign: TextAlign.center, + ), + const SizedBox(height: 24), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + CircleAvatar( + backgroundImage: (currentUserImageUrl.isEmpty) + ? null + : NetworkImage(currentUserImageUrl), + radius: 50, + child: (currentUserImageUrl.isEmpty) + ? const Icon(Icons.person, size: 50) + : null, + ), + const SizedBox(width: 24), + CircleAvatar( + backgroundImage: (otherUserImageUrl.isEmpty) + ? null + : NetworkImage(otherUserImageUrl), + radius: 50, + child: (otherUserImageUrl.isEmpty) + ? const Icon(Icons.person, size: 50) + : null, + ), + ], + ), + const SizedBox(height: 24), + Text( + '$currentUserName and $otherUserName', + style: const TextStyle(fontSize: 20), + textAlign: TextAlign.center, + ), + const SizedBox(height: 24), + ElevatedButton( + onPressed: onMessageButtonPressed, + child: const Text('Send a Message'), + ), + const SizedBox(height: 16), + ElevatedButton( + onPressed: onContinueButtonPressed, + child: const Text('Continue Swiping'), + ), + ], + ), ), ), ); diff --git a/lib/pages/chat_page.dart b/lib/pages/chat_page.dart index 3f70d29..0bfd22b 100644 --- a/lib/pages/chat_page.dart +++ b/lib/pages/chat_page.dart @@ -101,7 +101,17 @@ class _ChatPageState extends State { } if (userPic != null) { chatHeader = Row( - children: [userPic, const SizedBox(width: 7), Text(widget.chatTitle)], + children: [ + userPic, + const SizedBox(width: 7), + Flexible( + child: Text( + widget.chatTitle, + overflow: TextOverflow.ellipsis, + maxLines: 2, + ), + ), + ], ); }