Browse Source

neon,neon_files,settings: Make scrollbars draggable

pull/273/head
jld3103 2 years ago
parent
commit
5cafec49d6
No known key found for this signature in database
GPG Key ID: 9062417B9E8EB7B3
  1. 2
      packages/neon/neon/lib/src/pages/home.dart
  2. 128
      packages/neon/neon/lib/src/pages/login.dart
  3. 2
      packages/neon/neon/lib/src/widgets/list_view.dart
  4. 90
      packages/neon/neon_files/lib/pages/details.dart
  5. 2
      packages/settings/lib/src/widgets/settings_list.dart

2
packages/neon/neon/lib/src/pages/home.dart

@ -227,7 +227,9 @@ class _HomePageState extends State<HomePage> {
children: [
Expanded(
child: Scrollbar(
interactive: true,
child: ListView(
primary: true,
// Needed for the drawer header to also render in the statusbar
padding: EdgeInsets.zero,
children: [

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

@ -163,73 +163,77 @@ class _LoginPageState extends State<LoginPage> {
),
)
: Center(
child: ListView(
shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 20),
children: [
SizedBox(
height: MediaQuery.of(context).size.height / 2,
child: Column(
children: [
SvgPicture.asset(
'assets/logo.svg',
width: 100,
height: 100,
),
Text(
Provider.of<Branding>(context, listen: false).name,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 30,
),
Text(AppLocalizations.of(context).loginWorksWith),
const SizedBox(
height: 20,
),
const NextcloudLogo(),
],
),
),
Form(
key: _formKey,
child: TextFormField(
focusNode: _focusNode,
decoration: const InputDecoration(
hintText: 'https://...',
child: Scrollbar(
interactive: true,
child: ListView(
primary: true,
shrinkWrap: true,
padding: const EdgeInsets.symmetric(vertical: 40, horizontal: 20),
children: [
SizedBox(
height: MediaQuery.of(context).size.height / 2,
child: Column(
children: [
SvgPicture.asset(
'assets/logo.svg',
width: 100,
height: 100,
),
Text(
Provider.of<Branding>(context, listen: false).name,
style: Theme.of(context).textTheme.titleLarge,
),
const SizedBox(
height: 30,
),
Text(AppLocalizations.of(context).loginWorksWith),
const SizedBox(
height: 20,
),
const NextcloudLogo(),
],
),
keyboardType: TextInputType.url,
initialValue: widget.serverURL,
validator: (final input) => validateHttpUrl(context, input),
onFieldSubmitted: (final input) {
if (_formKey.currentState!.validate()) {
_loginBloc.setServerURL(input);
} else {
_focusNode.requestFocus();
}
},
),
),
Column(
children: [
NeonLinearProgressIndicator(
visible: serverConnectionStateSnapshot.data == ServerConnectionState.loading,
),
if (serverConnectionStateSnapshot.data == ServerConnectionState.unreachable) ...[
NeonException(
AppLocalizations.of(context).errorUnableToReachServer,
onRetry: _loginBloc.refresh,
Form(
key: _formKey,
child: TextFormField(
focusNode: _focusNode,
decoration: const InputDecoration(
hintText: 'https://...',
),
],
if (serverConnectionStateSnapshot.data == ServerConnectionState.maintenanceMode) ...[
NeonException(
AppLocalizations.of(context).errorServerInMaintenanceMode,
onRetry: _loginBloc.refresh,
keyboardType: TextInputType.url,
initialValue: widget.serverURL,
validator: (final input) => validateHttpUrl(context, input),
onFieldSubmitted: (final input) {
if (_formKey.currentState!.validate()) {
_loginBloc.setServerURL(input);
} else {
_focusNode.requestFocus();
}
},
),
),
Column(
children: [
NeonLinearProgressIndicator(
visible: serverConnectionStateSnapshot.data == ServerConnectionState.loading,
),
if (serverConnectionStateSnapshot.data == ServerConnectionState.unreachable) ...[
NeonException(
AppLocalizations.of(context).errorUnableToReachServer,
onRetry: _loginBloc.refresh,
),
],
if (serverConnectionStateSnapshot.data == ServerConnectionState.maintenanceMode) ...[
NeonException(
AppLocalizations.of(context).errorServerInMaintenanceMode,
onRetry: _loginBloc.refresh,
),
],
],
],
),
],
),
],
),
),
),
),

2
packages/neon/neon/lib/src/widgets/list_view.dart

@ -41,7 +41,9 @@ class NeonListView<T> extends StatelessWidget {
),
Expanded(
child: Scrollbar(
interactive: true,
child: ListView(
primary: true,
key: scrollKey != null ? PageStorageKey<String>(scrollKey!) : null,
padding: withFloatingActionButton ? const EdgeInsets.only(bottom: 88) : null,
children: [

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

@ -16,51 +16,55 @@ class FilesDetailsPage extends StatelessWidget {
appBar: AppBar(
title: Text(details.name),
),
body: ListView(
children: [
ColoredBox(
color: Theme.of(context).colorScheme.primary,
child: FilePreview(
bloc: bloc,
details: details,
color: Theme.of(context).colorScheme.onPrimary,
width: MediaQuery.of(context).size.width.toInt(),
height: MediaQuery.of(context).size.height ~/ 4,
body: Scrollbar(
interactive: true,
child: ListView(
primary: true,
children: [
ColoredBox(
color: Theme.of(context).colorScheme.primary,
child: FilePreview(
bloc: bloc,
details: details,
color: Theme.of(context).colorScheme.onPrimary,
width: MediaQuery.of(context).size.width.toInt(),
height: MediaQuery.of(context).size.height ~/ 4,
),
),
),
DataTable(
headingRowHeight: 0,
columns: [
DataColumn(label: Container()),
DataColumn(label: Container()),
],
rows: [
for (final entry in {
details.isDirectory
? AppLocalizations.of(context).filesDetailsFolderName
: AppLocalizations.of(context).filesDetailsFileName: details.name,
AppLocalizations.of(context).filesDetailsParentFolder:
details.path.length == 1 ? '/' : details.path.sublist(0, details.path.length - 1).join('/'),
details.isDirectory
? AppLocalizations.of(context).filesDetailsFolderSize
: AppLocalizations.of(context).filesDetailsFileSize: filesize(details.size, 1),
AppLocalizations.of(context).filesDetailsLastModified:
details.lastModified.toLocal().toIso8601String(),
if (details.isFavorite != null) ...{
AppLocalizations.of(context).filesDetailsIsFavorite:
details.isFavorite! ? AppLocalizations.of(context).yes : AppLocalizations.of(context).no,
},
}.entries) ...[
DataRow(
cells: [
DataCell(Text(entry.key)),
DataCell(Text(entry.value)),
],
),
DataTable(
headingRowHeight: 0,
columns: [
DataColumn(label: Container()),
DataColumn(label: Container()),
],
],
),
],
rows: [
for (final entry in {
details.isDirectory
? AppLocalizations.of(context).filesDetailsFolderName
: AppLocalizations.of(context).filesDetailsFileName: details.name,
AppLocalizations.of(context).filesDetailsParentFolder:
details.path.length == 1 ? '/' : details.path.sublist(0, details.path.length - 1).join('/'),
details.isDirectory
? AppLocalizations.of(context).filesDetailsFolderSize
: AppLocalizations.of(context).filesDetailsFileSize: filesize(details.size, 1),
AppLocalizations.of(context).filesDetailsLastModified:
details.lastModified.toLocal().toIso8601String(),
if (details.isFavorite != null) ...{
AppLocalizations.of(context).filesDetailsIsFavorite:
details.isFavorite! ? AppLocalizations.of(context).yes : AppLocalizations.of(context).no,
},
}.entries) ...[
DataRow(
cells: [
DataCell(Text(entry.key)),
DataCell(Text(entry.value)),
],
),
],
],
),
],
),
),
);
}

2
packages/settings/lib/src/widgets/settings_list.dart

@ -10,7 +10,9 @@ class SettingsList extends StatelessWidget {
@override
Widget build(final BuildContext context) => Scrollbar(
interactive: true,
child: ListView(
primary: true,
padding: const EdgeInsets.all(20),
children: categories.cast<Widget>().intersperse(const Divider()).toList(),
),

Loading…
Cancel
Save