D1APP-90 pageview scroll controlling
This commit is contained in:
parent
afc9c7bafe
commit
a2e0a9a29f
|
|
@ -43,6 +43,7 @@ class _NewsDetailsState extends State<NewsDetails> {
|
|||
onPageChanged: _onPageChnaged,
|
||||
scrollController: _scrollController,
|
||||
items: state.news,
|
||||
currentIndex: state.currentIndex,
|
||||
),
|
||||
if (state.news.isNotEmpty)
|
||||
Positioned(
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class _RadarDetailsState extends State<RadarDetails> {
|
|||
onPageChanged: _onPageChanged,
|
||||
scrollController: _scrollController,
|
||||
items: state.radars,
|
||||
currentIndex: state.currentIndex,
|
||||
),
|
||||
if (state.radars.isNotEmpty)
|
||||
Positioned(
|
||||
|
|
|
|||
|
|
@ -56,6 +56,7 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
|||
|
||||
@override
|
||||
void initState() {
|
||||
_handleScroll();
|
||||
_isScrolled = false;
|
||||
_comments = widget.comments;
|
||||
super.initState();
|
||||
|
|
@ -170,6 +171,23 @@ class _FloatingNavigationBarState extends State<FloatingNavigationBar> {
|
|||
);
|
||||
}
|
||||
|
||||
void _handleScroll() {
|
||||
widget.scrollController.addListener(() {
|
||||
final position = widget.scrollController.position.pixels;
|
||||
final size = MediaQuery.of(context).size.height * 0.3;
|
||||
if (position > size && _isScrolled == false) {
|
||||
setState(() {
|
||||
_isScrolled = true;
|
||||
});
|
||||
}
|
||||
if (position < size && _isScrolled == true) {
|
||||
setState(() {
|
||||
_isScrolled = false;
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void _showMoreOptions() {
|
||||
final categories = widget.categories!;
|
||||
ActionSheetUtils.showBottomSheet(
|
||||
|
|
|
|||
|
|
@ -11,17 +11,19 @@ import 'package:flutter_html/flutter_html.dart';
|
|||
class DidvanPageView extends StatefulWidget {
|
||||
final List items;
|
||||
final int initialIndex;
|
||||
final int currentIndex;
|
||||
final bool isRadar;
|
||||
final ScrollController? scrollController;
|
||||
final ScrollController scrollController;
|
||||
|
||||
final void Function(int index) onPageChanged;
|
||||
const DidvanPageView({
|
||||
Key? key,
|
||||
required this.initialIndex,
|
||||
required this.items,
|
||||
this.scrollController,
|
||||
required this.scrollController,
|
||||
required this.onPageChanged,
|
||||
required this.isRadar,
|
||||
required this.currentIndex,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -48,7 +50,8 @@ class _DidvanPageViewState extends State<DidvanPageView> {
|
|||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: SingleChildScrollView(
|
||||
controller: index == 1 ? widget.scrollController : null,
|
||||
controller:
|
||||
index == widget.currentIndex ? widget.scrollController : null,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
padding: EdgeInsets.only(
|
||||
left: 4,
|
||||
|
|
|
|||
Loading…
Reference in New Issue