Skip to content

Commit

Permalink
🐛 Windows bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Khaoz-Topsy committed Sep 23, 2024
1 parent e74976f commit c285929
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 58 deletions.
31 changes: 15 additions & 16 deletions lib/components/adaptive/app_shell.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:assistantapps_flutter_common/assistantapps_flutter_common.dart';
import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:assistantnms_app/constants/app_image.dart';
import 'package:assistantapps_flutter_common/assistantapps_flutter_common.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
Expand Down Expand Up @@ -117,20 +116,20 @@ class AppShell extends StatelessWidget {
),
);

if (isDesktop) {
return MaterialApp(
theme: theme,
darkTheme: darkTheme,
debugShowCheckedModeBanner: false,
home: Scaffold(
appBar: WindowTitleBar(
title: 'Assistant for No Man\'s Sky',
iconPath: AppImage.assistantNMSWindowIcon,
),
body: matApp,
),
);
}
// if (isDesktop) {
// return MaterialApp(
// theme: theme,
// darkTheme: darkTheme,
// debugShowCheckedModeBanner: false,
// home: Scaffold(
// appBar: WindowTitleBar(
// title: 'Assistant for No Man\'s Sky',
// iconPath: AppImage.assistantNMSWindowIcon,
// ),
// body: matApp,
// ),
// );
// }

