@@ -1891,6 +1891,237 @@ void main() {
18911891 expect (offsetPlatform, const Offset (16.0 , 16.0 ));
18921892 });
18931893
1894+ testWidgets ('SwitchListTile isThreeLine' , (WidgetTester tester) async {
1895+ const double height = 300 ;
1896+ const double switchTop = 130.0 ;
1897+
1898+ Widget buildFrame ({bool ? themeDataIsThreeLine, bool ? themeIsThreeLine, bool ? isThreeLine}) {
1899+ return MaterialApp (
1900+ key: UniqueKey (),
1901+ theme:
1902+ themeDataIsThreeLine != null
1903+ ? ThemeData (listTileTheme: ListTileThemeData (isThreeLine: themeDataIsThreeLine))
1904+ : null ,
1905+ home: Material (
1906+ child: ListTileTheme (
1907+ data:
1908+ themeIsThreeLine != null ? ListTileThemeData (isThreeLine: themeIsThreeLine) : null ,
1909+ child: ListView (
1910+ children: < Widget > [
1911+ SwitchListTile (
1912+ isThreeLine: isThreeLine,
1913+ title: const Text ('A' ),
1914+ subtitle: const Text ('A\n B\n C\n D\n E\n F\n G\n H\n I\n J\n K\n L\n M' ),
1915+ value: false ,
1916+ onChanged: null ,
1917+ ),
1918+ SwitchListTile (
1919+ isThreeLine: isThreeLine,
1920+ title: const Text ('A' ),
1921+ subtitle: const Text ('A' ),
1922+ value: false ,
1923+ onChanged: null ,
1924+ ),
1925+ ],
1926+ ),
1927+ ),
1928+ ),
1929+ );
1930+ }
1931+
1932+ void expectTwoLine () {
1933+ expect (
1934+ tester.getRect (find.byType (SwitchListTile ).at (0 )),
1935+ const Rect .fromLTWH (0.0 , 0.0 , 800.0 , height),
1936+ );
1937+ expect (
1938+ tester.getRect (find.byType (Switch ).at (0 )),
1939+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , switchTop, 60.0 , 40.0 ),
1940+ );
1941+ expect (
1942+ tester.getRect (find.byType (SwitchListTile ).at (1 )),
1943+ const Rect .fromLTWH (0.0 , height, 800.0 , 72.0 ),
1944+ );
1945+ expect (
1946+ tester.getRect (find.byType (Switch ).at (1 )),
1947+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , height + 16 , 60.0 , 40.0 ),
1948+ );
1949+ }
1950+
1951+ void expectThreeLine () {
1952+ expect (
1953+ tester.getRect (find.byType (SwitchListTile ).at (0 )),
1954+ const Rect .fromLTWH (0.0 , 0.0 , 800.0 , height),
1955+ );
1956+ expect (
1957+ tester.getRect (find.byType (Switch ).at (0 )),
1958+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , 8.0 , 60.0 , 40.0 ),
1959+ );
1960+ expect (
1961+ tester.getRect (find.byType (SwitchListTile ).at (1 )),
1962+ const Rect .fromLTWH (0.0 , height, 800.0 , 88.0 ),
1963+ );
1964+ expect (
1965+ tester.getRect (find.byType (Switch ).at (1 )),
1966+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , height + 8.0 , 60.0 , 40.0 ),
1967+ );
1968+ }
1969+
1970+ await tester.pumpWidget (buildFrame ());
1971+ expectTwoLine ();
1972+
1973+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: true ));
1974+ expectThreeLine ();
1975+
1976+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: false , themeIsThreeLine: true ));
1977+ expectThreeLine ();
1978+
1979+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: true , themeIsThreeLine: false ));
1980+ expectTwoLine ();
1981+
1982+ await tester.pumpWidget (buildFrame (isThreeLine: true ));
1983+ expectThreeLine ();
1984+
1985+ await tester.pumpWidget (buildFrame (themeIsThreeLine: true , isThreeLine: false ));
1986+ expectTwoLine ();
1987+
1988+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: true , isThreeLine: false ));
1989+ expectTwoLine ();
1990+
1991+ await tester.pumpWidget (
1992+ buildFrame (themeDataIsThreeLine: true , themeIsThreeLine: true , isThreeLine: false ),
1993+ );
1994+ expectTwoLine ();
1995+
1996+ await tester.pumpWidget (buildFrame (themeIsThreeLine: false , isThreeLine: true ));
1997+ expectThreeLine ();
1998+
1999+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: false , isThreeLine: true ));
2000+ expectThreeLine ();
2001+
2002+ await tester.pumpWidget (
2003+ buildFrame (themeDataIsThreeLine: false , themeIsThreeLine: false , isThreeLine: true ),
2004+ );
2005+ expectThreeLine ();
2006+ });
2007+
2008+ testWidgets ('SwitchListTile.adaptive isThreeLine' , (WidgetTester tester) async {
2009+ const double height = 300 ;
2010+ const double switchTop = 130.0 ;
2011+
2012+ Widget buildFrame ({bool ? themeDataIsThreeLine, bool ? themeIsThreeLine, bool ? isThreeLine}) {
2013+ return MaterialApp (
2014+ key: UniqueKey (),
2015+ theme: ThemeData (
2016+ platform: TargetPlatform .iOS,
2017+ listTileTheme:
2018+ themeDataIsThreeLine != null
2019+ ? ListTileThemeData (isThreeLine: themeDataIsThreeLine)
2020+ : null ,
2021+ ),
2022+ home: Material (
2023+ child: ListTileTheme (
2024+ data:
2025+ themeIsThreeLine != null ? ListTileThemeData (isThreeLine: themeIsThreeLine) : null ,
2026+ child: ListView (
2027+ children: < Widget > [
2028+ SwitchListTile .adaptive (
2029+ isThreeLine: isThreeLine,
2030+ title: const Text ('A' ),
2031+ subtitle: const Text ('A\n B\n C\n D\n E\n F\n G\n H\n I\n J\n K\n L\n M' ),
2032+ value: false ,
2033+ onChanged: null ,
2034+ ),
2035+ SwitchListTile .adaptive (
2036+ isThreeLine: isThreeLine,
2037+ title: const Text ('A' ),
2038+ subtitle: const Text ('A' ),
2039+ value: false ,
2040+ onChanged: null ,
2041+ ),
2042+ ],
2043+ ),
2044+ ),
2045+ ),
2046+ );
2047+ }
2048+
2049+ void expectTwoLine () {
2050+ expect (
2051+ tester.getRect (find.byType (SwitchListTile ).at (0 )),
2052+ const Rect .fromLTWH (0.0 , 0.0 , 800.0 , height),
2053+ );
2054+ expect (
2055+ tester.getRect (find.byType (Switch ).at (0 )),
2056+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , switchTop, 60.0 , 40.0 ),
2057+ );
2058+ expect (
2059+ tester.getRect (find.byType (SwitchListTile ).at (1 )),
2060+ const Rect .fromLTWH (0.0 , height, 800.0 , 72.0 ),
2061+ );
2062+ expect (
2063+ tester.getRect (find.byType (Switch ).at (1 )),
2064+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , height + 16 , 60.0 , 40.0 ),
2065+ );
2066+ }
2067+
2068+ void expectThreeLine () {
2069+ expect (
2070+ tester.getRect (find.byType (SwitchListTile ).at (0 )),
2071+ const Rect .fromLTWH (0.0 , 0.0 , 800.0 , height),
2072+ );
2073+ expect (
2074+ tester.getRect (find.byType (Switch ).at (0 )),
2075+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , 8.0 , 60.0 , 40.0 ),
2076+ );
2077+ expect (
2078+ tester.getRect (find.byType (SwitchListTile ).at (1 )),
2079+ const Rect .fromLTWH (0.0 , height, 800.0 , 88.0 ),
2080+ );
2081+ expect (
2082+ tester.getRect (find.byType (Switch ).at (1 )),
2083+ const Rect .fromLTWH (800.0 - 60.0 - 24.0 , height + 8.0 , 60.0 , 40.0 ),
2084+ );
2085+ }
2086+
2087+ await tester.pumpWidget (buildFrame ());
2088+ expectTwoLine ();
2089+
2090+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: true ));
2091+ expectThreeLine ();
2092+
2093+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: false , themeIsThreeLine: true ));
2094+ expectThreeLine ();
2095+
2096+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: true , themeIsThreeLine: false ));
2097+ expectTwoLine ();
2098+
2099+ await tester.pumpWidget (buildFrame (isThreeLine: true ));
2100+ expectThreeLine ();
2101+
2102+ await tester.pumpWidget (buildFrame (themeIsThreeLine: true , isThreeLine: false ));
2103+ expectTwoLine ();
2104+
2105+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: true , isThreeLine: false ));
2106+ expectTwoLine ();
2107+
2108+ await tester.pumpWidget (
2109+ buildFrame (themeDataIsThreeLine: true , themeIsThreeLine: true , isThreeLine: false ),
2110+ );
2111+ expectTwoLine ();
2112+
2113+ await tester.pumpWidget (buildFrame (themeIsThreeLine: false , isThreeLine: true ));
2114+ expectThreeLine ();
2115+
2116+ await tester.pumpWidget (buildFrame (themeDataIsThreeLine: false , isThreeLine: true ));
2117+ expectThreeLine ();
2118+
2119+ await tester.pumpWidget (
2120+ buildFrame (themeDataIsThreeLine: false , themeIsThreeLine: false , isThreeLine: true ),
2121+ );
2122+ expectThreeLine ();
2123+ });
2124+
18942125 testWidgets ('Material3 - SwitchListTile activeThumbColor' , (WidgetTester tester) async {
18952126 await tester.pumpWidget (
18962127 Directionality (
0 commit comments