fix: Add missing SafeArea to homeserver picker

This commit is contained in:
Christian Pauly 2022-08-10 21:16:06 +02:00
parent da66d6e400
commit 587c4210f4
1 changed files with 109 additions and 107 deletions

View File

@ -46,123 +46,125 @@ class HomeserverPickerView extends StatelessWidget {
), ),
], ],
), ),
body: Column( body: SafeArea(
children: [ child: Column(
// display a prominent banner to import session for TOR browser children: [
// users. This feature is just some UX sugar as TOR users are // display a prominent banner to import session for TOR browser
// usually forced to logout as TOR browser is non-persistent // users. This feature is just some UX sugar as TOR users are
AnimatedContainer( // usually forced to logout as TOR browser is non-persistent
height: controller.isTorBrowser ? 64 : 0, AnimatedContainer(
duration: const Duration(milliseconds: 300), height: controller.isTorBrowser ? 64 : 0,
clipBehavior: Clip.hardEdge, duration: const Duration(milliseconds: 300),
curve: Curves.bounceInOut,
decoration: const BoxDecoration(),
child: Material(
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
borderRadius: curve: Curves.bounceInOut,
const BorderRadius.vertical(bottom: Radius.circular(8)), decoration: const BoxDecoration(),
color: Theme.of(context).colorScheme.surface, child: Material(
child: ListTile( clipBehavior: Clip.hardEdge,
leading: const Icon(Icons.vpn_key), borderRadius:
title: Text(L10n.of(context)!.hydrateTor), const BorderRadius.vertical(bottom: Radius.circular(8)),
subtitle: Text(L10n.of(context)!.hydrateTorLong), color: Theme.of(context).colorScheme.surface,
trailing: const Icon(Icons.chevron_right_outlined), child: ListTile(
onTap: controller.restoreBackup, leading: const Icon(Icons.vpn_key),
title: Text(L10n.of(context)!.hydrateTor),
subtitle: Text(L10n.of(context)!.hydrateTorLong),
trailing: const Icon(Icons.chevron_right_outlined),
onTap: controller.restoreBackup,
),
), ),
), ),
), Expanded(
Expanded( child: ListView(
child: ListView( children: [
children: [ Container(
Container( alignment: Alignment.center,
alignment: Alignment.center, height: 200,
height: 200, child: Image.asset('assets/info-logo.png'),
child: Image.asset('assets/info-logo.png'),
),
Padding(
padding: const EdgeInsets.all(12.0),
child: TextField(
focusNode: controller.homeserverFocusNode,
controller: controller.homeserverController,
onChanged: controller.onChanged,
decoration: InputDecoration(
prefixText: '${L10n.of(context)!.homeserver}: ',
hintText: L10n.of(context)!.enterYourHomeserver,
suffixIcon: const Icon(Icons.search),
errorText: controller.error,
fillColor: Theme.of(context)
.colorScheme
.background
.withOpacity(0.75),
),
readOnly: !AppConfig.allowOtherHomeservers,
onSubmitted: (_) => controller.checkHomeserverAction(),
autocorrect: false,
), ),
),
if (controller.displayServerList)
Padding( Padding(
padding: const EdgeInsets.all(12.0), padding: const EdgeInsets.all(12.0),
child: Material( child: TextField(
borderRadius: focusNode: controller.homeserverFocusNode,
BorderRadius.circular(AppConfig.borderRadius), controller: controller.homeserverController,
color: Colors.white.withAlpha(200), onChanged: controller.onChanged,
clipBehavior: Clip.hardEdge, decoration: InputDecoration(
child: benchmarkResults == null prefixText: '${L10n.of(context)!.homeserver}: ',
? const Center( hintText: L10n.of(context)!.enterYourHomeserver,
child: Padding( suffixIcon: const Icon(Icons.search),
padding: EdgeInsets.all(12.0), errorText: controller.error,
child: CircularProgressIndicator.adaptive(), fillColor: Theme.of(context)
)) .colorScheme
: Column( .background
children: controller.filteredHomeservers .withOpacity(0.75),
.map( ),
(server) => ListTile( readOnly: !AppConfig.allowOtherHomeservers,
trailing: IconButton( onSubmitted: (_) => controller.checkHomeserverAction(),
icon: const Icon( autocorrect: false,
Icons.info_outlined,
color: Colors.black,
),
onPressed: () =>
controller.showServerInfo(server),
),
onTap: () => controller.setServer(
server.homeserver.baseUrl.host),
title: Text(
server.homeserver.baseUrl.host,
style: const TextStyle(
color: Colors.black),
),
subtitle: Text(
server.homeserver.description ?? '',
style: TextStyle(
color: Colors.grey.shade700),
),
),
)
.toList(),
),
), ),
), ),
], if (controller.displayServerList)
), Padding(
), padding: const EdgeInsets.all(12.0),
Container( child: Material(
padding: const EdgeInsets.all(12), borderRadius:
width: double.infinity, BorderRadius.circular(AppConfig.borderRadius),
child: Hero( color: Colors.white.withAlpha(200),
tag: 'loginButton', clipBehavior: Clip.hardEdge,
child: ElevatedButton( child: benchmarkResults == null
onPressed: controller.isLoading ? const Center(
? null child: Padding(
: controller.checkHomeserverAction, padding: EdgeInsets.all(12.0),
child: controller.isLoading child: CircularProgressIndicator.adaptive(),
? const LinearProgressIndicator() ))
: Text(L10n.of(context)!.connect), : Column(
children: controller.filteredHomeservers
.map(
(server) => ListTile(
trailing: IconButton(
icon: const Icon(
Icons.info_outlined,
color: Colors.black,
),
onPressed: () =>
controller.showServerInfo(server),
),
onTap: () => controller.setServer(
server.homeserver.baseUrl.host),
title: Text(
server.homeserver.baseUrl.host,
style: const TextStyle(
color: Colors.black),
),
subtitle: Text(
server.homeserver.description ?? '',
style: TextStyle(
color: Colors.grey.shade700),
),
),
)
.toList(),
),
),
),
],
), ),
), ),
), Container(
], padding: const EdgeInsets.all(12),
width: double.infinity,
child: Hero(
tag: 'loginButton',
child: ElevatedButton(
onPressed: controller.isLoading
? null
: controller.checkHomeserverAction,
child: controller.isLoading
? const LinearProgressIndicator()
: Text(L10n.of(context)!.connect),
),
),
),
],
),
), ),
); );
} }