From 4d2a45ad6cc7622e22626e40800c1873bb37caba Mon Sep 17 00:00:00 2001 From: zoe Date: Mon, 26 Sep 2022 20:05:44 +0200 Subject: [PATCH] fix bug where profile view would be too wide --- lib/dialogues/profile_view.dart | 130 +++++++++++++++----------------- 1 file changed, 62 insertions(+), 68 deletions(-) diff --git a/lib/dialogues/profile_view.dart b/lib/dialogues/profile_view.dart index d4a985d..0209a85 100644 --- a/lib/dialogues/profile_view.dart +++ b/lib/dialogues/profile_view.dart @@ -180,70 +180,69 @@ class _ProfileViewState extends State { ), contentPadding: const EdgeInsets.all(0), children: [ - Column(children: [ - loading - ? Column( - children: [ - SelectableText( - "${"found-account-on".i18n()} ${identities.length} ${identities.length <= 1 ? "instance" : "instances".i18n()}"), - const LinearProgressIndicator(), - ], - ) - : Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - DropdownButtonHideUnderline( - child: DropdownButton( - isExpanded: false, - alignment: Alignment.center, - iconEnabledColor: - Theme.of(context).colorScheme.onSurface, - value: activeIdentity, - items: dmenuItems, - onChanged: (value) { - setState(() { - activeIdentity = value.toString(); - }); - reloadPosts(); - }, + Container( + constraints: global.getConstraints(context), + child: Column(children: [ + loading + ? Column( + children: [ + SelectableText( + "${"found-account-on".i18n()} ${identities.length} ${identities.length <= 1 ? "instance" : "instances".i18n()}"), + const LinearProgressIndicator(), + ], + ) + : Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + DropdownButtonHideUnderline( + child: DropdownButton( + isExpanded: false, + alignment: Alignment.center, + iconEnabledColor: + Theme.of(context).colorScheme.onSurface, + value: activeIdentity, + items: dmenuItems, + onChanged: (value) { + setState(() { + activeIdentity = value.toString(); + }); + reloadPosts(); + }, + ), ), - ), - ], + ], + ), + SizedBox( + // constraints: global.getConstraints(context), + width: global.getWidth(context), + height: MediaQuery.of(context).size.height * 2 / 3, + child: ListView.separated( + separatorBuilder: (context, index) => const Divider( + color: Colors.transparent, + height: themes.defaultSeperatorHeight, ), - Container( - constraints: global.getConstraints(context), - width: global.getWidth(context) + - MediaQuery.of(context).size.width * 0.2, - height: MediaQuery.of(context).size.height * 2 / 3, - child: ListView.separated( - separatorBuilder: (context, index) => const Divider( - color: Colors.transparent, - height: themes.defaultSeperatorHeight, - ), - controller: _scrollController, - itemCount: threads.length + 2, - itemBuilder: (context, index) { - if (index == 0) { - return profileViewDisplay; - } else if (index > 0 && index <= threads.length) { - return Padding( - padding: const EdgeInsets.fromLTRB( - themes.defaultSeperatorHeight * 2, - 0, - themes.defaultSeperatorHeight * 2, - 0), - child: Thread( - model: threads[index - 1], - constrained: false, - ), - ); - } + controller: _scrollController, + itemCount: threads.length + 2, + itemBuilder: (context, index) { + if (index == 0) { + return profileViewDisplay; + } else if (index > 0 && index <= threads.length) { + return Padding( + padding: const EdgeInsets.symmetric( + horizontal: themes.defaultSeperatorHeight * 2), + child: Thread( + model: threads[index - 1], + constrained: false, + ), + ); + } - return const LoadingBox(); - }, + return const LoadingBox(); + }, + ), ), - ), - ]), + ]), + ), ], ), ); @@ -360,7 +359,6 @@ class ProfileViewDisplay extends StatelessWidget { List c = [ if (!(accountModel.header.endsWith("/headers/original/missing.png"))) Image.network( - width: global.getWidth(context), fit: BoxFit.fitWidth, accountModel.header, errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(), @@ -388,13 +386,9 @@ class ProfileViewDisplay extends StatelessWidget { ), ]; - return Container( - constraints: global.getConstraints(context), - width: global.getWidth(context), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - children: c, - ), + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: c, ); } }