Browse Source

refactor(neon,neon_files): Remove unnecessary Scrollbars

Signed-off-by: jld3103 <jld3103yt@gmail.com>
pull/1065/head
jld3103 1 year ago
parent
commit
8242e5a5b8
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 110
      packages/neon/neon/lib/src/pages/login.dart
  2. 100
      packages/neon/neon_files/lib/pages/details.dart

110
packages/neon/neon/lib/src/pages/login.dart

@ -54,71 +54,69 @@ class _LoginPageState extends State<LoginPage> {
body: Center( body: Center(
child: ConstrainedBox( child: ConstrainedBox(
constraints: NeonDialogTheme.of(context).constraints, constraints: NeonDialogTheme.of(context).constraints,
child: Scrollbar( child: SingleChildScrollView(
child: SingleChildScrollView( padding: const EdgeInsets.all(10),
padding: const EdgeInsets.all(10), primary: true,
primary: true, child: Column(
child: Column( children: [
children: [ ExcludeSemantics(
ExcludeSemantics( child: branding.logo,
child: branding.logo, ),
Text(
branding.name,
style: Theme.of(context).textTheme.titleLarge,
),
if (branding.showLoginWithNextcloud) ...[
const SizedBox(
height: 10,
), ),
Text( Text(NeonLocalizations.of(context).loginWorksWith),
branding.name, const SizedBox(
style: Theme.of(context).textTheme.titleLarge, height: 10,
), ),
if (branding.showLoginWithNextcloud) ...[ Semantics(
const SizedBox( label: NeonLocalizations.of(context).nextcloud,
height: 10, child: const NextcloudLogo(),
), ),
Text(NeonLocalizations.of(context).loginWorksWith), ],
const SizedBox( const SizedBox(
height: 10, height: 50,
), ),
Semantics( Form(
label: NeonLocalizations.of(context).nextcloud, key: _formKey,
child: const NextcloudLogo(), 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( const SizedBox(
height: 50, height: 50,
), ),
Form( IconButton(
key: _formKey, tooltip: NeonLocalizations.of(context).loginUsingQRcode,
child: TextFormField( icon: const Icon(
focusNode: _focusNode, Icons.qr_code_scanner_rounded,
controller: _controller, size: 60,
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],
), ),
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),
),
],
], ],
), ],
), ),
), ),
), ),

100
packages/neon/neon_files/lib/pages/details.dart

@ -16,61 +16,59 @@ class FilesDetailsPage extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: Text(details.name), title: Text(details.name),
), ),
body: Scrollbar( body: ListView(
child: ListView( primary: true,
primary: true, children: [
children: [ ColoredBox(
ColoredBox( color: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.primary, child: FilePreview(
child: FilePreview( bloc: bloc,
bloc: bloc, details: details,
details: details, color: Theme.of(context).colorScheme.onPrimary,
color: Theme.of(context).colorScheme.onPrimary, size: Size(
size: Size( MediaQuery.of(context).size.width,
MediaQuery.of(context).size.width, MediaQuery.of(context).size.height / 4,
MediaQuery.of(context).size.height / 4,
),
), ),
), ),
DataTable( ),
headingRowHeight: 0, DataTable(
columns: const [ headingRowHeight: 0,
DataColumn(label: SizedBox()), columns: const [
DataColumn(label: SizedBox()), DataColumn(label: SizedBox()),
], DataColumn(label: SizedBox()),
rows: [ ],
for (final entry in { 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 details.isDirectory
? FilesLocalizations.of(context).detailsFolderName ? FilesLocalizations.of(context).detailsFolderSize
: FilesLocalizations.of(context).detailsFileName: details.name, : FilesLocalizations.of(context).detailsFileSize: filesize(details.size, 1),
FilesLocalizations.of(context).detailsParentFolder: },
details.path.length == 1 ? '/' : details.path.sublist(0, details.path.length - 1).join('/'), if (details.lastModified != null) ...{
if (details.size != null) ...{ FilesLocalizations.of(context).detailsLastModified:
details.isDirectory details.lastModified!.toLocal().toIso8601String(),
? FilesLocalizations.of(context).detailsFolderSize },
: FilesLocalizations.of(context).detailsFileSize: filesize(details.size, 1), if (details.isFavorite != null) ...{
}, FilesLocalizations.of(context).detailsIsFavorite: details.isFavorite!
if (details.lastModified != null) ...{ ? FilesLocalizations.of(context).actionYes
FilesLocalizations.of(context).detailsLastModified: : FilesLocalizations.of(context).actionNo,
details.lastModified!.toLocal().toIso8601String(), },
}, }.entries) ...[
if (details.isFavorite != null) ...{ DataRow(
FilesLocalizations.of(context).detailsIsFavorite: details.isFavorite! cells: [
? FilesLocalizations.of(context).actionYes DataCell(Text(entry.key)),
: FilesLocalizations.of(context).actionNo, DataCell(Text(entry.value)),
}, ],
}.entries) ...[ ),
DataRow(
cells: [
DataCell(Text(entry.key)),
DataCell(Text(entry.value)),
],
),
],
], ],
), ],
], ),
), ],
), ),
); );
} }

Loading…
Cancel
Save