Skip to content

Commit

Permalink
Updated README and removed the temporary use of upgrader.
Browse files Browse the repository at this point in the history
  • Loading branch information
larryaasen committed Jan 6, 2025
1 parent 48d6f5f commit a00d292
Show file tree
Hide file tree
Showing 15 changed files with 458 additions and 89 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
This is a monorepo containing these packages:
- [tide](packages/tide_kit/)
- [tide_kit](packages/tide_kit/)
18 changes: 0 additions & 18 deletions packages/tide_kit/.flutter-plugins

This file was deleted.

1 change: 0 additions & 1 deletion packages/tide_kit/.flutter-plugins-dependencies

This file was deleted.

228 changes: 228 additions & 0 deletions packages/tide_kit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ This section defines key concepts of Tide Kit.

# Getting started

### Example 1
When implementing a new app with Tide, start with this example to display a standard workbench with a
status bar, and Tide initialization.
```dart
Expand All @@ -74,13 +75,240 @@ void main() {
}
```

When running this code on macOS you should see a window like this:
![Screenshot](doc/tide_example_1.png)

Note that the use of `TideApp` is optional and does not affect the functionality of the Tide app.
It is provided as a convenience to help you get started with your app.

For more detailed examples, look at the `example/lib/main.dart` file [here](https://github.com/larryaasen/tide/tree/main/packages/tide_kit/example/lib/main.dart).

When adding Tide to an existing app, just start with a `TideWindow`.

### Example 2
Here is an example with an activity bar and a status bar item for the current time.
When running this code on macOS you should see a window like this:
```dart
void main() {
final tide = Tide();
tide.useServices(services: [Tide.ids.service.time]);
final workbenchService = Tide.get<TideWorkbenchService>();
workbenchService.layoutService.addActivityBarItems([
TideActivityBarItem(title: 'Explorer', icon: Icons.file_copy_outlined),
TideActivityBarItem(title: 'Search', icon: Icons.search_outlined),
TideActivityBarItem(title: 'Share', icon: Icons.share_outlined),
TideActivityBarItem(
title: 'Settings',
icon: Icons.settings_outlined,
position: TideActivityBarItemPosition.end),
]);
runApp(
TideApp(
home: TideWindow(
workbench: TideWorkbench(
activityBar: const TideActivityBar(),
statusBar: TideStatusBar(
items: [
TideStatusBarItemTime(position: TideStatusBarItemPosition.right)
],
),
),
),
),
);
}
```
![Screenshot](doc/tide_example_2.png)

### Example 3
Here is a more extensive example with left and right panels, activity bar, and a few status bar items.
When running this code on macOS you should see a window like this:
```dart
void main() {
final tide = Tide();
tide.useServices(services: [
Tide.ids.service.notifications,
Tide.ids.service.time,
]);
final leftPanelId = TideId.uniqueId();
final mainPanelId = TideId.uniqueId();
final workbenchService = Tide.get<TideWorkbenchService>();
workbenchService.layoutService.addPanels([
TidePanel(panelId: leftPanelId),
TidePanel(panelId: mainPanelId),
]);
workbenchService.layoutService.addActivityBarItems([
TideActivityBarItem(
title: 'Calendar Day',
icon: Icons.calendar_month,
),
]);
final tideOS = TideOS();
final statusBarColor = ValueNotifier<Color?>(null);
TideNotification? timeNotification;
tide.workbenchService.layoutService.addStatusBarItem(TideStatusBarItem(
position: TideStatusBarItemPosition.left,
builder: (context, item) {
return TideStatusBarItemContainer(
item: item,
onPressed: (TideStatusBarItem item) {
statusBarColor.value =
statusBarColor.value == null ? Colors.red : null;
},
tooltip: 'Click to toggle the status bar',
child: const Row(
children: [
Icon(Icons.sync, size: 16.0, color: Colors.white),
SizedBox(width: 4.0),
Text('Toggle status bar', style: TideStatusBarItemTextWidget.style),
],
),
);
},
));
num progressWorked = 0;
final progressItem = TideStatusBarItemProgress(
position: TideStatusBarItemPosition.center,
infinite: false,
progressTotal: 10.0,
progressWorked: progressWorked,
onPressedClose: (TideStatusBarItem item) {
if (item is TideStatusBarItemProgress) {
final newItem = item.copyWith(infinite: true);
tide.workbenchService.layoutService.replaceStatusBarItem(newItem);
}
},
tooltip: 'Click to restart the progress bar',
);
tide.workbenchService.layoutService.addStatusBarItem(progressItem);
Timer.periodic(const Duration(milliseconds: 250), (timer) {
final item = tide.workbenchService.layoutService.statusBarState.value
.getItem(progressItem.itemId);
if (item is TideStatusBarItemProgress) {
if (!item.infinite) {
progressWorked = progressWorked == 10 ? 0 : progressWorked + 1;
final newItem = item.copyWith(progressWorked: progressWorked);
tide.workbenchService.layoutService.replaceStatusBarItem(newItem);
}
}
});
tide.workbenchService.layoutService.addStatusBarItem(TideStatusBarItem(
position: TideStatusBarItemPosition.right,
builder: (context, item) {
return TideStatusBarItemContainer(
item: item,
tooltip: 'Account',
child:
const Icon(Icons.account_circle, size: 16.0, color: Colors.white),
);
},
));
tide.workbenchService.layoutService.addStatusBarItem(TideStatusBarItemText(
position: TideStatusBarItemPosition.right,
onPressed: (TideStatusBarItem item) {
final notificationService = Tide.get<TideNotificationService>();
final notification = TideNotification(
message: 'Flutter: Hot reloading...',
severity: TideNotificationSeverity.info,
autoTimeout: true,
progressInfinite: true);
notificationService.notify(notification);
final msg2 =
'${tideOS.currentTypeFormatted} ${tideOS.operatingSystemVersion}';
notificationService.warning(msg2, autoTimeout: true);
final msg1 =
'${tideOS.currentTypeFormatted} ${tideOS.operatingSystemVersion}'
' This is a very long message to test out lots of wrapping across this notification.';
notificationService.error(msg1, autoTimeout: true);
final msg =
'${tideOS.currentTypeFormatted} ${tideOS.operatingSystemVersion}';
notificationService.info(msg, autoTimeout: true, allowClose: false);
},
text: tideOS.currentTypeFormatted,
tooltip: 'OS Type',
));
tide.workbenchService.layoutService.addStatusBarItem(TideStatusBarItemTime(
position: TideStatusBarItemPosition.right,
tooltip: 'The current time',
onPressed: (TideStatusBarItem item) {
final notificationService = Tide.get<TideNotificationService>();
if (timeNotification == null ||
!notificationService.notificationExists(timeNotification!.id)) {
final timeService = Tide.get<TideTimeService>();
final msg =
'The time is: ${timeService.currentTimeState.timeFormatted()}';
timeNotification =
notificationService.info(msg, autoTimeout: true, allowClose: false);
}
},
));
tide.workbenchService.layoutService.addStatusBarItem(TideStatusBarItem(
position: TideStatusBarItemPosition.right,
builder: (context, item) {
return TideStatusBarItemContainer(
item: item,
tooltip: 'Notifications',
child: const Icon(Icons.notifications_none_outlined,
size: 16.0, color: Colors.white),
);
},
));
runApp(
ValueListenableBuilder<Color?>(
valueListenable: statusBarColor,
builder: (context, colorValue, child) {
return TideApp(
home: TideWindow(
workbench: TideWorkbench(
activityBar: const TideActivityBar(),
panelBuilder: (context, panel) {
if (panel.panelId.id == leftPanelId.id) {
return TidePanelWidget(
panelId: panel.panelId,
backgroundColor: const Color(0xFFF3F3F3),
position: TidePosition.left,
resizeSide: TidePosition.right,
minWidth: 100,
maxWidth: 450,
initialWidth: 220,
child: const Center(child: Text('Left Panel')),
);
} else if (panel.panelId.id == mainPanelId.id) {
return const TidePanelWidget(
backgroundColor: Colors.white,
expanded: true,
position: TidePosition.center,
child: Center(child: Text('Main Panel')),
);
}
return null;
},
statusBar: TideStatusBar(backgroundColor: colorValue)),
),
);
},
),
);
}
```
![Screenshot](doc/tide_example_3.png)

<!--
# Widgets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_linux/url_launcher_plugin.h>

void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)

