mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
Move ScrollViewWithoutAnimation to its own file
This commit is contained in:
@ -8,6 +8,7 @@ import 'package:function_types/function_types.dart';
|
||||
import 'package:gitjournal/analytics.dart';
|
||||
import 'package:gitjournal/screens/feature_timeline_screen.dart';
|
||||
import 'package:gitjournal/widgets/purchase_widget.dart';
|
||||
import 'package:gitjournal/widgets/scroll_view_without_animation.dart';
|
||||
|
||||
class PurchaseScreen extends StatefulWidget {
|
||||
@override
|
||||
@ -209,7 +210,7 @@ class PurchaseCards extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _ScrollViewWithoutAnim(
|
||||
return ScrollViewWithoutAnimation(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
@ -220,27 +221,3 @@ class PurchaseCards extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ScrollViewWithoutAnim extends StatelessWidget {
|
||||
final Widget child;
|
||||
final Axis scrollDirection;
|
||||
|
||||
_ScrollViewWithoutAnim({
|
||||
@required this.child,
|
||||
this.scrollDirection,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return NotificationListener<OverscrollIndicatorNotification>(
|
||||
onNotification: (OverscrollIndicatorNotification overScroll) {
|
||||
overScroll.disallowGlow();
|
||||
return false;
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: scrollDirection,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
25
lib/widgets/scroll_view_without_animation.dart
Normal file
25
lib/widgets/scroll_view_without_animation.dart
Normal file
@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class ScrollViewWithoutAnimation extends StatelessWidget {
|
||||
final Widget child;
|
||||
final Axis scrollDirection;
|
||||
|
||||
ScrollViewWithoutAnimation({
|
||||
@required this.child,
|
||||
this.scrollDirection,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return NotificationListener<OverscrollIndicatorNotification>(
|
||||
onNotification: (OverscrollIndicatorNotification overScroll) {
|
||||
overScroll.disallowGlow();
|
||||
return false;
|
||||
},
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: scrollDirection,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user