-1

enter image description here

how to add this side-menu in the android tv app using flutter and how to handle its focus.

I'm using flutter 3.0.0

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

0

there is a pre-built widget that you can use in order to achieve that navigation NavigationRail

you can implement it like this :

 NavigationRail(
          selectedIndex: _selectedIndex,
          groupAlignment: groupAligment,
          onDestinationSelected: (int index) {
            setState(() {
              _selectedIndex = index;
            });
          },
          labelType: labelType,
          leading: showLeading
              ? FloatingActionButton(
                  elevation: 0,
                  onPressed: () {
                    // Add your onPressed code here!
                  },
                  child: const Icon(Icons.add),
                )
              : const SizedBox(),
          trailing: showTrailing
              ? IconButton(
                  onPressed: () {
                    // Add your onPressed code here!
                  },
                  icon: const Icon(Icons.more_horiz_rounded),
                )
              : const SizedBox(),
          destinations: const <NavigationRailDestination>[
            NavigationRailDestination(
              icon: Icon(Icons.favorite_border),
              selectedIcon: Icon(Icons.favorite),
              label: Text('First'),
            ),
            NavigationRailDestination(
              icon: Icon(Icons.bookmark_border),
              selectedIcon: Icon(Icons.book),
              label: Text('Second'),
            ),
            NavigationRailDestination(
              icon: Icon(Icons.star_border),
              selectedIcon: Icon(Icons.star),
              label: Text('Third'),
            ),
          ],
        ),
Gwhyyy
  • 7,554
  • 3
  • 8
  • 35