@@ -1530,70 +1530,70 @@ void main() {
1530
1530
expect (snackBarBottomLeft, equals (bottomNavigationBarTopLeft));
1531
1531
},
1532
1532
);
1533
+ }
1533
1534
1534
- testWidgets (
1535
- 'Padding of $behavior is not consumed by viewInsets' ,
1536
- (WidgetTester tester) async {
1537
- final Widget child = MaterialApp (
1538
- home: Scaffold (
1539
- resizeToAvoidBottomInset: false ,
1540
- floatingActionButton: FloatingActionButton (
1541
- child: const Icon (Icons .send),
1542
- onPressed: () {},
1543
- ),
1544
- body: Builder (
1545
- builder: (BuildContext context) {
1546
- return GestureDetector (
1547
- onTap: () {
1548
- ScaffoldMessenger .of (context).showSnackBar (
1549
- SnackBar (
1550
- content: const Text ('I am a snack bar.' ),
1551
- duration: const Duration (seconds: 2 ),
1552
- action: SnackBarAction (label: 'ACTION' , onPressed: () {}),
1553
- behavior: behavior,
1554
- ),
1555
- );
1556
- },
1557
- child: const Text ('X' ),
1558
- );
1559
- },
1560
- ),
1535
+ testWidgets (
1536
+ 'Padding of ${SnackBarBehavior .fixed } is not consumed by viewInsets' ,
1537
+ (WidgetTester tester) async {
1538
+ final Widget child = MaterialApp (
1539
+ home: Scaffold (
1540
+ resizeToAvoidBottomInset: false ,
1541
+ floatingActionButton: FloatingActionButton (
1542
+ child: const Icon (Icons .send),
1543
+ onPressed: () {},
1561
1544
),
1562
- );
1545
+ body: Builder (
1546
+ builder: (BuildContext context) {
1547
+ return GestureDetector (
1548
+ onTap: () {
1549
+ ScaffoldMessenger .of (context).showSnackBar (
1550
+ SnackBar (
1551
+ content: const Text ('I am a snack bar.' ),
1552
+ duration: const Duration (seconds: 2 ),
1553
+ action: SnackBarAction (label: 'ACTION' , onPressed: () {}),
1554
+ behavior: SnackBarBehavior .fixed,
1555
+ ),
1556
+ );
1557
+ },
1558
+ child: const Text ('X' ),
1559
+ );
1560
+ },
1561
+ ),
1562
+ ),
1563
+ );
1563
1564
1564
- await tester.pumpWidget (
1565
- MediaQuery (
1566
- data: const MediaQueryData (
1567
- padding: EdgeInsets .only (bottom: 20.0 ),
1568
- ),
1569
- child: child,
1565
+ await tester.pumpWidget (
1566
+ MediaQuery (
1567
+ data: const MediaQueryData (
1568
+ padding: EdgeInsets .only (bottom: 20.0 ),
1570
1569
),
1571
- );
1572
- await tester. tap (find. text ( 'X' ));
1573
- await tester. pumpAndSettle (); // Show snackbar
1574
- final Offset initialBottomLeft = tester.getBottomLeft (find.byType ( SnackBar ));
1575
- final Offset initialBottomRight = tester.getBottomRight (find. byType ( SnackBar ));
1576
- // Consume bottom padding - as if by the keyboard opening
1577
- await tester.pumpWidget (
1578
- MediaQuery (
1579
- data : const MediaQueryData (
1580
- viewPadding : EdgeInsets . all ( 20 ),
1581
- viewInsets : EdgeInsets . all ( 100 ),
1582
- ),
1583
- child : child ,
1570
+ child : child,
1571
+ ),
1572
+ );
1573
+ await tester.tap (find.text ( 'X' ));
1574
+ await tester.pumpAndSettle (); // Show snackbar
1575
+ final Offset initialBottomLeft = tester. getBottomLeft (find. byType ( SnackBar ));
1576
+ final Offset initialBottomRight = tester.getBottomRight (find. byType ( SnackBar ));
1577
+ // Consume bottom padding - as if by the keyboard opening
1578
+ await tester. pumpWidget (
1579
+ MediaQuery (
1580
+ data : const MediaQueryData (
1581
+ viewPadding : EdgeInsets . all ( 20 ),
1582
+ viewInsets : EdgeInsets . all ( 100 ) ,
1584
1583
),
1585
- );
1586
- await tester.tap (find.text ('X' ));
1587
- await tester.pumpAndSettle (); // Have the SnackBar fully animate out.
1584
+ child: child,
1585
+ ),
1586
+ );
1587
+ await tester.tap (find.text ('X' ));
1588
+ await tester.pumpAndSettle (); // Have the SnackBar fully animate out.
1588
1589
1589
- final Offset finalBottomLeft = tester.getBottomLeft (find.byType (SnackBar ));
1590
- final Offset finalBottomRight = tester.getBottomRight (find.byType (SnackBar ));
1590
+ final Offset finalBottomLeft = tester.getBottomLeft (find.byType (SnackBar ));
1591
+ final Offset finalBottomRight = tester.getBottomRight (find.byType (SnackBar ));
1591
1592
1592
- expect (initialBottomLeft, finalBottomLeft);
1593
- expect (initialBottomRight, finalBottomRight);
1594
- },
1595
- );
1596
- }
1593
+ expect (initialBottomLeft, finalBottomLeft);
1594
+ expect (initialBottomRight, finalBottomRight);
1595
+ },
1596
+ );
1597
1597
1598
1598
testWidgets (
1599
1599
'${SnackBarBehavior .fixed } should align SnackBar with the bottom of Scaffold '
0 commit comments