Skip to content

Commit

Permalink
feat: navigation drawer (#566)
Browse files Browse the repository at this point in the history
* feat: Add VoicesAppBar (#531)

* feat: Add new colors and definitions to Catalyst Theme.

* feat: Add VoicesAppBar and sub-actions.

* feat: Add CatalystVoicesIcons set.

* feat: Update actions components to use CatalystVoices icons.

* feat: Add VoicesAppBar widget.

* docs: Add docs for actions widgets.

* feat: Add search button.

* feat: Update unlock icon to use CatalystVoices icon set.

* feat: Add SearchButton to VoicesAppBar.

* feat: Restore `flutter_adaptive_scaffold` version and add `catalyts_voices_brands`.

* feat: Move icons to right for action buttons.

* chore: Removed unused import.

* Fix: Point `flutter-ci` to main branch.

* chore: Change typedef of button callbacks.

* chore: Rename chevron icons.

---------

Co-authored-by: Steven Johnson <stevenj@users.noreply.github.com>

* fix: Fix .earthlyignore excluded directories/files (#536)

* Update .earthlyignore

* chore: ignore Earthfile in .earthfileignore

* fix: catalyst cardano support for NFTs (#537)

* feat: add catalyst_cardano wallet api

* feat: add error handling

* fix: tests

* docs: update toc

* docs: fix readme

* fix: decrement package version

* feat: add missing import

* fix: assets path

* fix: add missing dependency

* feat: add example

* feat: add error case

* refactor: rename getCardanoWallets

* fix: method name

* chore: ignore flutter plugins generated files

* feat: cardano wallet api example (#523)

* feat: add missing import

* fix: assets path

* fix: add missing dependency

* feat: add example

* fix: method name

* fix: balance with multi asset tokens

* feat: parse value from utxo

* fix: utxo formatting

* feat: update example

* feat: code adjust

* fix: balance

* feat: parse multi assets

* feat: add multi assets arithmetics

* feat: adjust code to latest changes

* fix: assets cleanup

* feat: support native tokens in utxos

* fix: multi asset change calculation

* fix: change calculation

* refactor: cleanup code

* Update .earthlyignore

* chore: ignore Earthfile in .earthfileignore

* docs: update example

* docs: update readme

* refactor: cleanup code

* docs: readme

* docs: improve grammar

* refactor: rename value to balance

* docs: fix

---------

Co-authored-by: Dominik Toton <dominik@mealtime.de>

* feat: cardano wallet cip 95 (#538)

* feat: add catalyst_cardano wallet api

* feat: add error handling

* fix: tests

* docs: update toc

* docs: fix readme

* fix: decrement package version

* feat: add missing import

* fix: assets path

* fix: add missing dependency

* feat: add example

* feat: add error case

* refactor: rename getCardanoWallets

* fix: method name

* chore: ignore flutter plugins generated files

* feat: cardano wallet api example (#523)

* feat: add missing import

* fix: assets path

* fix: add missing dependency

* feat: add example

* fix: method name

* fix: balance with multi asset tokens

* feat: parse value from utxo

* fix: utxo formatting

* feat: update example

* feat: code adjust

* fix: balance

* feat: parse multi assets

* feat: add multi assets arithmetics

* feat: adjust code to latest changes

* fix: assets cleanup

* feat: support native tokens in utxos

* fix: multi asset change calculation

* fix: change calculation

* refactor: cleanup code

* Update .earthlyignore

* chore: ignore Earthfile in .earthfileignore

* docs: update example

* docs: update readme

* refactor: cleanup code

* docs: readme

* feat: add cip 95

* fix: cip95 deserialization

* refactor: formatting

* docs: improve grammar

* refactor: rename value to balance

* docs: fix

---------

Co-authored-by: Dominik Toton <dominik@mealtime.de>

* docs: add common issues docs (#548)

* docs: add common issues docs

* docs: fix readme formatting

* feat: use theme builder

* chore: enable earthly files

* chore: enable disabled earthly target

* chore: rerun target without cache

* chore: no-cache earthly target

* chore: trigger rebuild

* refactor: extract widget

* feat: uikit example

* feat: voices drawer

* feat: finish nav drawer

* feat: add docs and voices list tiles

* feat: update to named navigation to preserve route when hot restarting

* refactor: cleanup code

---------

Co-authored-by: Lucio Baglione <coire1@gmail.com>
Co-authored-by: Steven Johnson <stevenj@users.noreply.github.com>
Co-authored-by: Dominik Toton <dominik@mealtime.de>
Co-authored-by: Oleksandr Prokhorenko <djminikin@gmail.com>
  • Loading branch information
5 people authored Jun 24, 2024
1 parent f99e0be commit 07baa07
Show file tree
Hide file tree
Showing 14 changed files with 744 additions and 171 deletions.
3 changes: 2 additions & 1 deletion .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,5 @@ xctestrun
xcworkspace
yoroi
multiasset
unawaited
unawaited
Gitbook
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
import 'package:catalyst_voices/pages/widgets/menu/voices_list_tile.dart';
import 'package:catalyst_voices_brands/catalyst_voices_brands.dart';
import 'package:flutter/material.dart';

/// A menu item that can be expanded to show the [expandedChildren].
///
/// Works similarly to a dropdown menu but it doesn't create an overlay
/// with the dropdown, it shows the expanded state by growing the widget
/// height to accommodate for the extra children.
class VoicesExpandableListTile extends StatefulWidget {
/// The leading widget put in front of the [title].
final Widget? leading;

/// The trailing widget put in the back of the [title].
final Widget? trailing;

/// The main content of the list tile.
final Widget? title;

/// The expanded children that appear in dropdown-like fashion
/// when the widget is tapped on and expanded.
final List<Widget> expandedChildren;

/// The default constructor for the [VoicesExpandableListTile].
const VoicesExpandableListTile({
super.key,
this.leading,
this.trailing,
this.title,
required this.expandedChildren,
});

@override
State<VoicesExpandableListTile> createState() =>
_VoicesExpandableListTileState();
}

class _VoicesExpandableListTileState extends State<VoicesExpandableListTile> {
bool _isExpanded = false;

@override
Widget build(BuildContext context) {
return Column(
children: [
Container(
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: _isExpanded
? Theme.of(context).colors.onSurfaceSecondary08
: null,
borderRadius: BorderRadius.only(
topLeft: const Radius.circular(25),
topRight: const Radius.circular(25),
bottomLeft: const Radius.circular(25),
bottomRight:
_isExpanded ? Radius.zero : const Radius.circular(25),
),
),
child: VoicesListTile(
title: widget.title,
leading: widget.leading,
trailing: widget.trailing,
onTap: _onToggle,
),
),
if (_isExpanded)
Container(
margin: const EdgeInsets.only(left: 60),
decoration: BoxDecoration(
color: Theme.of(context).colors.onSurfaceSecondary08,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(25),
bottomRight: Radius.circular(25),
),
),
child: Column(
children: widget.expandedChildren,
),
),
],
);
}

void _onToggle() {
setState(() {
_isExpanded = !_isExpanded;
});
}
}
44 changes: 44 additions & 0 deletions catalyst_voices/lib/pages/widgets/menu/voices_list_tile.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';

/// A replacement for the [ListTile] with customized styling.
class VoicesListTile extends StatelessWidget {
/// The leading widget put in front of the [title].
final Widget? leading;

/// The trailing widget put in the back of the [title].
final Widget? trailing;

/// The main content of the list tile.
final Widget? title;

/// A callback called when the widget is pressed.
final VoidCallback? onTap;

/// The default constructor for the [VoicesListTile].
const VoicesListTile({
super.key,
this.leading,
this.trailing,
this.title,
this.onTap,
});

@override
Widget build(BuildContext context) {
final title = this.title;

return ListTile(
title: title == null
? null
: DefaultTextStyle(
style: Theme.of(context).textTheme.labelLarge!,
maxLines: 1,
overflow: TextOverflow.ellipsis,
child: title,
),
leading: leading,
trailing: trailing,
onTap: onTap,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,6 @@ import 'package:flutter/material.dart';
/// display as actions in the app bar.
///
/// A set of possible actions widget are available in the actions subfolder.
///
/// Example usage:
///
/// ```dart
/// Scaffold(
/// appBar: VoicesAppBar(
/// isNavVisible: true,
/// actions: [
/// NotificationsIndicator(
/// badgeText: '5',
/// onPressed: () {},
/// ),
/// UnlockButton(
/// onPressed: () {},
/// ),
/// ],
/// ),
/// body: Center(child: Text('Content')),
/// );
/// ```
class VoicesAppBar extends StatelessWidget implements PreferredSizeWidget {
final bool isNavVisible;
final List<Widget> actions;
Expand All @@ -58,7 +38,11 @@ class VoicesAppBar extends StatelessWidget implements PreferredSizeWidget {
padding: EdgeInsets.only(top: 8, bottom: 8, left: data),
child: IconButton(
color: Theme.of(context).colors.iconsForeground,
onPressed: () {},
onPressed: () {
context
.findAncestorStateOfType<ScaffoldState>()
?.openDrawer();
},
icon: const Icon(CatalystVoicesIcons.menu),
),
)
Expand Down
Loading

0 comments on commit 07baa07

Please sign in to comment.