fix bug where profile view would be too wide

This commit is contained in:
zoe 2022-09-26 20:05:44 +02:00
parent 429cca8ddb
commit 4d2a45ad6c
1 changed files with 62 additions and 68 deletions

View File

@ -180,70 +180,69 @@ class _ProfileViewState extends State<ProfileView> {
), ),
contentPadding: const EdgeInsets.all(0), contentPadding: const EdgeInsets.all(0),
children: [ children: [
Column(children: [ Container(
loading constraints: global.getConstraints(context),
? Column( child: Column(children: [
children: [ loading
SelectableText( ? Column(
"${"found-account-on".i18n()} ${identities.length} ${identities.length <= 1 ? "instance" : "instances".i18n()}"), children: [
const LinearProgressIndicator(), SelectableText(
], "${"found-account-on".i18n()} ${identities.length} ${identities.length <= 1 ? "instance" : "instances".i18n()}"),
) const LinearProgressIndicator(),
: Row( ],
mainAxisAlignment: MainAxisAlignment.center, )
children: [ : Row(
DropdownButtonHideUnderline( mainAxisAlignment: MainAxisAlignment.center,
child: DropdownButton( children: [
isExpanded: false, DropdownButtonHideUnderline(
alignment: Alignment.center, child: DropdownButton(
iconEnabledColor: isExpanded: false,
Theme.of(context).colorScheme.onSurface, alignment: Alignment.center,
value: activeIdentity, iconEnabledColor:
items: dmenuItems, Theme.of(context).colorScheme.onSurface,
onChanged: (value) { value: activeIdentity,
setState(() { items: dmenuItems,
activeIdentity = value.toString(); onChanged: (value) {
}); setState(() {
reloadPosts(); 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( controller: _scrollController,
constraints: global.getConstraints(context), itemCount: threads.length + 2,
width: global.getWidth(context) + itemBuilder: (context, index) {
MediaQuery.of(context).size.width * 0.2, if (index == 0) {
height: MediaQuery.of(context).size.height * 2 / 3, return profileViewDisplay;
child: ListView.separated( } else if (index > 0 && index <= threads.length) {
separatorBuilder: (context, index) => const Divider( return Padding(
color: Colors.transparent, padding: const EdgeInsets.symmetric(
height: themes.defaultSeperatorHeight, horizontal: themes.defaultSeperatorHeight * 2),
), child: Thread(
controller: _scrollController, model: threads[index - 1],
itemCount: threads.length + 2, constrained: false,
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,
),
);
}
return const LoadingBox(); return const LoadingBox();
}, },
),
), ),
), ]),
]), ),
], ],
), ),
); );
@ -360,7 +359,6 @@ class ProfileViewDisplay extends StatelessWidget {
List<Widget> c = [ List<Widget> c = [
if (!(accountModel.header.endsWith("/headers/original/missing.png"))) if (!(accountModel.header.endsWith("/headers/original/missing.png")))
Image.network( Image.network(
width: global.getWidth(context),
fit: BoxFit.fitWidth, fit: BoxFit.fitWidth,
accountModel.header, accountModel.header,
errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(), errorBuilder: (context, error, stackTrace) => const SizedBox.shrink(),
@ -388,13 +386,9 @@ class ProfileViewDisplay extends StatelessWidget {
), ),
]; ];
return Container( return Column(
constraints: global.getConstraints(context), crossAxisAlignment: CrossAxisAlignment.stretch,
width: global.getWidth(context), children: c,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: c,
),
); );
} }
} }