wrap select server page in safe area

This commit is contained in:
Henry Hiles 2026-07-19 00:20:04 -04:00
commit 8f3f9fbef1
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

View file

@ -59,109 +59,111 @@ class SelectServerPage extends HookConsumerWidget {
return Scaffold( return Scaffold(
appBar: Appbar(), appBar: Appbar(),
body: Center( body: SafeArea(
child: ConstrainedBox( child: Center(
constraints: .new(maxWidth: 600), child: ConstrainedBox(
child: ListView( constraints: .new(maxWidth: 600),
padding: .symmetric(vertical: 8, horizontal: 12), child: ListView(
children: [ padding: .symmetric(vertical: 8, horizontal: 12),
Row( children: [
children: [ Row(
SvgPicture.asset("assets/icon.svg", width: 128), children: [
SizedBox(width: 12), SvgPicture.asset("assets/icon.svg", width: 128),
Expanded( SizedBox(width: 12),
child: Column( Expanded(
crossAxisAlignment: .start, child: Column(
children: [ crossAxisAlignment: .start,
Text("Nexus", style: theme.textTheme.displayMedium), children: [
Text( Text("Nexus", style: theme.textTheme.displayMedium),
"A Simple Matrix Client", Text(
style: theme.textTheme.headlineMedium, "A Simple Matrix Client",
overflow: .ellipsis, style: theme.textTheme.headlineMedium,
), overflow: .ellipsis,
], ),
],
),
), ),
],
),
Padding(padding: .symmetric(vertical: 12), child: Divider()),
DividerText("Enter a homeserver domain:"),
Row(
spacing: 8,
children: [
Expanded(
child: TextField(
textInputAction: .done,
autofocus: true,
onSubmitted: (text) => setHomeserver(.tryParse(text)),
controller: homeserverUrl,
decoration: .new(
labelText: "Homeserver URL",
hintText: "matrix.org",
),
),
),
IconButton.filled(
tooltip: "Confirm homeserver choice",
onPressed: isLoading.value
? null
: () => setHomeserver(.tryParse(homeserverUrl.text)),
icon: Icon(Icons.check),
),
],
),
DividerText("Or, choose from some popular homeservers:"),
...(<Homeserver>[
.new(
name: "Matrix.org",
description:
"The Matrix.org Foundation offers the matrix.org homeserver as an easy entry point for anyone wanting to try out Matrix.",
url: .https("matrix.org"),
iconUrl:
"https://raw.githubusercontent.com/element-hq/logos/refs/heads/master/matrix/matrix-favicon${Theme.brightnessOf(context) == Brightness.dark ? "-white" : ""}.png",
), ),
], .new(
), name: "Federated Nexus",
Padding(padding: .symmetric(vertical: 12), child: Divider()), description:
DividerText("Enter a homeserver domain:"), "Federated Nexus is a community resource hosting multiple FOSS (especially federated) services, including Matrix and Forgejo. By the same developers who made Nexus client.",
Row( url: .https("federated.nexus"),
spacing: 8, iconUrl: "https://federated.nexus/images/icon.png",
children: [ ),
Expanded( .new(
child: TextField( name: "Unredacted",
textInputAction: .done, description:
autofocus: true, "Unredacted is a 501(c)(3) non-profit organization that builds Internet infrastructure and services to help people evade censorship and protect their right to privacy.",
onSubmitted: (text) => setHomeserver(.tryParse(text)), url: .https("unredacted.org", "services/si/matrix"),
controller: homeserverUrl, iconUrl: "https://unredacted.org/favicon.ico",
decoration: .new( ),
labelText: "Homeserver URL", ].map(
hintText: "matrix.org", (homeserver) => Card(
child: ListTile(
enabled: !isLoading.value,
title: Text(homeserver.name),
leading: Image.network(
homeserver.iconUrl,
errorBuilder: (_, _, _) => SizedBox.shrink(),
height: 32,
),
subtitle: Text(homeserver.description),
onTap: isLoading.value
? null
: () => setHomeserver(homeserver.url),
trailing: IconButton(
tooltip: "Launch homeserver info page",
onPressed: () => launch(homeserver.url),
icon: Icon(Icons.info_outline),
), ),
), ),
), ),
IconButton.filled( )),
tooltip: "Confirm homeserver choice",
onPressed: isLoading.value
? null
: () => setHomeserver(.tryParse(homeserverUrl.text)),
icon: Icon(Icons.check),
),
],
),
DividerText("Or, choose from some popular homeservers:"),
...(<Homeserver>[
.new(
name: "Matrix.org",
description:
"The Matrix.org Foundation offers the matrix.org homeserver as an easy entry point for anyone wanting to try out Matrix.",
url: .https("matrix.org"),
iconUrl:
"https://raw.githubusercontent.com/element-hq/logos/refs/heads/master/matrix/matrix-favicon${Theme.brightnessOf(context) == Brightness.dark ? "-white" : ""}.png",
),
.new(
name: "Federated Nexus",
description:
"Federated Nexus is a community resource hosting multiple FOSS (especially federated) services, including Matrix and Forgejo. By the same developers who made Nexus client.",
url: .https("federated.nexus"),
iconUrl: "https://federated.nexus/images/icon.png",
),
.new(
name: "Unredacted",
description:
"Unredacted is a 501(c)(3) non-profit organization that builds Internet infrastructure and services to help people evade censorship and protect their right to privacy.",
url: .https("unredacted.org", "services/si/matrix"),
iconUrl: "https://unredacted.org/favicon.ico",
),
].map(
(homeserver) => Card(
child: ListTile(
enabled: !isLoading.value,
title: Text(homeserver.name),
leading: Image.network(
homeserver.iconUrl,
errorBuilder: (_, _, _) => SizedBox.shrink(),
height: 32,
),
subtitle: Text(homeserver.description),
onTap: isLoading.value
? null
: () => setHomeserver(homeserver.url),
trailing: IconButton(
tooltip: "Launch homeserver info page",
onPressed: () => launch(homeserver.url),
icon: Icon(Icons.info_outline),
),
),
),
)),
TextButton( TextButton(
onPressed: () => launch(.https("servers.joinmatrix.org")), onPressed: () => launch(.https("servers.joinmatrix.org")),
child: Text("See more homeservers..."), child: Text("See more homeservers..."),
), ),
], ],
),
), ),
), ),
), ),