Files
GitJournal/lib/widgets/editor_scroll_view.dart
Vishesh Handa 81eb605e98 MarkdownViewer: Use EditorScrollView
This way we don't show that annoying animation, and we now occupy the
entire available width. Otheriwse if you had text which was required
scrolling, but only had 1 word in each line, then you couldn't scroll by
dragging on the empty area as the widget didn't occupy that space.
2020-05-06 14:27:49 +02:00

39 lines
1.0 KiB
Dart

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;
EditorScrollView({
@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.disallowGlow();
return false;
},
child: SingleChildScrollView(
padding: padding,
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
minWidth: constraints.maxWidth,
),
child: child,
),
),
);
});
}
}