list(APPEND FLUTTER_FFI_PLUGIN_LIST
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,6 @@
import FlutterMacOS
import Foundation

import device_info_plus
import package_info_plus
import shared_preferences_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
}
25 changes: 0 additions & 25 deletions packages/tide_kit/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,40 +1,15 @@
PODS:
- device_info_plus (0.0.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
- package_info_plus (0.0.1):
- FlutterMacOS
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- url_launcher_macos (0.0.1):
- FlutterMacOS

DEPENDENCIES:
- device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
- shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`)
- url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`)

EXTERNAL SOURCES:
device_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos
FlutterMacOS:
:path: Flutter/ephemeral
package_info_plus:
:path: Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos
shared_preferences_foundation:
:path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin
url_launcher_macos:
:path: Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos

SPEC CHECKSUMS:
device_info_plus: 1b14eed9bf95428983aed283a8d51cce3d8c4215
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
package_info_plus: 12f1c5c2cfe8727ca46cbd0b26677728972d9a5b
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404

PODFILE CHECKSUM: 236401fc2c932af29a9fcf0e97baeeb2d750d367

Expand Down
18 changes: 0 additions & 18 deletions packages/tide_kit/example/macos/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@
33CC10EB2044A3C60003C045 /* Resources */,
33CC110E2044A8840003C045 /* Bundle Framework */,
3399D490228B24CF009A79C7 /* ShellScript */,
F42EBEEFA71AE94C91FCE9D8 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -405,23 +404,6 @@
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
F42EBEEFA71AE94C91FCE9D8 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@

#include "generated_plugin_registrant.h"

#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
UrlLauncherWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("UrlLauncherWindows"));
}
Loading

0 comments on commit a00d292

Please sign in to comment.