Skip to content

馃悰 Select Initial Path on the navigation pane聽#1147

Description

@Harshul2023
class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    final appTheme = Get.put(AppThemeController());

    // Use Obx for reactive state management
    return FluentApp.router(
      title: appTitle,
      // themeMode: appTheme.mode,
      debugShowCheckedModeBanner: false,
      // // color: appTheme.color,
      // darkTheme: FluentThemeData(
      //   brightness: Brightness.dark,
      //   // accentColor: appTheme.color,
      //   visualDensity: VisualDensity.standard,
      //   focusTheme: FocusThemeData(
      //     glowFactor: is10footScreen(context) ? 2.0 : 0.0,
      //   ),
      // ),
      theme: FluentThemeData(
        navigationPaneTheme: NavigationPaneThemeData(
          tileColor: WidgetStateProperty.all(
              NAVIGATION_MENU_BACKGROUND.withOpacity(0.2)),

          labelPadding: EdgeInsets.symmetric(vertical: 15),
          highlightColor: SELCTED_NAVIGATION_COLOR,

          overlayBackgroundColor: Colors.transparent,
          backgroundColor: NAVIGATION_MENU_BACKGROUND,
          // Ensure background matches theme
          selectedIconColor:
              WidgetStateProperty.all(Color.fromRGBO(255, 255, 255, 0.8)),
          selectedTextStyle: WidgetStateProperty.all(TextStyle(
              color: Colors.white, fontWeight: FontWeight.w600, fontSize: 16)),
          unselectedTextStyle: WidgetStateProperty.all(TextStyle(
              color: Colors.white, fontWeight: FontWeight.w400, fontSize: 16)),
          unselectedIconColor: WidgetStateProperty.all(Colors.white),
          selectedTopTextStyle: WidgetStateProperty.all(TextStyle(
              color: Colors.red, fontWeight: FontWeight.w600, fontSize: 16)),
        ),
        brightness: Brightness.light,
        accentColor: Colors.blue,
        menuColor: Colors.black,
        scaffoldBackgroundColor: Colors.white,
      ),
      // locale: appTheme.locale,
      builder: (context, child) {
        return Obx(() {
          return Get.find<SideBarController>().isLogin.value
              ? Directionality(
            textDirection: appTheme.textDirection.value,
            child: NavigationPaneTheme(
              data: NavigationPaneThemeData(),
              child: child!,
            ),
          )
              : LoginScreen();
        });
        // return
        // return Container(color: Colors.red,);
      },
      routeInformationParser: router.routeInformationParser,
      routerDelegate: router.routerDelegate,
      routeInformationProvider: router.routeInformationProvider,
    );
  }
}

i am using the exmple application only
but depending upon the isLoginState i want to show login page else the MyApp Page
Is there a way i can decide on which path i want to go
like from login page i want to go to buttons, or popups and that tab is opened directly instead of "/"

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions