diff --git a/ui/flutter/lib/app/modules/app/views/app_view.dart b/ui/flutter/lib/app/modules/app/views/app_view.dart index 1f55ad5b..70b62f41 100644 --- a/ui/flutter/lib/app/modules/app/views/app_view.dart +++ b/ui/flutter/lib/app/modules/app/views/app_view.dart @@ -2,10 +2,12 @@ import 'package:flutter/material.dart'; import 'package:flutter_foreground_task/flutter_foreground_task.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:get/get.dart'; +import 'package:window_manager/window_manager.dart'; // Import the required packages import '../../../../i18n/message.dart'; import '../../../../theme/theme.dart'; import '../../../../util/locale_manager.dart'; +import '../../../../util/util.dart'; // Import the required packages import '../../../routes/app_pages.dart'; import '../controllers/app_controller.dart'; @@ -32,6 +34,19 @@ class AppView extends GetView { ], supportedLocales: messages.keys.keys.map((e) => toLocale(e)).toList(), getPages: AppPages.routes, + + // Add listening to theme changes, set the title bar color according to the current system theme. + builder: (context, child) { + // if platform is desktop + if (Util.isDesktop()){ + // actual brightness of the UI + Brightness brightness = Theme.of(context).brightness; + // Set the title bar to use the actual brightness of the UI + windowManager.setBrightness(brightness); + } + return child!; + }, + ), ); }