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

Add vertical nav bar support #105

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Next Next commit
Nav bar vertical support
Vinicius-8 committed Dec 24, 2024
commit e165e591f04c7be228315478cfef881948a54900
10 changes: 9 additions & 1 deletion lib/src/gnav.dart
Original file line number Diff line number Diff line change
@@ -7,6 +7,11 @@ enum GnavStyle {
oldSchool,
}

enum GnavAxis {
horizontal,
vertical
}

class GNav extends StatefulWidget {
const GNav({
Key? key,
@@ -36,6 +41,7 @@ class GNav extends StatefulWidget {
this.mainAxisAlignment = MainAxisAlignment.spaceBetween,
this.style = GnavStyle.google,
this.textSize,
this.axis = GnavAxis.horizontal
}) : super(key: key);

final List<GButton> tabs;
@@ -64,6 +70,7 @@ class GNav extends StatefulWidget {
final MainAxisAlignment mainAxisAlignment;
final GnavStyle? style;
final double? textSize;
final GnavAxis? axis;

@override
_GNavState createState() => _GNavState();
@@ -91,8 +98,9 @@ class _GNavState extends State<GNav> {
Widget build(BuildContext context) {
return Container(
color: widget.backgroundColor,
child: Row(
child: Flex(
mainAxisAlignment: widget.mainAxisAlignment,
direction: widget.axis == GnavAxis.horizontal ? Axis.horizontal : Axis.vertical,
children: widget.tabs
.map((t) => GButton(
textSize: widget.textSize,