44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
import 'pages/index.dart';
|
|
|
|
void main() async {
|
|
WidgetsFlutterBinding.ensureInitialized();
|
|
// Android状态栏透明 splash为白色,所以调整状态栏文字为黑色
|
|
SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle(
|
|
statusBarColor: Colors.transparent,
|
|
statusBarIconBrightness: Brightness.light);
|
|
SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
|
|
runApp(MyApp());
|
|
}
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
|
const MyApp({Key? key}) : super(key: key);
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
// 强制竖屏
|
|
SystemChrome.setPreferredOrientations(
|
|
[DeviceOrientation.landscapeLeft, DeviceOrientation.landscapeRight]);
|
|
return ScreenUtilInit(
|
|
/// 设置设计稿宽高
|
|
designSize: Size(1180, 820),
|
|
minTextAdapt: true,
|
|
splitScreenMode: false,
|
|
builder: (_) {
|
|
return GetMaterialApp(
|
|
title: 'Flutter Demo',
|
|
locale: Locale('zh', 'CN'),
|
|
fallbackLocale: Locale('zh', 'CN'),
|
|
theme: ThemeData(
|
|
primarySwatch: Colors.red,
|
|
),
|
|
home: IndexPage(),
|
|
);
|
|
}
|
|
);
|
|
}
|
|
}
|