Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 1.6.0 - MacosTabView & MacosSegmentedControl #273

Merged
merged 18 commits into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 2 additions & 5 deletions example/lib/pages/tabview_page.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import 'package:flutter/cupertino.dart';
GroovinChip marked this conversation as resolved.
Show resolved Hide resolved
import 'package:flutter/material.dart';
import 'package:macos_ui/macos_ui.dart';

class TabViewPage extends StatefulWidget {
Expand Down Expand Up @@ -27,18 +27,15 @@ class _TabViewPageState extends State<TabViewPage> {
padding: const EdgeInsets.all(24.0),
child: MacosTabView(
controller: _controller,
tabs: [
tabs: const [
MacosTab(
label: 'Tab 1',
active: _controller.index == 0,
),
MacosTab(
label: 'Tab 2',
active: _controller.index == 1,
),
MacosTab(
label: 'Tab 3',
active: _controller.index == 2,
),
],
children: const [
Expand Down
6 changes: 3 additions & 3 deletions lib/src/layout/tab_view/tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,19 @@ class MacosTab extends StatelessWidget {
const MacosTab({
super.key,
required this.label,
required this.active,
this.active = false,
});

/// The display label for this tab.
final String label;

/// Whether this [MacosTab] is currently selected.
/// Whether this [MacosTab] is currently selected. Handled internally by
/// [MacosSegmentedControl]'s build function.
final bool active;

@override
Widget build(BuildContext context) {
final brightness = MacosTheme.brightnessOf(context);

return PhysicalModel(
color: active ? const Color(0xFF625E66) : MacosColors.transparent,
borderRadius: _kTabBorderRadius,
Expand Down