phase3: shop.dart NotificationListener return bool

This commit is contained in:
2026-07-31 14:54:32 +08:00
parent 6487c0db54
commit 70076d71c1
2 changed files with 7 additions and 7 deletions

View File

@@ -44,7 +44,7 @@ class CarouselState extends State<Carousel> {
duration: widget.animationDuration, curve: Curves.linear); duration: widget.animationDuration, curve: Curves.linear);
if (!reverse) { if (!reverse) {
_currentPage += 1; _currentPage += 1;
if (_currentPage == widget.pages.length) { if (_currentPage == widget.pages!.length) {
_currentPage -= 1; _currentPage -= 1;
reverse = true; reverse = true;
} }
@@ -77,7 +77,7 @@ class CarouselState extends State<Carousel> {
color: Style.backgroundColor, color: Style.backgroundColor,
child: new PageView( child: new PageView(
controller: _pageController, controller: _pageController,
children: widget.pages, children: widget.pages!,
onPageChanged: (index) { onPageChanged: (index) {
_currentPage = index; _currentPage = index;
_indicatorStateKey.currentState!.changeIndex(index); _indicatorStateKey.currentState!.changeIndex(index);
@@ -91,7 +91,7 @@ class CarouselState extends State<Carousel> {
child: new Align( child: new Align(
child: new Indicator( child: new Indicator(
key: _indicatorStateKey, key: _indicatorStateKey,
count: widget.pages.length, count: widget.pages!.length,
), ),
alignment: Alignment.center, alignment: Alignment.center,
), ),
@@ -124,7 +124,7 @@ class IndicatorState extends State<Indicator> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var indicators = <Widget>[]; var indicators = <Widget>[];
for (var i = 0; i < widget.count; ++i) { for (var i = 0; i < widget.count!; ++i) {
indicators.add(new Container( indicators.add(new Container(
width: 5.0, width: 5.0,
height: 5.0, height: 5.0,
@@ -135,7 +135,7 @@ class IndicatorState extends State<Indicator> {
)); ));
} }
return new SizedBox( return new SizedBox(
width: widget.count * 15.0, width: widget.count! * 15.0,
height: 30.0, height: 30.0,
child: new Row( child: new Row(
children: indicators, children: indicators,

View File

@@ -1324,13 +1324,13 @@ class ShopState extends State<Shop>
onNotification: (ScrollUpdateNotification notification) { onNotification: (ScrollUpdateNotification notification) {
if (!displayProductByCategoryClick) { if (!displayProductByCategoryClick) {
if (_categoryIndexChange) { if (_categoryIndexChange) {
return; return false;
} }
int index = _getCategoryIndexByRightScrollHeight( int index = _getCategoryIndexByRightScrollHeight(
notification.metrics.pixels); notification.metrics.pixels);
_setCategoryByProductScrolledIndex(index); _setCategoryByProductScrolledIndex(index);
} }
return; return false;
}, },
child: new ListView.builder( child: new ListView.builder(
physics: ClampingScrollPhysics(), physics: ClampingScrollPhysics(),