diff --git a/example/lib/main_area/main_area.dart b/example/lib/main_area/main_area.dart index e22f587..494e8bd 100644 --- a/example/lib/main_area/main_area.dart +++ b/example/lib/main_area/main_area.dart @@ -2,7 +2,6 @@ import 'package:example/main_area/ns_window_delegate_demo/ns_window_delegate_dem import 'package:example/main_area/window_manipulator_demo/window_manipulator_demo.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:macos_ui/macos_ui.dart'; class MainArea extends StatefulWidget { const MainArea({super.key, required this.setState}); @@ -14,14 +13,7 @@ class MainArea extends StatefulWidget { } class _MainAreaState extends State { - final _tabController = MacosTabController(length: 2, initialIndex: 0); - - @override - void initState() { - _tabController.addListener(() => setState(() {})); - - super.initState(); - } + int? currentTabIndex = 0; @override Widget build(BuildContext context) { @@ -29,11 +21,14 @@ class _MainAreaState extends State { children: [ const SizedBox(height: 8.0), _SegmentedControl( - tabController: _tabController, + currentTabIndex: currentTabIndex, + onTabIndexChanged: (newIndex) => setState(() { + currentTabIndex = newIndex; + }), ), Expanded( child: IndexedStack( - index: _tabController.index, + index: currentTabIndex, children: [ WindowManipulatorDemo( setState: widget.setState, @@ -49,23 +44,32 @@ class _MainAreaState extends State { class _SegmentedControl extends StatelessWidget { const _SegmentedControl({ - required this.tabController, + required this.currentTabIndex, + required this.onTabIndexChanged, }); - final MacosTabController tabController; + final int? currentTabIndex; + final void Function(int?) onTabIndexChanged; @override Widget build(BuildContext context) { - return MacosSegmentedControl( - tabs: const [ - MacosTab( - label: 'WindowManipulator demo', + return CupertinoSlidingSegmentedControl( + groupValue: currentTabIndex, + onValueChanged: onTabIndexChanged, + children: const { + 0: Padding( + padding: EdgeInsets.symmetric(horizontal: 20), + child: Text( + 'WindowManipulator demo', + ), ), - MacosTab( - label: 'NSWindowDelegate demo', + 1: Padding( + padding: EdgeInsets.symmetric(horizontal: 20), + child: Text( + 'NSWindowDelegate demo', + ), ), - ], - controller: tabController, + }, ); } } diff --git a/example/macos/Flutter/GeneratedPluginRegistrant.swift b/example/macos/Flutter/GeneratedPluginRegistrant.swift index b06f117..e6397b0 100644 --- a/example/macos/Flutter/GeneratedPluginRegistrant.swift +++ b/example/macos/Flutter/GeneratedPluginRegistrant.swift @@ -5,10 +5,8 @@ import FlutterMacOS import Foundation -import macos_ui import macos_window_utils func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { - MacOSUiPlugin.register(with: registry.registrar(forPlugin: "MacOSUiPlugin")) MacOSWindowUtilsPlugin.register(with: registry.registrar(forPlugin: "MacOSWindowUtilsPlugin")) } diff --git a/example/macos/Podfile.lock b/example/macos/Podfile.lock index 541998c..0fa80de 100644 --- a/example/macos/Podfile.lock +++ b/example/macos/Podfile.lock @@ -1,28 +1,22 @@ PODS: - FlutterMacOS (1.0.0) - - macos_ui (0.1.0): - - FlutterMacOS - macos_window_utils (1.0.0): - FlutterMacOS DEPENDENCIES: - FlutterMacOS (from `Flutter/ephemeral`) - - macos_ui (from `Flutter/ephemeral/.symlinks/plugins/macos_ui/macos`) - macos_window_utils (from `Flutter/ephemeral/.symlinks/plugins/macos_window_utils/macos`) EXTERNAL SOURCES: FlutterMacOS: :path: Flutter/ephemeral - macos_ui: - :path: Flutter/ephemeral/.symlinks/plugins/macos_ui/macos macos_window_utils: :path: Flutter/ephemeral/.symlinks/plugins/macos_window_utils/macos SPEC CHECKSUMS: FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24 - macos_ui: 125c911559d646194386d84c017ad6819122e2db macos_window_utils: 933f91f64805e2eb91a5bd057cf97cd097276663 PODFILE CHECKSUM: 500e4707112a5f11963bc198135953cdebb6d50c -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/example/pubspec.yaml b/example/pubspec.yaml index bb2abc3..0ef89b4 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -47,7 +47,6 @@ dependencies: # Use with the CupertinoIcons class for iOS style icons. cupertino_icons: ^1.0.2 flutter_markdown: ^0.6.13 - macos_ui: ^1.11.1 dev_dependencies: flutter_test: