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),
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<Widget> 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,
);
}
}