Browse Source

Merge pull request #273 from provokateurin/fix/draggable-scrollbar

Make scrollbars draggable
pull/275/head
Kate 2 years ago committed by GitHub
parent
commit
6aeeb48c16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  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: [ children: [
Expanded( Expanded(
child: Scrollbar( child: Scrollbar(
interactive: true,
child: ListView( child: ListView(
primary: true,
// Needed for the drawer header to also render in the statusbar // Needed for the drawer header to also render in the statusbar
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
children: [ children: [

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

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

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

@ -16,51 +16,55 @@ class FilesDetailsPage extends StatelessWidget {
appBar: AppBar( appBar: AppBar(
title: Text(details.name), title: Text(details.name),
), ),
body: ListView( body: Scrollbar(
children: [ interactive: true,
ColoredBox( child: ListView(
color: Theme.of(context).colorScheme.primary, primary: true,
child: FilePreview( children: [
bloc: bloc, ColoredBox(
details: details, color: Theme.of(context).colorScheme.primary,
color: Theme.of(context).colorScheme.onPrimary, child: FilePreview(
width: MediaQuery.of(context).size.width.toInt(), bloc: bloc,
height: MediaQuery.of(context).size.height ~/ 4, details: details,
color: Theme.of(context).colorScheme.onPrimary,
width: MediaQuery.of(context).size.width.toInt(),
height: MediaQuery.of(context).size.height ~/ 4,
),
), ),
), DataTable(
DataTable( headingRowHeight: 0,
headingRowHeight: 0, columns: [
columns: [ DataColumn(label: Container()),
DataColumn(label: Container()), 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)),
],
),
], ],
], 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 @override
Widget build(final BuildContext context) => Scrollbar( Widget build(final BuildContext context) => Scrollbar(
interactive: true,
child: ListView( child: ListView(
primary: true,
padding: const EdgeInsets.all(20), padding: const EdgeInsets.all(20),
children: categories.cast<Widget>().intersperse(const Divider()).toList(), children: categories.cast<Widget>().intersperse(const Divider()).toList(),
), ),

Loading…
Cancel
Save