-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
李卓原
committed
May 22, 2023
1 parent
ef63346
commit 7db5dd7
Showing
3 changed files
with
41 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
import 'package:device_preview/device_preview.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/widgets.dart'; | ||
import 'src/first_method.dart' as firstMethod; | ||
import 'src/second_method.dart' as secondMethod; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter/services.dart'; | ||
import 'package:flutter_screenutil/flutter_screenutil.dart'; | ||
|
||
void main() { | ||
const method = int.fromEnvironment('method', defaultValue: 1); | ||
runApp( | ||
DevicePreview( | ||
enabled: kDebugMode && kIsWeb, | ||
builder: (context) { | ||
return method == 1 ? firstMethod.MyApp() : secondMethod.MyApp(); | ||
}, | ||
), | ||
); | ||
void main(List<String> args) { | ||
WidgetsFlutterBinding.ensureInitialized(); | ||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge); | ||
runApp(const App()); | ||
} | ||
|
||
class App extends StatelessWidget { | ||
const App({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ScreenUtilInit( | ||
builder: (context, child) => MaterialApp( | ||
themeMode: ThemeMode.system, | ||
theme: ThemeData.light(), | ||
darkTheme: ThemeData.dark(), | ||
home: const Home(), | ||
), | ||
); | ||
} | ||
} | ||
|
||
class Home extends StatelessWidget { | ||
const Home({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Home'), | ||
), | ||
body: const Center( | ||
child: Text('Home'), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters