Files
GitJournal/lib/editors/editor_scroll_view.dart
Vishesh Handa ae9228f65e Use super.key
Makes the code a bit more readable.
2022-08-25 11:32:25 +02:00

49 lines
1.3 KiB
Dart

/*
* SPDX-FileCopyrightText: 2019-2021 Vishesh Handa <me@vhanda.in>
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
import 'package:flutter/material.dart';
/// A Scroll view which occupies the full height of the parent, and doesn't
/// show the overflow animation.
class EditorScrollView extends StatelessWidget {
final Widget child;
final EdgeInsetsGeometry padding;
final ScrollController? scrollController;
const EditorScrollView({
super.key,
this.scrollController,
required this.child,
this.padding = const EdgeInsets.all(16.0),
});
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (
BuildContext context,
BoxConstraints constraints,
) {
return NotificationListener<OverscrollIndicatorNotification>(
onNotification: (OverscrollIndicatorNotification overScroll) {
overScroll.disallowIndicator();
return false;
},
child: SingleChildScrollView(
controller: scrollController,
padding: padding,
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
minWidth: constraints.maxWidth,
),
child: child,
),
),
);
});
}
}