From 31d8a7f167c2d86c294cf8c21e915945e80a9bb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=A4=A9?= Date: Tue, 25 Jul 2023 17:19:52 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E8=B0=83=E6=95=B4=E3=80=81?= =?UTF-8?q?=E5=85=A8=E5=B1=80appbar=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E3=80=81=E6=B3=A8=E9=94=80=E9=80=BB=E8=BE=91=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/data/services/user.dart | 2 +- lib/global.dart | 5 +++-- lib/main.dart | 14 +++++++++++++- lib/modules/main/widgets/news_letter.dart | 6 +++--- lib/routes/app_pages.dart | 1 - 5 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/data/services/user.dart b/lib/data/services/user.dart index 19f4662..10722a1 100644 --- a/lib/data/services/user.dart +++ b/lib/data/services/user.dart @@ -26,7 +26,7 @@ class UserService extends GetxService { super.onInit(); token = StorageService.to.getString(StorageUserTokenKey); var profileOffline = StorageService.to.getString(StorageUserProfileKey); - if (profileOffline.isNotEmpty) { + if (profileOffline.isNotEmpty && token.isNotEmpty) { _profile(UserLoginResponse.fromJson(jsonDecode(profileOffline))); _isLogin.value = true; } diff --git a/lib/global.dart b/lib/global.dart index de103da..73b2d02 100644 --- a/lib/global.dart +++ b/lib/global.dart @@ -14,8 +14,8 @@ class Global { WidgetsFlutterBinding.ensureInitialized(); await SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]); - // 调整系统UI - setSystemUi(); + // 调整系统UI 因为appBar会覆盖这个设置 所以换了个地方设置 + // setSystemUi(); // 初始换easyLoading Loading(); @@ -29,6 +29,7 @@ class Global { static void setSystemUi() { if (GetPlatform.isAndroid) { // android 状态栏为透明的沉浸 + // TODO AppBar会覆盖这里的设置 SystemUiOverlayStyle systemUiOverlayStyle = SystemUiOverlayStyle( statusBarColor: Colors.transparent, statusBarBrightness: Brightness.light, diff --git a/lib/main.dart b/lib/main.dart index a0f2768..f6bc7a7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; @@ -31,7 +32,18 @@ class MyApp extends StatelessWidget { var app = GetMaterialApp( title: 'News', debugShowCheckedModeBanner: false, - theme: AppTheme.light, + theme: AppTheme.light.copyWith( + appBarTheme: AppBarTheme( + systemOverlayStyle: SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + statusBarBrightness: Brightness.light, + statusBarIconBrightness: Brightness.dark, + systemNavigationBarDividerColor: Colors.transparent, + systemNavigationBarColor: Colors.white, + systemNavigationBarIconBrightness: Brightness.dark, + ) + ), + ), unknownRoute: AppPages.notFoundRoute, initialRoute: AppPages.Initial, getPages: AppPages.pages, diff --git a/lib/modules/main/widgets/news_letter.dart b/lib/modules/main/widgets/news_letter.dart index cf1f1e8..700e57b 100644 --- a/lib/modules/main/widgets/news_letter.dart +++ b/lib/modules/main/widgets/news_letter.dart @@ -51,11 +51,11 @@ class NewsLetterWidget extends GetView { // btn subcrible Padding( - padding: EdgeInsets.only(top: 15), + padding: EdgeInsets.only(top: 15.h), child: FlatButton( onPressed: () {}, - width: 335.w, - height: 44.h, + width: 335, + height: 44, fontWeight: FontWeight.w600, title: "Subscribe", ), diff --git a/lib/routes/app_pages.dart b/lib/routes/app_pages.dart index dff453d..e683110 100644 --- a/lib/routes/app_pages.dart +++ b/lib/routes/app_pages.dart @@ -7,7 +7,6 @@ import 'package:news_getx/modules/application/application_binding.dart'; import 'package:news_getx/modules/application/application_page.dart'; import 'package:news_getx/modules/bookmarks/bookmarks_binding.dart'; import 'package:news_getx/modules/category/category_binding.dart'; -import 'package:news_getx/modules/category/category_page.dart'; import 'package:news_getx/modules/detail/detail_binding.dart'; import 'package:news_getx/modules/detail/detail_page.dart'; import 'package:news_getx/modules/main/main_binding.dart';