Showing
5 changed files
with
22 additions
and
8 deletions
@@ -13,12 +13,13 @@ class MyApp extends StatelessWidget { | @@ -13,12 +13,13 @@ class MyApp extends StatelessWidget { | ||
13 | builder: (_, child) { | 13 | builder: (_, child) { |
14 | return MaterialApp( | 14 | return MaterialApp( |
15 | debugShowCheckedModeBanner: false, | 15 | debugShowCheckedModeBanner: false, |
16 | - useInheritedMediaQuery: true, | ||
17 | title: 'First Method', | 16 | title: 'First Method', |
18 | // You can use the library anywhere in the app even in theme | 17 | // You can use the library anywhere in the app even in theme |
19 | theme: ThemeData( | 18 | theme: ThemeData( |
20 | primarySwatch: Colors.blue, | 19 | primarySwatch: Colors.blue, |
21 | - textTheme: Typography.englishLike2018.apply(fontSizeFactor: 1.sp), | 20 | + textTheme: Typography(platform: TargetPlatform.iOS) |
21 | + .black | ||
22 | + .apply(fontSizeFactor: 1), | ||
22 | ), | 23 | ), |
23 | home: child, | 24 | home: child, |
24 | ); | 25 | ); |
@@ -98,7 +98,13 @@ class HomePageScaffold extends StatelessWidget { | @@ -98,7 +98,13 @@ class HomePageScaffold extends StatelessWidget { | ||
98 | return Dialog( | 98 | return Dialog( |
99 | child: Padding( | 99 | child: Padding( |
100 | padding: EdgeInsets.all(12.r), | 100 | padding: EdgeInsets.all(12.r), |
101 | - child: const Text('Dialog'), | 101 | + child: Column( |
102 | + children: [ | ||
103 | + const Text('Dialog'), | ||
104 | + Spacer(), | ||
105 | + TextField(), | ||
106 | + ], | ||
107 | + ), | ||
102 | ), | 108 | ), |
103 | ); | 109 | ); |
104 | }, | 110 | }, |
@@ -124,7 +130,8 @@ class HomePageScaffold extends StatelessWidget { | @@ -124,7 +130,8 @@ class HomePageScaffold extends StatelessWidget { | ||
124 | context: context, | 130 | context: context, |
125 | builder: (BuildContext context) { | 131 | builder: (BuildContext context) { |
126 | return Container( | 132 | return Container( |
127 | - height: 200.w, | 133 | + height: 200.w + |
134 | + MediaQuery.of(context).viewInsets.bottom, | ||
128 | color: Colors.amber, | 135 | color: Colors.amber, |
129 | child: Center( | 136 | child: Center( |
130 | child: Column( | 137 | child: Column( |
@@ -132,10 +139,16 @@ class HomePageScaffold extends StatelessWidget { | @@ -132,10 +139,16 @@ class HomePageScaffold extends StatelessWidget { | ||
132 | mainAxisSize: MainAxisSize.min, | 139 | mainAxisSize: MainAxisSize.min, |
133 | children: <Widget>[ | 140 | children: <Widget>[ |
134 | const Text('Modal BottomSheet'), | 141 | const Text('Modal BottomSheet'), |
142 | + Spacer(), | ||
143 | + TextField(), | ||
135 | ElevatedButton( | 144 | ElevatedButton( |
136 | child: const Text('Close BottomSheet'), | 145 | child: const Text('Close BottomSheet'), |
137 | onPressed: Navigator.of(context).pop, | 146 | onPressed: Navigator.of(context).pop, |
138 | - ) | 147 | + ), |
148 | + SizedBox( | ||
149 | + height: MediaQuery.of(context) | ||
150 | + .viewInsets | ||
151 | + .bottom), | ||
139 | ], | 152 | ], |
140 | ), | 153 | ), |
141 | ), | 154 | ), |
@@ -61,7 +61,7 @@ class MyThemedApp extends StatelessWidget { | @@ -61,7 +61,7 @@ class MyThemedApp extends StatelessWidget { | ||
61 | return Theme( | 61 | return Theme( |
62 | data: ThemeData( | 62 | data: ThemeData( |
63 | primarySwatch: Colors.blue, | 63 | primarySwatch: Colors.blue, |
64 | - textTheme: TextTheme(bodyText2: TextStyle(fontSize: 30.sp)), | 64 | + textTheme: TextTheme(bodyMedium: TextStyle(fontSize: 30.sp)), |
65 | ), | 65 | ), |
66 | child: HomePage(title: 'FlutterScreenUtil Demo'), | 66 | child: HomePage(title: 'FlutterScreenUtil Demo'), |
67 | ); | 67 | ); |
@@ -16,7 +16,7 @@ class MyApp extends StatelessWidget { | @@ -16,7 +16,7 @@ class MyApp extends StatelessWidget { | ||
16 | // You can use the library anywhere in the app even in theme | 16 | // You can use the library anywhere in the app even in theme |
17 | theme: ThemeData( | 17 | theme: ThemeData( |
18 | primarySwatch: Colors.blue, | 18 | primarySwatch: Colors.blue, |
19 | - textTheme: TextTheme(bodyText2: TextStyle(fontSize: 30.sp)), | 19 | + textTheme: TextTheme(bodyMedium: TextStyle(fontSize: 30.sp)), |
20 | ), | 20 | ), |
21 | home: child, | 21 | home: child, |
22 | ); | 22 | ); |
@@ -60,7 +60,7 @@ class MyThemedApp extends StatelessWidget { | @@ -60,7 +60,7 @@ class MyThemedApp extends StatelessWidget { | ||
60 | return Theme( | 60 | return Theme( |
61 | data: ThemeData( | 61 | data: ThemeData( |
62 | primarySwatch: Colors.blue, | 62 | primarySwatch: Colors.blue, |
63 | - textTheme: TextTheme(bodyText2: TextStyle(fontSize: 30.sp)), | 63 | + textTheme: TextTheme(bodyMedium: TextStyle(fontSize: 30.sp)), |
64 | ), | 64 | ), |
65 | child: HomePage(title: '第二种方法(带主题)'), | 65 | child: HomePage(title: '第二种方法(带主题)'), |
66 | ); | 66 | ); |
-
Please register or login to post a comment