@@ -187,4 +187,102 @@ void main() {
187187 expect (controller.isScrollingReverse, isTrue);
188188 expect (controller.isScrollIdle, isFalse);
189189 });
190+
191+ group ('IndicatorSide -' , () {
192+ test ('AxisDirection.up - start edge' , () {
193+ final controller = IndicatorController ()
194+ ..setAxisDirection (AxisDirection .up)
195+ ..setIndicatorEdge (IndicatorEdge .start);
196+
197+ expect (controller.side, IndicatorSide .bottom);
198+ });
199+ test ('AxisDirection.up - end edge' , () {
200+ final controller = IndicatorController ()
201+ ..setAxisDirection (AxisDirection .up)
202+ ..setIndicatorEdge (IndicatorEdge .end);
203+
204+ expect (controller.side, IndicatorSide .top);
205+ });
206+
207+ test ('AxisDirection.down - start edge' , () {
208+ final controller = IndicatorController ()
209+ ..setAxisDirection (AxisDirection .down)
210+ ..setIndicatorEdge (IndicatorEdge .start);
211+
212+ expect (controller.side, IndicatorSide .top);
213+ });
214+ test ('AxisDirection.down - end edge' , () {
215+ final controller = IndicatorController ()
216+ ..setAxisDirection (AxisDirection .down)
217+ ..setIndicatorEdge (IndicatorEdge .end);
218+
219+ expect (controller.side, IndicatorSide .bottom);
220+ });
221+
222+ test ('AxisDirection.left - start edge' , () {
223+ final controller = IndicatorController ()
224+ ..setAxisDirection (AxisDirection .left)
225+ ..setIndicatorEdge (IndicatorEdge .start);
226+
227+ expect (controller.side, IndicatorSide .left);
228+ });
229+ test ('AxisDirection.left - end edge' , () {
230+ final controller = IndicatorController ()
231+ ..setAxisDirection (AxisDirection .left)
232+ ..setIndicatorEdge (IndicatorEdge .end);
233+
234+ expect (controller.side, IndicatorSide .right);
235+ });
236+ test ('AxisDirection.right - start edge' , () {
237+ final controller = IndicatorController ()
238+ ..setAxisDirection (AxisDirection .right)
239+ ..setIndicatorEdge (IndicatorEdge .start);
240+
241+ expect (controller.side, IndicatorSide .right);
242+ });
243+ test ('AxisDirection.right - end edge' , () {
244+ final controller = IndicatorController ()
245+ ..setAxisDirection (AxisDirection .right)
246+ ..setIndicatorEdge (IndicatorEdge .end);
247+
248+ expect (controller.side, IndicatorSide .left);
249+ });
250+
251+ test ('AxisDirection.right - end none' , () {
252+ final controller = IndicatorController ()..setIndicatorEdge (null );
253+
254+ expect (controller.side, IndicatorSide .none);
255+ });
256+ });
257+
258+ test ('stopDrag - changes the shouldStopDrag - valid state' , () {
259+ var controller = IndicatorController ()
260+ ..setIndicatorState (IndicatorState .dragging);
261+ expect (controller.shouldStopDrag, isFalse);
262+ controller.stopDrag ();
263+ expect (controller.shouldStopDrag, isTrue);
264+
265+ controller = IndicatorController ()..setIndicatorState (IndicatorState .armed);
266+ expect (controller.shouldStopDrag, isFalse);
267+ controller.stopDrag ();
268+ expect (controller.shouldStopDrag, isTrue);
269+ });
270+
271+ test ('stopDrag - changes the shouldStopDrag - invalid state' , () {
272+ var controller = IndicatorController ()
273+ ..setIndicatorState (IndicatorState .idle);
274+ expect (() => controller.stopDrag (), throwsA (isA <StateError >()));
275+
276+ controller = IndicatorController ()
277+ ..setIndicatorState (IndicatorState .loading);
278+ expect (() => controller.stopDrag (), throwsA (isA <StateError >()));
279+
280+ controller = IndicatorController ()
281+ ..setIndicatorState (IndicatorState .complete);
282+ expect (() => controller.stopDrag (), throwsA (isA <StateError >()));
283+
284+ controller = IndicatorController ()
285+ ..setIndicatorState (IndicatorState .hiding);
286+ expect (() => controller.stopDrag (), throwsA (isA <StateError >()));
287+ });
190288}
0 commit comments