Skip to content

How to use GetX with navigation drawer #958

Answered by eduardoflorence
daleffe asked this question in Q&A
Discussion options

You must be logged in to vote

I prepared an example for you the way I work with Drawer:

import 'package:flutter/material.dart';
import 'package:get/get.dart';

void main() {
  runApp(GetMaterialApp(
    navigatorKey: Get.key,
    initialRoute: '/home',
    getPages: [
      GetPage(
        name: '/home',
        page: () => Home(),
        binding: HomeBinding(),
      ),
      GetPage(
        name: '/page1',
        page: () => Page1(),
        binding: Page1Binding(),
      ),
      GetPage(
        name: '/page2',
        page: () => Page2(),
        binding: Page2Binding(),
      ),
    ],
  ));
}

class MainDrawer extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Drawer(
  …

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
1 reply
@daleffe
Comment options

Comment options

You must be logged in to vote
3 replies
@daleffe
Comment options

@DominusKelvin
Comment options

@nosadaniel
Comment options

Answer selected by daleffe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants