File tree 2 files changed +17
-7
lines changed
2 files changed +17
-7
lines changed Original file line number Diff line number Diff line change @@ -491,15 +491,18 @@ class CupertinoSlidingSegmentedControl<T extends Object> extends StatefulWidget
491
491
/// Defaults to `EdgeInsets.symmetric(vertical: 2, horizontal: 3)` .
492
492
final EdgeInsetsGeometry padding;
493
493
494
- /// Determines whether segments in the segmented control show selected state.
494
+ /// Determines whether segments provide only momentary feedback when pressed
495
+ /// rather than maintaining a persistent selected state.
495
496
///
496
- /// If true, segments in the control don’t show selected state and
497
- /// don’t update the value of selectedSegmentIndex after tracking ends .
497
+ /// When true, segments behave more like buttons that trigger actions rather
498
+ /// than options that can be selected and remain in that state .
498
499
///
499
500
/// Defaults to false.
500
501
///
501
502
/// {@tool dartpad}
502
- /// This example shows a [CupertinoSlidingSegmentedControl] with [isMomentary] set to true.
503
+ /// This example shows a [CupertinoSlidingSegmentedControl] with [isMomentary] set
504
+ /// to true, providing feedback to the user when the segment is selected with a
505
+ /// text scaling effect.
503
506
///
504
507
/// ** See code in examples/api/lib/cupertino/segmented_control/cupertino_sliding_segmented_control.1.dart **
505
508
/// {@end-tool}
Original file line number Diff line number Diff line change @@ -2173,13 +2173,20 @@ void main() {
2173
2173
);
2174
2174
2175
2175
final TestGesture gesture = await tester.startGesture (tester.getCenter (find.text ('A' )));
2176
- await gesture.moveBy (const Offset (10 , 0 ));
2177
- await tester.pumpAndSettle (const Duration (milliseconds: 206 ));
2178
2176
final Finder scaleTransition = find.ancestor (
2179
2177
of: find.text ('A' ),
2180
2178
matching: find.byType (ScaleTransition ),
2181
2179
);
2182
- final double scale = tester.widget <ScaleTransition >(scaleTransition).scale.value;
2180
+
2181
+ await tester.pumpAndSettle (const Duration (milliseconds: 206 ));
2182
+ double scale = tester.widget <ScaleTransition >(scaleTransition).scale.value;
2183
2183
expect (scale, greaterThan (1.0 ));
2184
+
2185
+ await gesture.up ();
2186
+
2187
+ await tester.pumpAndSettle ();
2188
+ scale = tester.widget <ScaleTransition >(scaleTransition).scale.value;
2189
+ // Spring animations approach but don't exactly reach normal scale.
2190
+ expect (scale, moreOrLessEquals (1.0 , epsilon: 0.01 ));
2184
2191
});
2185
2192
}
You can’t perform that action at this time.
0 commit comments