@@ -1281,6 +1281,80 @@ void main() {
1281
1281
await checkDragHandleAndColors ();
1282
1282
});
1283
1283
1284
+ testWidgets ('Drag handle interactive area size at minimum possible size' , (WidgetTester tester) async {
1285
+ Widget buildScaffold (GlobalKey scaffoldKey, {Size ? dragHandleSize}) {
1286
+ return MaterialApp (
1287
+ theme: ThemeData .light ().copyWith (
1288
+ bottomSheetTheme: BottomSheetThemeData (
1289
+ dragHandleSize: dragHandleSize
1290
+ ),
1291
+ ),
1292
+ home: Scaffold (
1293
+ key: scaffoldKey,
1294
+ ),
1295
+ );
1296
+ }
1297
+
1298
+ const Size smallerDragHandleSize = Size (20 , 20 );
1299
+
1300
+ final GlobalKey <ScaffoldState > scaffoldKey = GlobalKey <ScaffoldState >();
1301
+ await tester.pumpWidget (buildScaffold (scaffoldKey, dragHandleSize: smallerDragHandleSize));
1302
+
1303
+ showModalBottomSheet <void >(
1304
+ context: scaffoldKey.currentContext! ,
1305
+ showDragHandle: true ,
1306
+ builder: (BuildContext context) {
1307
+ return const Text ('BottomSheet' );
1308
+ },
1309
+ );
1310
+
1311
+ await tester.pump (); // Bottom sheet show animation starts.
1312
+ await tester.pump (const Duration (seconds: 1 )); // Animation done.
1313
+
1314
+ final Finder dragHandle = find.bySemanticsLabel ('Dismiss' );
1315
+ expect (
1316
+ tester.getSize (dragHandle),
1317
+ const Size (kMinInteractiveDimension, kMinInteractiveDimension),
1318
+ );
1319
+ });
1320
+
1321
+ testWidgets ('Drag handle interactive area size at given dragHandleSize' , (WidgetTester tester) async {
1322
+ Widget buildScaffold (GlobalKey scaffoldKey, {Size ? dragHandleSize}) {
1323
+ return MaterialApp (
1324
+ theme: ThemeData .light ().copyWith (
1325
+ bottomSheetTheme: BottomSheetThemeData (
1326
+ dragHandleSize: dragHandleSize
1327
+ ),
1328
+ ),
1329
+ home: Scaffold (
1330
+ key: scaffoldKey,
1331
+ ),
1332
+ );
1333
+ }
1334
+
1335
+ const Size extendedDragHandleSize = Size (100 , 50 );
1336
+
1337
+ final GlobalKey <ScaffoldState > scaffoldKey = GlobalKey <ScaffoldState >();
1338
+ await tester.pumpWidget (buildScaffold (scaffoldKey, dragHandleSize: extendedDragHandleSize));
1339
+
1340
+ showModalBottomSheet <void >(
1341
+ context: scaffoldKey.currentContext! ,
1342
+ showDragHandle: true ,
1343
+ builder: (BuildContext context) {
1344
+ return const Text ('BottomSheet' );
1345
+ },
1346
+ );
1347
+
1348
+ await tester.pump (); // Bottom sheet show animation starts.
1349
+ await tester.pump (const Duration (seconds: 1 )); // Animation done.
1350
+
1351
+ final Finder dragHandle = find.bySemanticsLabel ('Dismiss' );
1352
+ expect (
1353
+ tester.getSize (dragHandle),
1354
+ extendedDragHandleSize,
1355
+ );
1356
+ });
1357
+
1284
1358
testWidgets ('showModalBottomSheet does not use root Navigator by default' , (WidgetTester tester) async {
1285
1359
await tester.pumpWidget (MaterialApp (
1286
1360
home: Scaffold (
0 commit comments