@@ -3395,6 +3395,83 @@ void main() {
33953395 // FAB is not visible.
33963396 expect (find.byType (FloatingActionButton ), findsNothing);
33973397 });
3398+
3399+ testWidgets ('fix _floatingActionButtonVisibility update' ,
3400+ (WidgetTester tester) async {
3401+ final List <String > log = < String > [];
3402+
3403+ bool expanded = true ;
3404+ final DraggableScrollableController controller =
3405+ DraggableScrollableController ();
3406+ addTearDown (controller.dispose);
3407+ await tester.pumpWidget (
3408+ MaterialApp (
3409+ home: StatefulBuilder (
3410+ builder:
3411+ (BuildContext context, void Function (void Function ()) setState) {
3412+ return Scaffold (
3413+ bottomSheet: expanded
3414+ ? DraggableScrollableSheet (
3415+ expand: false ,
3416+ snap: true ,
3417+ initialChildSize: 0.25 ,
3418+ maxChildSize: 0.5 ,
3419+ snapSizes: const < double > [0.5 ],
3420+ controller: controller,
3421+ builder: (BuildContext context,
3422+ ScrollController scrollController) {
3423+ return SingleChildScrollView (
3424+ controller: scrollController,
3425+ child: Column (
3426+ children: < Widget > [
3427+ TextButton (
3428+ onPressed: () {
3429+ controller.animateTo (
3430+ 0.5 ,
3431+ duration: Durations .short4,
3432+ curve: Curves .easeIn,
3433+ );
3434+ },
3435+ child: const Text ('Toggle' ),
3436+ )
3437+ ],
3438+ ),
3439+ );
3440+ },
3441+ )
3442+ : null ,
3443+ floatingActionButton: expanded
3444+ ? FloatingActionButton (
3445+ onPressed: () {
3446+ setState (() {
3447+ expanded = ! expanded;
3448+ });
3449+ },
3450+ child: const Icon (Icons .add),
3451+ )
3452+ : null ,
3453+ );
3454+ },
3455+ ),
3456+ ),
3457+ );
3458+
3459+ await tester.tap (find.byType (TextButton ));
3460+ await tester.pumpAndSettle ();
3461+
3462+ final double controllerValue = controller.size;
3463+ expect (controllerValue, 0.5 );
3464+
3465+ await tester.tap (find.byType (FloatingActionButton ));
3466+
3467+ final FlutterExceptionHandler ? handler = FlutterError .onError;
3468+ FlutterError .onError = (FlutterErrorDetails details) {
3469+ log.add (details.exception.toString ());
3470+ };
3471+ await tester.pump ();
3472+ FlutterError .onError = handler;
3473+ expect (log.length, 0 );
3474+ });
33983475}
33993476
34003477class _GeometryListener extends StatefulWidget {
0 commit comments