Fix: Rendering Overflow

master
Rafael 2024-07-12 22:55:41 +02:00
parent a3705aab95
commit 00e3ae0ac2
2 changed files with 63 additions and 51 deletions

View File

@ -24,56 +24,58 @@ class MatchedScreen extends StatelessWidget {
appBar: AppBar(title: const Text('It\'s a Match!')), appBar: AppBar(title: const Text('It\'s a Match!')),
body: Padding( body: Padding(
padding: const EdgeInsets.all(16.0), padding: const EdgeInsets.all(16.0),
child: Column( child: SingleChildScrollView(
mainAxisAlignment: MainAxisAlignment.center, child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.center,
Text( children: [
'You and $otherUserName have liked each other!', Text(
style: const TextStyle(fontSize: 24), 'You and $otherUserName have liked each other!',
textAlign: TextAlign.center, style: const TextStyle(fontSize: 24),
), textAlign: TextAlign.center,
const SizedBox(height: 24), ),
Row( const SizedBox(height: 24),
mainAxisAlignment: MainAxisAlignment.center, Row(
children: [ mainAxisAlignment: MainAxisAlignment.center,
CircleAvatar( children: [
backgroundImage: (currentUserImageUrl.isEmpty) CircleAvatar(
? null backgroundImage: (currentUserImageUrl.isEmpty)
: NetworkImage(currentUserImageUrl), ? null
radius: 50, : NetworkImage(currentUserImageUrl),
child: (currentUserImageUrl.isEmpty) radius: 50,
? const Icon(Icons.person, size: 50) child: (currentUserImageUrl.isEmpty)
: null, ? const Icon(Icons.person, size: 50)
), : null,
const SizedBox(width: 24), ),
CircleAvatar( const SizedBox(width: 24),
backgroundImage: (otherUserImageUrl.isEmpty) CircleAvatar(
? null backgroundImage: (otherUserImageUrl.isEmpty)
: NetworkImage(otherUserImageUrl), ? null
radius: 50, : NetworkImage(otherUserImageUrl),
child: (otherUserImageUrl.isEmpty) radius: 50,
? const Icon(Icons.person, size: 50) child: (otherUserImageUrl.isEmpty)
: null, ? const Icon(Icons.person, size: 50)
), : null,
], ),
), ],
const SizedBox(height: 24), ),
Text( const SizedBox(height: 24),
'$currentUserName and $otherUserName', Text(
style: const TextStyle(fontSize: 20), '$currentUserName and $otherUserName',
textAlign: TextAlign.center, style: const TextStyle(fontSize: 20),
), textAlign: TextAlign.center,
const SizedBox(height: 24), ),
ElevatedButton( const SizedBox(height: 24),
onPressed: onMessageButtonPressed, ElevatedButton(
child: const Text('Send a Message'), onPressed: onMessageButtonPressed,
), child: const Text('Send a Message'),
const SizedBox(height: 16), ),
ElevatedButton( const SizedBox(height: 16),
onPressed: onContinueButtonPressed, ElevatedButton(
child: const Text('Continue Swiping'), onPressed: onContinueButtonPressed,
), child: const Text('Continue Swiping'),
], ),
],
),
), ),
), ),
); );

View File

@ -101,7 +101,17 @@ class _ChatPageState extends State<ChatPage> {
} }
if (userPic != null) { if (userPic != null) {
chatHeader = Row( 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,
),
),
],
); );
} }