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

[WIP] Adaptive scaffold #102

Open
wants to merge 21 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 30 additions & 41 deletions example/lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,12 @@ class _HomeState extends ConsumerState<Home> {
Widget build(BuildContext context) {
// final bool showSearch = ref.watch(searchProvider);

final NavigationItem hello = NavigationItem(
title: Strings.hello,
icon: Icons.emoji_emotions_outlined,
selectedIcon: Icons.emoji_emotions,
builder: (_) => const HelloWorld(),
);

final MasterNavigationItem helloMaster = MasterNavigationItem(
title: Strings.hello,
leading: const Icon(Icons.emoji_emotions_outlined),
builder: (_) => const HelloWorld(),
);

final NavigationItem widgets = NavigationItem(
title: Strings.widgets,
icon: Icons.widgets_outlined,
selectedIcon: Icons.widgets,
// headerBarLeading: ArnaButton.icon(
// icon: Icons.search_outlined,
// onPressed: () => ref.read(searchProvider.notifier).state = !showSearch,
// tooltipMessage: Strings.search,
// ),
builder: (_) => const Widgets(),
);

final MasterNavigationItem widgetsMaster = MasterNavigationItem(
title: Strings.widgets,
leading: const Icon(Icons.widgets_outlined),
Expand All @@ -57,26 +38,12 @@ class _HomeState extends ConsumerState<Home> {
builder: (_) => const Widgets(),
);

final NavigationItem typography = NavigationItem(
title: Strings.typography,
icon: Icons.font_download_outlined,
selectedIcon: Icons.font_download,
builder: (_) => const Typography(),
);

final MasterNavigationItem typographyMaster = MasterNavigationItem(
title: Strings.typography,
leading: const Icon(Icons.font_download_outlined),
builder: (_) => const Typography(),
);

final NavigationItem tabs = NavigationItem(
title: Strings.tabs,
icon: Icons.tab_outlined,
selectedIcon: Icons.tab,
builder: (_) => const Tabs(),
);

final MasterNavigationItem tabsMaster = MasterNavigationItem(
title: Strings.tabs,
leading: const Icon(Icons.tab_outlined),
Expand Down Expand Up @@ -126,15 +93,37 @@ class _HomeState extends ConsumerState<Home> {
],
)
: ArnaSideScaffold(
title: Strings.appName,
actions: actions,
leading: leadingWidget,
items: <NavigationItem>[
hello,
widgets,
typography,
tabs,
headerBar: ArnaHeaderBar(
title: Strings.appName,
actions: actions,
),
destinations: <ArnaNavigationDestination>[
ArnaNavigationDestination(
label: Strings.hello,
icon: Icons.emoji_emotions_outlined,
selectedIcon: Icons.emoji_emotions,
body: (_) => const HelloWorld(),
),
ArnaNavigationDestination(
label: Strings.widgets,
icon: Icons.widgets_outlined,
selectedIcon: Icons.widgets,
body: (_) => const Widgets(),
),
ArnaNavigationDestination(
label: Strings.typography,
icon: Icons.font_download_outlined,
selectedIcon: Icons.font_download,
body: (_) => const Typography(),
),
ArnaNavigationDestination(
label: Strings.tabs,
icon: Icons.tab_outlined,
selectedIcon: Icons.tab,
body: (_) => const Tabs(),
),
],
navigationPaneLeading: leadingWidget,
);
}
}
13 changes: 8 additions & 5 deletions lib/arna.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export 'package:arna/src/base/avatar.dart';
export 'package:arna/src/base/banner.dart';
export 'package:arna/src/base/base_widget.dart';
export 'package:arna/src/base/body.dart';
export 'package:arna/src/base/bottom_bar.dart';
export 'package:arna/src/base/bottom_bar_item.dart';
export 'package:arna/src/base/date.dart';
export 'package:arna/src/base/desktop_text_selection.dart';
export 'package:arna/src/base/divider.dart';
Expand All @@ -27,18 +25,17 @@ export 'package:arna/src/base/page.dart';
export 'package:arna/src/base/page_indicator.dart';
export 'package:arna/src/base/progress_indicator.dart';
export 'package:arna/src/base/route.dart';
export 'package:arna/src/base/scaffold.dart';
export 'package:arna/src/base/scroll_bar.dart';
export 'package:arna/src/base/search_field.dart';
export 'package:arna/src/base/selectable_text.dart';
export 'package:arna/src/base/side_bar_item.dart';
export 'package:arna/src/base/side_scaffold.dart';
export 'package:arna/src/base/snack_bar.dart';
export 'package:arna/src/base/tab_item.dart';
export 'package:arna/src/base/tab_view.dart';
export 'package:arna/src/base/text_selection.dart';
export 'package:arna/src/base/tooltip.dart';
export 'package:arna/src/containers/badge.dart';
export 'package:arna/src/containers/bottom_navigation_bar/bottom_navigation_bar.dart';
export 'package:arna/src/containers/bottom_navigation_bar/bottom_navigation_bar_item.dart';
export 'package:arna/src/containers/card.dart';
export 'package:arna/src/containers/expansion_panel.dart';
export 'package:arna/src/containers/grid_tile.dart';
Expand All @@ -49,9 +46,15 @@ export 'package:arna/src/containers/header_bar/header_bar_divider.dart';
export 'package:arna/src/containers/header_bar/header_bar_item.dart';
export 'package:arna/src/containers/header_bar/overflow_handler.dart';
export 'package:arna/src/containers/header_bar/sliver_header_bar.dart';
export 'package:arna/src/containers/layouts/adaptive_layout.dart';
export 'package:arna/src/containers/list.dart';
export 'package:arna/src/containers/list_tile.dart';
export 'package:arna/src/containers/navigation_pane/navigation_pane.dart';
export 'package:arna/src/containers/navigation_pane/navigation_pane_item.dart';
export 'package:arna/src/containers/reorderable_list.dart';
export 'package:arna/src/containers/scaffolds/adaptive_scaffold.dart';
export 'package:arna/src/containers/scaffolds/scaffold.dart';
export 'package:arna/src/containers/scaffolds/side_scaffold.dart';
export 'package:arna/src/controls/buttons/back_button.dart';
export 'package:arna/src/controls/buttons/button.dart';
export 'package:arna/src/controls/buttons/close_button.dart';
Expand Down
48 changes: 0 additions & 48 deletions lib/src/base/bottom_bar.dart

This file was deleted.

14 changes: 5 additions & 9 deletions lib/src/base/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ArnaDrawer extends StatelessWidget {
super.key,
this.child,
this.semanticLabel,
this.padding,
});

/// The widget below this widget in the tree.
Expand All @@ -32,9 +33,11 @@ class ArnaDrawer extends StatelessWidget {
/// * [SemanticsConfiguration.namesRoute], for a description of how this value is used.
final String? semanticLabel;

/// Empty space to surround the drawer.
final EdgeInsetsGeometry? padding;

@override
Widget build(BuildContext context) {
final bool ltr = Directionality.of(context) == TextDirection.ltr;
return Semantics(
scopesRoute: true,
namesRoute: true,
Expand All @@ -49,16 +52,9 @@ class ArnaDrawer extends StatelessWidget {
),
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
borderRadius: BorderRadius.horizontal(
left: ltr
? Radius.zero
: const Radius.circular(Styles.drawerBorderRadiusSize),
right: ltr
? const Radius.circular(Styles.drawerBorderRadiusSize)
: Radius.zero,
),
color: ArnaColors.sideColor.resolveFrom(context),
),
margin: padding,
child: FocusTraversalGroup(
child: SafeArea(child: child ?? const SizedBox.shrink()),
),
Expand Down
Loading