mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-24 17:31:06 +08:00
49 lines
1.3 KiB
Dart
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,
|
|
),
|
|
),
|
|
);
|
|
});
|
|
}
|
|
}
|