Showing
3 changed files
with
39 additions
and
17 deletions
1 | -import 'package:device_preview/device_preview.dart'; | ||
2 | -import 'package:flutter/foundation.dart'; | ||
3 | -import 'package:flutter/widgets.dart'; | ||
4 | -import 'src/first_method.dart' as firstMethod; | ||
5 | -import 'src/second_method.dart' as secondMethod; | 1 | +import 'package:flutter/material.dart'; |
2 | +import 'package:flutter/services.dart'; | ||
3 | +import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
6 | 4 | ||
7 | -void main() { | ||
8 | - const method = int.fromEnvironment('method', defaultValue: 1); | ||
9 | - runApp( | ||
10 | - DevicePreview( | ||
11 | - enabled: kDebugMode && kIsWeb, | ||
12 | - builder: (context) { | ||
13 | - return method == 1 ? firstMethod.MyApp() : secondMethod.MyApp(); | ||
14 | - }, | 5 | +void main(List<String> args) { |
6 | + WidgetsFlutterBinding.ensureInitialized(); | ||
7 | + SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); | ||
8 | + runApp(const App()); | ||
9 | +} | ||
10 | + | ||
11 | +class App extends StatelessWidget { | ||
12 | + const App({super.key}); | ||
13 | + | ||
14 | + @override | ||
15 | + Widget build(BuildContext context) { | ||
16 | + return ScreenUtilInit( | ||
17 | + builder: (context, child) => MaterialApp( | ||
18 | + themeMode: ThemeMode.system, | ||
19 | + theme: ThemeData.light(), | ||
20 | + darkTheme: ThemeData.dark(), | ||
21 | + home: const Home(), | ||
22 | + ), | ||
23 | + ); | ||
24 | + } | ||
25 | +} | ||
26 | + | ||
27 | +class Home extends StatelessWidget { | ||
28 | + const Home({super.key}); | ||
29 | + | ||
30 | + @override | ||
31 | + Widget build(BuildContext context) { | ||
32 | + return Scaffold( | ||
33 | + appBar: AppBar( | ||
34 | + title: const Text('Home'), | ||
35 | + ), | ||
36 | + body: const Center( | ||
37 | + child: Text('Home'), | ||
15 | ), | 38 | ), |
16 | ); | 39 | ); |
40 | + } | ||
17 | } | 41 | } |
1 | name: flutter_screenutil | 1 | name: flutter_screenutil |
2 | description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models | 2 | description: A flutter plugin for adapting screen and font size.Guaranteed to look good on different models |
3 | -version: 6.0.1 | 3 | +version: 5.8.2 |
4 | homepage: https://github.com/OpenFlutter/flutter_screenutil | 4 | homepage: https://github.com/OpenFlutter/flutter_screenutil |
5 | 5 | ||
6 | environment: | 6 | environment: |
-
Please register or login to post a comment