From 8242e5a5b8913e7dee85e8d222a7a7eb051fc1c9 Mon Sep 17 00:00:00 2001 From: jld3103 Date: Tue, 31 Oct 2023 16:14:33 +0100 Subject: [PATCH] refactor(neon,neon_files): Remove unnecessary Scrollbars Signed-off-by: jld3103 --- packages/neon/neon/lib/src/pages/login.dart | 110 +++++++++--------- .../neon/neon_files/lib/pages/details.dart | 100 ++++++++-------- 2 files changed, 103 insertions(+), 107 deletions(-) diff --git a/packages/neon/neon/lib/src/pages/login.dart b/packages/neon/neon/lib/src/pages/login.dart index 338370c3..0a399f59 100644 --- a/packages/neon/neon/lib/src/pages/login.dart +++ b/packages/neon/neon/lib/src/pages/login.dart @@ -54,71 +54,69 @@ class _LoginPageState extends State { body: Center( child: ConstrainedBox( constraints: NeonDialogTheme.of(context).constraints, - child: Scrollbar( - child: SingleChildScrollView( - padding: const EdgeInsets.all(10), - primary: true, - child: Column( - children: [ - ExcludeSemantics( - child: branding.logo, + child: SingleChildScrollView( + padding: const EdgeInsets.all(10), + primary: true, + child: Column( + children: [ + ExcludeSemantics( + child: branding.logo, + ), + Text( + branding.name, + style: Theme.of(context).textTheme.titleLarge, + ), + if (branding.showLoginWithNextcloud) ...[ + const SizedBox( + height: 10, ), - Text( - branding.name, - style: Theme.of(context).textTheme.titleLarge, + Text(NeonLocalizations.of(context).loginWorksWith), + const SizedBox( + height: 10, ), - if (branding.showLoginWithNextcloud) ...[ - const SizedBox( - height: 10, - ), - Text(NeonLocalizations.of(context).loginWorksWith), - const SizedBox( - height: 10, - ), - Semantics( - label: NeonLocalizations.of(context).nextcloud, - child: const NextcloudLogo(), + Semantics( + label: NeonLocalizations.of(context).nextcloud, + child: const NextcloudLogo(), + ), + ], + const SizedBox( + height: 50, + ), + Form( + key: _formKey, + child: TextFormField( + focusNode: _focusNode, + controller: _controller, + decoration: InputDecoration( + hintText: 'https://...', + labelText: NeonLocalizations.of(context).loginUsingServerAddress, + suffixIcon: IconButton( + icon: const Icon(Icons.arrow_forward), + onPressed: () { + login(_controller.text); + }, + ), ), - ], + keyboardType: TextInputType.url, + validator: (final input) => validateHttpUrl(context, input), + onFieldSubmitted: login, + autofillHints: const [AutofillHints.url], + ), + ), + if (NeonPlatform.instance.canUseCamera) ...[ const SizedBox( height: 50, ), - Form( - key: _formKey, - child: TextFormField( - focusNode: _focusNode, - controller: _controller, - decoration: InputDecoration( - hintText: 'https://...', - labelText: NeonLocalizations.of(context).loginUsingServerAddress, - suffixIcon: IconButton( - icon: const Icon(Icons.arrow_forward), - onPressed: () { - login(_controller.text); - }, - ), - ), - keyboardType: TextInputType.url, - validator: (final input) => validateHttpUrl(context, input), - onFieldSubmitted: login, - autofillHints: const [AutofillHints.url], + IconButton( + tooltip: NeonLocalizations.of(context).loginUsingQRcode, + icon: const Icon( + Icons.qr_code_scanner_rounded, + size: 60, ), + onPressed: () => const LoginQRcodeRoute().go(context), ), - if (NeonPlatform.instance.canUseCamera) ...[ - const SizedBox( - height: 50, - ), - IconButton( - tooltip: NeonLocalizations.of(context).loginUsingQRcode, - icon: const Icon( - Icons.qr_code_scanner_rounded, - size: 60, - ), - onPressed: () => const LoginQRcodeRoute().go(context), - ), - ], ], - ), + ], ), ), ), diff --git a/packages/neon/neon_files/lib/pages/details.dart b/packages/neon/neon_files/lib/pages/details.dart index 74c9c70d..9cbc5ded 100644 --- a/packages/neon/neon_files/lib/pages/details.dart +++ b/packages/neon/neon_files/lib/pages/details.dart @@ -16,61 +16,59 @@ class FilesDetailsPage extends StatelessWidget { appBar: AppBar( title: Text(details.name), ), - body: Scrollbar( - child: ListView( - primary: true, - children: [ - ColoredBox( - color: Theme.of(context).colorScheme.primary, - child: FilePreview( - bloc: bloc, - details: details, - color: Theme.of(context).colorScheme.onPrimary, - size: Size( - MediaQuery.of(context).size.width, - MediaQuery.of(context).size.height / 4, - ), + body: ListView( + primary: true, + children: [ + ColoredBox( + color: Theme.of(context).colorScheme.primary, + child: FilePreview( + bloc: bloc, + details: details, + color: Theme.of(context).colorScheme.onPrimary, + size: Size( + MediaQuery.of(context).size.width, + MediaQuery.of(context).size.height / 4, ), ), - DataTable( - headingRowHeight: 0, - columns: const [ - DataColumn(label: SizedBox()), - DataColumn(label: SizedBox()), - ], - rows: [ - for (final entry in { + ), + DataTable( + headingRowHeight: 0, + columns: const [ + DataColumn(label: SizedBox()), + DataColumn(label: SizedBox()), + ], + rows: [ + for (final entry in { + details.isDirectory + ? FilesLocalizations.of(context).detailsFolderName + : FilesLocalizations.of(context).detailsFileName: details.name, + FilesLocalizations.of(context).detailsParentFolder: + details.path.length == 1 ? '/' : details.path.sublist(0, details.path.length - 1).join('/'), + if (details.size != null) ...{ details.isDirectory - ? FilesLocalizations.of(context).detailsFolderName - : FilesLocalizations.of(context).detailsFileName: details.name, - FilesLocalizations.of(context).detailsParentFolder: - details.path.length == 1 ? '/' : details.path.sublist(0, details.path.length - 1).join('/'), - if (details.size != null) ...{ - details.isDirectory - ? FilesLocalizations.of(context).detailsFolderSize - : FilesLocalizations.of(context).detailsFileSize: filesize(details.size, 1), - }, - if (details.lastModified != null) ...{ - FilesLocalizations.of(context).detailsLastModified: - details.lastModified!.toLocal().toIso8601String(), - }, - if (details.isFavorite != null) ...{ - FilesLocalizations.of(context).detailsIsFavorite: details.isFavorite! - ? FilesLocalizations.of(context).actionYes - : FilesLocalizations.of(context).actionNo, - }, - }.entries) ...[ - DataRow( - cells: [ - DataCell(Text(entry.key)), - DataCell(Text(entry.value)), - ], - ), - ], + ? FilesLocalizations.of(context).detailsFolderSize + : FilesLocalizations.of(context).detailsFileSize: filesize(details.size, 1), + }, + if (details.lastModified != null) ...{ + FilesLocalizations.of(context).detailsLastModified: + details.lastModified!.toLocal().toIso8601String(), + }, + if (details.isFavorite != null) ...{ + FilesLocalizations.of(context).detailsIsFavorite: details.isFavorite! + ? FilesLocalizations.of(context).actionYes + : FilesLocalizations.of(context).actionNo, + }, + }.entries) ...[ + DataRow( + cells: [ + DataCell(Text(entry.key)), + DataCell(Text(entry.value)), + ], + ), ], - ), - ], - ), + ], + ), + ], ), ); }