@@ -1495,7 +1495,7 @@ void main() {
1495
1495
);
1496
1496
1497
1497
// Below the center aligned case.
1498
- expect (tester.getTopLeft (find.text (text)).dy, closeTo (554 .0 , .0001 ));
1498
+ expect (tester.getTopLeft (find.text (text)).dy, closeTo (564 .0 , .0001 ));
1499
1499
});
1500
1500
});
1501
1501
@@ -1680,8 +1680,8 @@ void main() {
1680
1680
);
1681
1681
1682
1682
// Below the center example.
1683
- expect (tester.getTopLeft (find.text (text)).dy, closeTo (554 .0 , .0001 ));
1684
- expect (tester.getTopLeft (find.byKey (pKey)).dy, closeTo (470 .0 , .0001 ));
1683
+ expect (tester.getTopLeft (find.text (text)).dy, closeTo (564 .0 , .0001 ));
1684
+ expect (tester.getTopLeft (find.byKey (pKey)).dy, closeTo (480 .0 , .0001 ));
1685
1685
});
1686
1686
1687
1687
testWidgets ('InputDecorator tall prefix with border align double' , (WidgetTester tester) async {
@@ -1711,8 +1711,8 @@ void main() {
1711
1711
);
1712
1712
1713
1713
// Between the top and center examples.
1714
- expect (tester.getTopLeft (find.text (text)).dy, closeTo (353 .3 , .0001 ));
1715
- expect (tester.getTopLeft (find.byKey (pKey)).dy, closeTo (269 .3 , .0001 ));
1714
+ expect (tester.getTopLeft (find.text (text)).dy, closeTo (354 .3 , .0001 ));
1715
+ expect (tester.getTopLeft (find.byKey (pKey)).dy, closeTo (270 .3 , .0001 ));
1716
1716
});
1717
1717
});
1718
1718
@@ -1794,6 +1794,199 @@ void main() {
1794
1794
});
1795
1795
});
1796
1796
1797
+ group ('OutlineInputBorder' , () {
1798
+ group ('default alignment' , () {
1799
+ testWidgets ('Centers when border' , (WidgetTester tester) async {
1800
+ await tester.pumpWidget (
1801
+ buildInputDecorator (
1802
+ decoration: const InputDecoration (
1803
+ border: OutlineInputBorder (),
1804
+ ),
1805
+ ),
1806
+ );
1807
+
1808
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 56.0 ));
1809
+ expect (tester.getTopLeft (find.text ('text' )).dy, 19.0 );
1810
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 35.0 );
1811
+ expect (getBorderBottom (tester), 56.0 );
1812
+ expect (getBorderWeight (tester), 1.0 );
1813
+ });
1814
+
1815
+ testWidgets ('Centers when border and label' , (WidgetTester tester) async {
1816
+ await tester.pumpWidget (
1817
+ buildInputDecorator (
1818
+ decoration: const InputDecoration (
1819
+ labelText: 'label' ,
1820
+ border: OutlineInputBorder (),
1821
+ ),
1822
+ ),
1823
+ );
1824
+
1825
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 56.0 ));
1826
+ expect (tester.getTopLeft (find.text ('text' )).dy, 19.0 );
1827
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 35.0 );
1828
+ expect (getBorderBottom (tester), 56.0 );
1829
+ expect (getBorderWeight (tester), 1.0 );
1830
+ });
1831
+
1832
+ testWidgets ('Centers when border and contentPadding' , (WidgetTester tester) async {
1833
+ await tester.pumpWidget (
1834
+ buildInputDecorator (
1835
+ decoration: const InputDecoration (
1836
+ border: OutlineInputBorder (),
1837
+ contentPadding: EdgeInsets .fromLTRB (
1838
+ 12.0 , 14.0 ,
1839
+ 8.0 , 14.0 ,
1840
+ ),
1841
+ ),
1842
+ ),
1843
+ );
1844
+
1845
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 44.0 ));
1846
+ expect (tester.getTopLeft (find.text ('text' )).dy, 13.0 );
1847
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 29.0 );
1848
+ expect (getBorderBottom (tester), 44.0 );
1849
+ expect (getBorderWeight (tester), 1.0 );
1850
+ });
1851
+
1852
+ testWidgets ('Centers when border and contentPadding and label' , (WidgetTester tester) async {
1853
+ await tester.pumpWidget (
1854
+ buildInputDecorator (
1855
+ decoration: const InputDecoration (
1856
+ labelText: 'label' ,
1857
+ border: OutlineInputBorder (),
1858
+ contentPadding: EdgeInsets .fromLTRB (
1859
+ 12.0 , 14.0 ,
1860
+ 8.0 , 14.0 ,
1861
+ ),
1862
+ ),
1863
+ ),
1864
+ );
1865
+
1866
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 44.0 ));
1867
+ expect (tester.getTopLeft (find.text ('text' )).dy, 13.0 );
1868
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 29.0 );
1869
+ expect (getBorderBottom (tester), 44.0 );
1870
+ expect (getBorderWeight (tester), 1.0 );
1871
+ });
1872
+
1873
+ testWidgets ('Centers when border and lopsided contentPadding and label' , (WidgetTester tester) async {
1874
+ await tester.pumpWidget (
1875
+ buildInputDecorator (
1876
+ decoration: const InputDecoration (
1877
+ labelText: 'label' ,
1878
+ border: OutlineInputBorder (),
1879
+ contentPadding: EdgeInsets .fromLTRB (
1880
+ 12.0 , 104.0 ,
1881
+ 8.0 , 0.0 ,
1882
+ ),
1883
+ ),
1884
+ ),
1885
+ );
1886
+
1887
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 120.0 ));
1888
+ expect (tester.getTopLeft (find.text ('text' )).dy, 51.0 );
1889
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 67.0 );
1890
+ expect (getBorderBottom (tester), 120.0 );
1891
+ expect (getBorderWeight (tester), 1.0 );
1892
+ });
1893
+ });
1894
+
1895
+ group ('3 point interpolation alignment' , () {
1896
+ testWidgets ('top align includes padding' , (WidgetTester tester) async {
1897
+ await tester.pumpWidget (
1898
+ buildInputDecorator (
1899
+ expands: true ,
1900
+ textAlignVertical: TextAlignVertical .top,
1901
+ decoration: const InputDecoration (
1902
+ border: OutlineInputBorder (),
1903
+ contentPadding: EdgeInsets .fromLTRB (
1904
+ 12.0 , 24.0 ,
1905
+ 8.0 , 2.0 ,
1906
+ ),
1907
+ ),
1908
+ ),
1909
+ );
1910
+
1911
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 600.0 ));
1912
+ // Aligned to the top including the 24px padding.
1913
+ expect (tester.getTopLeft (find.text ('text' )).dy, 24.0 );
1914
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 40.0 );
1915
+ expect (getBorderBottom (tester), 600.0 );
1916
+ expect (getBorderWeight (tester), 1.0 );
1917
+ });
1918
+
1919
+ testWidgets ('center align ignores padding' , (WidgetTester tester) async {
1920
+ await tester.pumpWidget (
1921
+ buildInputDecorator (
1922
+ expands: true ,
1923
+ textAlignVertical: TextAlignVertical .center,
1924
+ decoration: const InputDecoration (
1925
+ border: OutlineInputBorder (),
1926
+ contentPadding: EdgeInsets .fromLTRB (
1927
+ 12.0 , 24.0 ,
1928
+ 8.0 , 2.0 ,
1929
+ ),
1930
+ ),
1931
+ ),
1932
+ );
1933
+
1934
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 600.0 ));
1935
+ // Baseline is on the center of the 600px high input.
1936
+ expect (tester.getTopLeft (find.text ('text' )).dy, 291.0 );
1937
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 307.0 );
1938
+ expect (getBorderBottom (tester), 600.0 );
1939
+ expect (getBorderWeight (tester), 1.0 );
1940
+ });
1941
+
1942
+ testWidgets ('bottom align includes padding' , (WidgetTester tester) async {
1943
+ await tester.pumpWidget (
1944
+ buildInputDecorator (
1945
+ expands: true ,
1946
+ textAlignVertical: TextAlignVertical .bottom,
1947
+ decoration: const InputDecoration (
1948
+ border: OutlineInputBorder (),
1949
+ contentPadding: EdgeInsets .fromLTRB (
1950
+ 12.0 , 24.0 ,
1951
+ 8.0 , 2.0 ,
1952
+ ),
1953
+ ),
1954
+ ),
1955
+ );
1956
+
1957
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 600.0 ));
1958
+ // Includes bottom padding of 2px.
1959
+ expect (tester.getTopLeft (find.text ('text' )).dy, 582.0 );
1960
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 598.0 );
1961
+ expect (getBorderBottom (tester), 600.0 );
1962
+ expect (getBorderWeight (tester), 1.0 );
1963
+ });
1964
+
1965
+ testWidgets ('padding exceeds middle keeps top at middle' , (WidgetTester tester) async {
1966
+ await tester.pumpWidget (
1967
+ buildInputDecorator (
1968
+ expands: true ,
1969
+ textAlignVertical: TextAlignVertical .top,
1970
+ decoration: const InputDecoration (
1971
+ border: OutlineInputBorder (),
1972
+ contentPadding: EdgeInsets .fromLTRB (
1973
+ 12.0 , 504.0 ,
1974
+ 8.0 , 0.0 ,
1975
+ ),
1976
+ ),
1977
+ ),
1978
+ );
1979
+
1980
+ expect (tester.getSize (find.byType (InputDecorator )), const Size (800.0 , 600.0 ));
1981
+ // Same position as the center example above.
1982
+ expect (tester.getTopLeft (find.text ('text' )).dy, 291.0 );
1983
+ expect (tester.getBottomLeft (find.text ('text' )).dy, 307.0 );
1984
+ expect (getBorderBottom (tester), 600.0 );
1985
+ expect (getBorderWeight (tester), 1.0 );
1986
+ });
1987
+ });
1988
+ });
1989
+
1797
1990
testWidgets ('counter text has correct right margin - LTR, not dense' , (WidgetTester tester) async {
1798
1991
await tester.pumpWidget (
1799
1992
buildInputDecorator (
0 commit comments