return MaterialApp(
theme: theme,
Expand Down
41 changes: 21 additions & 20 deletions lib/components/windows_buttons.dart
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
import 'package:assistantapps_flutter_common/assistantapps_flutter_common.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';
// import 'package:bitsdojo_window/bitsdojo_window.dart';
import 'package:flutter/material.dart';

class WindowButtons extends StatelessWidget {
const WindowButtons({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
Color hoverColour = getTheme().getSecondaryColour(context);
Color textColour = getTheme().getTextColour(context);
Color textHoverColour = getTheme().getForegroundTextColour(hoverColour);
// Color hoverColour = getTheme().getSecondaryColour(context);
// Color textColour = getTheme().getTextColour(context);
// Color textHoverColour = getTheme().getForegroundTextColour(hoverColour);

WindowButtonColors buttonColors = WindowButtonColors(
mouseOver: hoverColour,
mouseDown: hoverColour,
iconNormal: textColour,
iconMouseOver: textHoverColour,
);
// WindowButtonColors buttonColors = WindowButtonColors(
// mouseOver: hoverColour,
// mouseDown: hoverColour,
// iconNormal: textColour,
// iconMouseOver: textHoverColour,
// );

WindowButtonColors closeButtonColors = WindowButtonColors(
mouseOver: HexColor('E81123'),
mouseDown: HexColor('E81123'),
iconNormal: textColour,
iconMouseOver: textHoverColour,
);
// WindowButtonColors closeButtonColors = WindowButtonColors(
// mouseOver: HexColor('E81123'),
// mouseDown: HexColor('E81123'),
// iconNormal: textColour,
// iconMouseOver: textHoverColour,
// );

return Row(
return const Row(
mainAxisSize: MainAxisSize.max,
children: [
MinimizeWindowButton(colors: buttonColors),
MaximizeWindowButton(colors: buttonColors),
CloseWindowButton(colors: closeButtonColors),
EmptySpace1x(),
// MinimizeWindowButton(colors: buttonColors),
// MaximizeWindowButton(colors: buttonColors),
// CloseWindowButton(colors: closeButtonColors),
],
);
}
Expand Down
8 changes: 4 additions & 4 deletions lib/constants/app_available_languages.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import 'package:assistantapps_flutter_common/assistantapps_flutter_common.dart';
List<LocalizationMap> supportedLanguageMaps = [
LocalizationMap(LocaleKey.english, 'en', 'gb', percentageComplete: 100),
LocalizationMap(LocaleKey.dutch, 'nl', 'nl', percentageComplete: 77),
LocalizationMap(LocaleKey.german, 'de', 'de', percentageComplete: 99),
LocalizationMap(LocaleKey.german, 'de', 'de', percentageComplete: 100),
LocalizationMap(LocaleKey.french, 'fr', 'fr', percentageComplete: 99),
LocalizationMap(LocaleKey.italian, 'it', 'it', percentageComplete: 98),
LocalizationMap(LocaleKey.russian, 'ru', 'ru', percentageComplete: 99),
LocalizationMap(LocaleKey.polish, 'pl', 'pl', percentageComplete: 98),
LocalizationMap(LocaleKey.brazilianPortuguese, 'pt-br', 'br', percentageComplete: 99),
LocalizationMap(LocaleKey.brazilianPortuguese, 'pt-br', 'br', percentageComplete: 100),
LocalizationMap(LocaleKey.portuguese, 'pt', 'pt', percentageComplete: 36),
LocalizationMap(LocaleKey.norwegian, 'no', 'no', percentageComplete: 77),
LocalizationMap(LocaleKey.romanian, 'ro', 'ro', percentageComplete: 38),
LocalizationMap(LocaleKey.spanish, 'es', 'es', percentageComplete: 99),
LocalizationMap(LocaleKey.czech, 'cs', 'cz', percentageComplete: 98),
LocalizationMap(LocaleKey.turkish, 'tr', 'tr', percentageComplete: 98),
LocalizationMap(LocaleKey.hungarian, 'hu', 'hu', percentageComplete: 97),
LocalizationMap(LocaleKey.simplifiedChinese, 'zh-hans', 'cn', percentageComplete: 99),
LocalizationMap(LocaleKey.simplifiedChinese, 'zh-hans', 'cn', percentageComplete: 100),
LocalizationMap(LocaleKey.traditionalChinese, 'zh-hant', 'cn', percentageComplete: 60),
LocalizationMap(LocaleKey.arabic, 'ar', 'ae', percentageComplete: 11),
LocalizationMap(LocaleKey.vietnamese, 'vi-vn', 'vn', percentageComplete: 86),
Expand All @@ -27,7 +27,7 @@ List<LocalizationMap> supportedLanguageMaps = [
LocalizationMap(LocaleKey.malaysian, 'ms', 'my', percentageComplete: 84),
LocalizationMap(LocaleKey.tagalog, 'tl', 'ph', percentageComplete: 0),
LocalizationMap(LocaleKey.japanese, 'ja', 'jp', percentageComplete: 10),
LocalizationMap(LocaleKey.ukrainian, 'uk', 'ua', percentageComplete: 40),
LocalizationMap(LocaleKey.ukrainian, 'uk', 'ua', percentageComplete: 47),
LocalizationMap(LocaleKey.korean, 'kr', 'kr', percentageComplete: 95),
LocalizationMap(LocaleKey.afrikaans, 'af', 'za', percentageComplete: 58),

Expand Down
20 changes: 9 additions & 11 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import 'package:assistantapps_flutter_common/assistantapps_flutter_common.dart';
import 'package:assistantnms_app/env/platform_type.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:bitsdojo_window/bitsdojo_window.dart';

import 'app.dart';
import 'env.dart';
import 'assistant_apps_settings.dart';
import 'env.dart';
import 'env/environment_settings.dart';

Future main() async {
Expand All @@ -31,12 +29,12 @@ Future main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(AssistantNMS(env));

if (isDesktop) {
doWhenWindowReady(() {
const initialSize = Size(400, 600);
appWindow.minSize = initialSize;
appWindow.alignment = Alignment.center;
appWindow.show();
});
}
// if (isDesktop) {
// doWhenWindowReady(() {
// const initialSize = Size(400, 600);
// appWindow.minSize = initialSize;
// appWindow.alignment = Alignment.center;
// appWindow.show();
// });
// }
}
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ packages:
source: hosted
version: "3.1.2"
bitsdojo_window:
dependency: "direct main"
dependency: transitive
description:
name: bitsdojo_window
sha256: "88ef7765dafe52d97d7a3684960fb5d003e3151e662c18645c1641c22b873195"
Expand Down
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ publish_to: "none"

environment:
sdk: ">=3.2.0 <4.0.0"
flutter: ">=1.17.0"
flutter: 3.19.0

dependencies:
flutter:
Expand All @@ -33,7 +33,6 @@ dependencies:
after_layout: 1.2.0
avatar_glow: 3.0.1
assets_audio_player: 3.1.1
bitsdojo_window: 0.1.6
bubble: 1.2.1
collection: 1.19.0
dots_indicator: 3.0.0
Expand Down
5 changes: 1 addition & 4 deletions windows/runner/main.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
#include <flutter/dart_project.h>
#include <flutter/flutter_view_controller.h>
#include <bitsdojo_window_windows/bitsdojo_window_plugin.h>
#include <windows.h>

#include "flutter_window.h"
#include "utils.h"

auto bdw = bitsdojo_window_configure(BDW_CUSTOM_FRAME | BDW_HIDE_ON_STARTUP);

int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
_In_ wchar_t *command_line, _In_ int show_command)
{
Expand All @@ -31,7 +28,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,

FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(500, 800);
Win32Window::Size size(800, 800);
if (!window.CreateAndShow(L"Assistant for No Man's Sky", origin, size))
{
return EXIT_FAILURE;
Expand Down

0 comments on commit c285929

Please sign in to comment.