From 443642d21802eacf307eb9f384aec255ed53c6df Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 22 Mar 2021 14:18:18 +0800 Subject: [PATCH] update screenutil dep --- lib/main.dart | 43 +++++++++++++++++++------------ lib/pages/home/home_page.dart | 2 -- lib/pages/splash/splash_page.dart | 2 -- pubspec.lock | 2 +- pubspec.yaml | 2 +- 5 files changed, 28 insertions(+), 23 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 5325bf3e..0012acb9 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,8 +2,10 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_picker/flutter_picker.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:fluwx/fluwx.dart'; import 'package:get/get.dart'; import 'package:jpush_flutter/jpush_flutter.dart'; @@ -20,6 +22,9 @@ import 'package:akuCommunity/utils/developer_util.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + SystemChrome.setSystemUIOverlayStyle( + SystemUiOverlayStyle(statusBarColor: Colors.transparent), + ); JPush jpush = new JPush(); jpush.addEventHandler( // 接收通知回调方法。 @@ -80,23 +85,27 @@ class _MyAppState extends State { FocusManager.instance.primaryFocus.unfocus(); } }, - child: GetMaterialApp( - title: '智慧社区', - debugShowCheckedModeBanner: false, - theme: AppTheme.theme, - home: SplashPage(), - //国际化支持 - localizationsDelegates: [ - PickerLocalizationsDelegate.delegate, - RefreshLocalizations.delegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: [const Locale('zh', 'CH')], - locale: Locale('zh'), - builder: BotToastInit(), - navigatorObservers: [BotToastNavigatorObserver()], + child: ScreenUtilInit( + designSize: Size(750, 1334), + allowFontScaling: true, + builder: () => GetMaterialApp( + title: '智慧社区', + debugShowCheckedModeBanner: false, + theme: AppTheme.theme, + home: SplashPage(), + //国际化支持 + localizationsDelegates: [ + PickerLocalizationsDelegate.delegate, + RefreshLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: [const Locale('zh', 'CH')], + locale: Locale('zh'), + builder: BotToastInit(), + navigatorObservers: [BotToastNavigatorObserver()], + ), ), ), ); diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 73fd8f03..8dcfd748 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -62,8 +62,6 @@ class _HomePageState extends State @override Widget build(BuildContext context) { super.build(context); - ScreenUtil.init(context, - designSize: Size(750, 1334), allowFontScaling: true); AppProvider appProvider = Provider.of(context); return Scaffold( extendBodyBehindAppBar: true, diff --git a/lib/pages/splash/splash_page.dart b/lib/pages/splash/splash_page.dart index 61c5e7b8..96ce4c3e 100644 --- a/lib/pages/splash/splash_page.dart +++ b/lib/pages/splash/splash_page.dart @@ -61,8 +61,6 @@ class _SplashPageState extends State { @override Widget build(BuildContext context) { - ScreenUtil.init(context, - designSize: Size(750, 1334), allowFontScaling: true); return Scaffold( body: SizedBox( height: 80, diff --git a/pubspec.lock b/pubspec.lock index 2d7ef73f..740cb288 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -451,7 +451,7 @@ packages: name: flutter_screenutil url: "https://pub.flutter-io.cn" source: hosted - version: "3.2.0" + version: "4.0.3+3" flutter_slidable: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index e6e270dd..02afd784 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: flutter_redux: ^0.5.3 provider: ^4.1.3 # 屏幕适配 - flutter_screenutil: ^3.2.0 + flutter_screenutil: ^4.0.3+3 cupertino_icons: ^1.0.0 # 打电话等各种功能 url_launcher: 5.5.2