Skip to content

Commit 380b8cf

Browse files
committed
bumped to version 2.3.0
1 parent d046d84 commit 380b8cf

16 files changed

+41
-31
lines changed

example/lib/app_themes.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ class AppThemes {
1818
),
1919
elevatedButtonTheme: ElevatedButtonThemeData(
2020
style: ButtonStyle(
21-
backgroundColor: MaterialStateProperty.all(Colors.redAccent),
21+
backgroundColor: WidgetStateProperty.all(Colors.redAccent),
2222
),
2323
),
2424
textButtonTheme: TextButtonThemeData(
2525
style: ButtonStyle(
26-
foregroundColor: MaterialStateProperty.all(lightColor),
26+
foregroundColor: WidgetStateProperty.all(lightColor),
2727
),
2828
),
2929
appBarTheme: const AppBarTheme(
@@ -70,12 +70,12 @@ class AppThemes {
7070
),
7171
elevatedButtonTheme: ElevatedButtonThemeData(
7272
style: ButtonStyle(
73-
backgroundColor: MaterialStateProperty.all(Colors.redAccent),
73+
backgroundColor: WidgetStateProperty.all(Colors.redAccent),
7474
),
7575
),
7676
textButtonTheme: TextButtonThemeData(
7777
style: ButtonStyle(
78-
foregroundColor: MaterialStateProperty.all(darkColor),
78+
foregroundColor: WidgetStateProperty.all(darkColor),
7979
),
8080
),
8181
appBarTheme: const AppBarTheme(

example/lib/main.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter/material.dart';
1+
import 'package:flutter/material.dart' hide CarouselController;
22
import 'package:flutter_carousel_widget/flutter_carousel_widget.dart';
33

44
import 'app_themes.dart';
@@ -433,6 +433,7 @@ class _CarouselWithIndicatorState extends State<CarouselWithIndicatorDemo> {
433433
autoPlay: true,
434434
autoPlayInterval: const Duration(seconds: 4),
435435
viewportFraction: 1.0,
436+
initialPage: 2,
436437
showIndicator: false,
437438
height: 400.0,
438439
onPageChanged: (int index, CarouselPageChangedReason reason) {
@@ -540,8 +541,8 @@ class _ExpandableCarouselDemoState extends State<ExpandableCarouselDemo> {
540541
ExpandableCarousel(
541542
options: ExpandableCarouselOptions(
542543
// viewportFraction: 1.0,
543-
enableInfiniteScroll: false,
544-
// initialPage: 3,
544+
// enableInfiniteScroll: false,
545+
initialPage: 2,
545546
autoPlay: true,
546547
controller: _controller,
547548
floatingIndicator: false,

lib/src/_expandable_carousel_widget.dart

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ library flutter_carousel_widget;
33
import 'dart:async';
44

55
import 'package:flutter/gestures.dart';
6-
import 'package:flutter/material.dart';
6+
import 'package:flutter/material.dart' hide CarouselController;
77
import 'package:flutter_carousel_widget/src/components/overflow_page.dart';
88
import 'package:flutter_carousel_widget/src/enums/carousel_page_changed_reason.dart';
99
import 'package:flutter_carousel_widget/src/helpers/flutter_expandable_carousel_controller.dart';
@@ -166,9 +166,10 @@ class ExpandableCarouselWidgetState extends State<ExpandableCarousel>
166166
_carouselState!.itemCount = widget.itemCount;
167167
carouselController.state = _carouselState;
168168
_carouselState!.initialPage = widget.options.initialPage;
169-
_carouselState!.realPage = options.enableInfiniteScroll
170-
? _carouselState!.realPage + _carouselState!.initialPage
171-
: _carouselState!.initialPage;
169+
// _carouselState!.realPage = options.enableInfiniteScroll
170+
// ? _carouselState!.realPage + _carouselState!.initialPage
171+
// : _carouselState!.initialPage;
172+
_carouselState!.realPage = _carouselState!.initialPage;
172173

173174
/// For Indicator
174175
_currentPage = widget.options.initialPage;
@@ -223,8 +224,16 @@ class ExpandableCarouselWidgetState extends State<ExpandableCarousel>
223224
var nextPage = _carouselState!.pageController!.page!.round() + 1;
224225
var itemCount = widget.itemCount ?? widget.items!.length;
225226

226-
if (nextPage >= itemCount &&
227-
widget.options.enableInfiniteScroll == false) {
227+
// if (nextPage >= itemCount &&
228+
// widget.options.enableInfiniteScroll == false) {
229+
// if (widget.options.pauseAutoPlayInFiniteScroll) {
230+
// _clearTimer();
231+
// return;
232+
// }
233+
// nextPage = 0;
234+
// }
235+
236+
if (nextPage >= itemCount) {
228237
if (widget.options.pauseAutoPlayInFiniteScroll) {
229238
_clearTimer();
230239
return;

lib/src/_flutter_carousel_widget.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class FlutterCarouselState extends State<FlutterCarousel>
140140

141141
_carouselState!.pageController = _pageController;
142142

143-
_pageController!.addListener(_changeIndexPageDelta);
143+
_pageController?.addListener(_changeIndexPageDelta);
144144
}
145145

146146
CarouselControllerImpl get carouselController =>
@@ -433,7 +433,7 @@ class FlutterCarouselState extends State<FlutterCarousel>
433433
/// The method to build the slide indicator
434434
Widget _buildSlideIndicator() {
435435
return widget.options.slideIndicator!.build(
436-
(widget.options.initialPage + _currentPage) % widget.itemCount!,
436+
_currentPage % widget.itemCount!,
437437
_pageDelta,
438438
widget.itemCount!,
439439
);

lib/src/components/overflow_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter/material.dart';
1+
import 'package:flutter/material.dart' hide CarouselController;
22
import 'package:flutter_carousel_widget/src/components/size_reporting_widget.dart';
33

44
class OverflowPage extends StatelessWidget {

lib/src/components/size_reporting_widget.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter/material.dart';
1+
import 'package:flutter/material.dart' hide CarouselController;
22

33
class SizeReportingWidget extends StatefulWidget {
44
const SizeReportingWidget({

lib/src/helpers/flutter_carousel_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dart:async';
22

3-
import 'package:flutter/material.dart';
3+
import 'package:flutter/material.dart' hide CarouselController;
44
import 'package:flutter_carousel_widget/src/enums/carousel_page_changed_reason.dart';
55
import 'package:flutter_carousel_widget/src/helpers/flutter_carousel_state.dart';
66
import 'package:flutter_carousel_widget/src/utils/flutter_carousel_utils.dart';

lib/src/helpers/flutter_carousel_state.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import 'package:flutter/material.dart';
1+
import 'package:flutter/material.dart' hide CarouselController;
22
import 'package:flutter_carousel_widget/src/enums/carousel_page_changed_reason.dart';
33
import 'package:flutter_carousel_widget/src/helpers/flutter_carousel_options.dart';
44

lib/src/helpers/flutter_expandable_carousel_controller.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'dart:async';
22

3-
import 'package:flutter/material.dart';
3+
import 'package:flutter/material.dart' hide CarouselController;
44
import 'package:flutter_carousel_widget/src/enums/carousel_page_changed_reason.dart';
55
import 'package:flutter_carousel_widget/src/helpers/flutter_expandable_carousel_state.dart';
66
import 'package:flutter_carousel_widget/src/utils/flutter_carousel_utils.dart';

lib/src/helpers/flutter_expandable_carousel_options.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'package:flutter/gestures.dart';
2-
import 'package:flutter/material.dart';
2+
import 'package:flutter/material.dart' hide CarouselController;
33
import 'package:flutter_carousel_widget/src/enums/carousel_page_changed_reason.dart';
44
import 'package:flutter_carousel_widget/src/helpers/flutter_expandable_carousel_controller.dart';
55
import 'package:flutter_carousel_widget/src/indicators/circular_slide_indicator.dart';
@@ -11,7 +11,7 @@ class ExpandableCarouselOptions {
1111
this.aspectRatio,
1212
this.viewportFraction = 0.9,
1313
this.initialPage = 0,
14-
this.enableInfiniteScroll = false,
14+
// this.enableInfiniteScroll = false,
1515
this.reverse = false,
1616
this.autoPlay = false,
1717
this.autoPlayInterval = const Duration(seconds: 5),
@@ -91,7 +91,7 @@ class ExpandableCarouselOptions {
9191
///Determines if carousel should loop infinitely or be limited to item length.
9292
///
9393
///Defaults to true, i.e. infinite loop.
94-
final bool enableInfiniteScroll;
94+
// final bool enableInfiniteScroll;
9595

9696
/// Whether or not to float `SlideIndicator` over `Carousel`.
9797
final bool floatingIndicator;
@@ -201,7 +201,7 @@ class ExpandableCarouselOptions {
201201
double? aspectRatio,
202202
double? viewportFraction,
203203
int? initialPage,
204-
bool? enableInfiniteScroll,
204+
// bool? enableInfiniteScroll,
205205
bool? reverse,
206206
bool? autoPlay,
207207
Duration? autoPlayInterval,
@@ -234,7 +234,7 @@ class ExpandableCarouselOptions {
234234
aspectRatio: aspectRatio ?? this.aspectRatio,
235235
viewportFraction: viewportFraction ?? this.viewportFraction,
236236
initialPage: initialPage ?? this.initialPage,
237-
enableInfiniteScroll: enableInfiniteScroll ?? this.enableInfiniteScroll,
237+
// enableInfiniteScroll: enableInfiniteScroll ?? this.enableInfiniteScroll,
238238
reverse: reverse ?? this.reverse,
239239
autoPlay: autoPlay ?? this.autoPlay,
240240
autoPlayInterval: autoPlayInterval ?? this.autoPlayInterval,

0 commit comments

Comments
 (0)