mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-06 15:21:21 +08:00

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.
39 lines
1.0 KiB
Dart
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,
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|