mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-26 00:29:20 +08:00
macos: Remove the ugly title bar of the window
Instead we are creating our own which is of the same color. This isn't perfect, but it's much prettier than what we had before.
This commit is contained in:
20
lib/app.dart
20
lib/app.dart
@ -4,6 +4,7 @@ import 'dart:io' show Platform;
|
||||
import 'package:flutter/foundation.dart' as foundation;
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:bitsdojo_window/bitsdojo_window.dart';
|
||||
import 'package:device_info/device_info.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:easy_localization_loader/easy_localization_loader.dart';
|
||||
@ -313,7 +314,7 @@ class _JournalAppState extends State<JournalApp> {
|
||||
);
|
||||
*/
|
||||
|
||||
return MaterialApp(
|
||||
var app = MaterialApp(
|
||||
key: const ValueKey("App"),
|
||||
navigatorKey: _navigatorKey,
|
||||
title: 'GitJournal',
|
||||
@ -343,6 +344,23 @@ class _JournalAppState extends State<JournalApp> {
|
||||
return r;
|
||||
},
|
||||
);
|
||||
|
||||
if (Platform.isLinux || Platform.isWindows) {
|
||||
return WindowBorder(
|
||||
color: app.theme!.primaryColor,
|
||||
child: app,
|
||||
);
|
||||
}
|
||||
if (Platform.isMacOS) {
|
||||
return Container(
|
||||
color: app.theme!.primaryColor,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.fromLTRB(0, 24.0, 0, 0),
|
||||
child: app,
|
||||
),
|
||||
);
|
||||
}
|
||||
return app;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
import FlutterMacOS
|
||||
import Foundation
|
||||
|
||||
import bitsdojo_window_macos
|
||||
import connectivity_macos
|
||||
import package_info
|
||||
import package_info_plus_macos
|
||||
@ -15,6 +16,7 @@ import sqflite
|
||||
import url_launcher_macos
|
||||
|
||||
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
|
||||
BitsdojoWindowPlugin.register(with: registry.registrar(forPlugin: "BitsdojoWindowPlugin"))
|
||||
ConnectivityPlugin.register(with: registry.registrar(forPlugin: "ConnectivityPlugin"))
|
||||
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
|
||||
FLTPackageInfoPlugin.register(with: registry.registrar(forPlugin: "FLTPackageInfoPlugin"))
|
||||
|
@ -1,4 +1,6 @@
|
||||
PODS:
|
||||
- bitsdojo_window_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
- connectivity_macos (0.0.1):
|
||||
- FlutterMacOS
|
||||
- Reachability
|
||||
@ -29,6 +31,7 @@ PODS:
|
||||
- FlutterMacOS
|
||||
|
||||
DEPENDENCIES:
|
||||
- bitsdojo_window_macos (from `Flutter/ephemeral/.symlinks/plugins/bitsdojo_window_macos/macos`)
|
||||
- connectivity_macos (from `Flutter/ephemeral/.symlinks/plugins/connectivity_macos/macos`)
|
||||
- FlutterMacOS (from `Flutter/ephemeral`)
|
||||
- package_info (from `Flutter/ephemeral/.symlinks/plugins/package_info/macos`)
|
||||
@ -46,6 +49,8 @@ SPEC REPOS:
|
||||
- Sentry
|
||||
|
||||
EXTERNAL SOURCES:
|
||||
bitsdojo_window_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/bitsdojo_window_macos/macos
|
||||
connectivity_macos:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/connectivity_macos/macos
|
||||
FlutterMacOS:
|
||||
@ -66,6 +71,7 @@ EXTERNAL SOURCES:
|
||||
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
bitsdojo_window_macos: 7e9b1bbb09bdce418d9657ead7fc9d824203ff0d
|
||||
connectivity_macos: 9f30e9d0e67a0bc08a0c563ee82310b51ca6e818
|
||||
FlutterMacOS: 57701585bf7de1b3fc2bb61f6378d73bbdea8424
|
||||
FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a
|
||||
|
@ -1,7 +1,13 @@
|
||||
import Cocoa
|
||||
import FlutterMacOS
|
||||
import bitsdojo_window_macos
|
||||
|
||||
class MainFlutterWindow: BitsdojoWindow {
|
||||
|
||||
override func bitsdojo_window_configure() -> UInt {
|
||||
return BDW_CUSTOM_FRAME
|
||||
}
|
||||
|
||||
class MainFlutterWindow: NSWindow {
|
||||
override func awakeFromNib() {
|
||||
let flutterViewController = FlutterViewController.init()
|
||||
let windowFrame = self.frame
|
||||
|
35
pubspec.lock
35
pubspec.lock
@ -64,6 +64,41 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.0.0"
|
||||
bitsdojo_window:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: bitsdojo_window
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1+1"
|
||||
bitsdojo_window_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bitsdojo_window_linux
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.1"
|
||||
bitsdojo_window_macos:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bitsdojo_window_macos
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
bitsdojo_window_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bitsdojo_window_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
bitsdojo_window_windows:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: bitsdojo_window_windows
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.1.0"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -77,6 +77,7 @@ dependencies:
|
||||
yaml_serializer: ^0.0.11
|
||||
collection: ^1.15.0-nullsafety.4
|
||||
flex_color_scheme: ^2.1.1
|
||||
bitsdojo_window: ^0.1.1+1
|
||||
|
||||
dev_dependencies:
|
||||
#flutter_driver:
|
||||
|
Reference in New Issue
Block a user