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

Setting leading of NavigationAppBar permanently sets the Leading icon of NavigationPane when it's displayMode is top🐛 #284

Closed
imp-sike opened this issue Apr 11, 2022 · 6 comments · Fixed by #288
Labels
bug Something isn't working

Comments

@imp-sike
Copy link
Contributor

imp-sike commented Apr 11, 2022

Describe the bug
When you set a leading icon using leading property of NavigationAppBar, it permanently sets the Leading icon of NavigationPane when it's displayMode is top. And I do not find any property or methods which can be used to override that icon.

To Reproduce
Code to Reproduce

 @override
  Widget build(BuildContext context) {
    return NavigationView(
        appBar: NavigationAppBar(
         // try removing leading
          leading: const FlutterLogo(),
          title: () {
            return const DragToMoveArea(
              child: Align(
                alignment: AlignmentDirectional.centerStart,
                child: Text("Statistics Helper"),
              ),
            );
          }(),
          actions: kIsWeb
              ? null
              : DragToMoveArea(
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: const [Spacer(), WindowButtons()],
            ),
          ),
        ),
        pane: NavigationPane(

          selected: index,
          displayMode: PaneDisplayMode.top,
          onChanged: (i) => setState(() => index = i),
          size: const NavigationPaneSize(
            openMinWidth: 250,
            openMaxWidth: 320,
          ),


          indicator: () {
            return const EndNavigationIndicator();
          }(),
          items: [
            // It doesn't look good when resizing from compact to open
            // PaneItemHeader(header: Text('User Interaction')),


       
            PaneItem(
              icon: Container(),
              title: const Text('New File'),
            ),




          ],

          footerItems: [
            PaneItemSeparator(),
            PaneItem(

              icon:  Padding(
                padding: const EdgeInsets.all(8.0),
                child: Icon(FluentIcons.play_solid, color: m.Colors.green,),
              ),
              title: const Text('Process'),
            ),
          ],
        ),

        content: Container(
          width: context.width* 0.99,
          child: Column(
            children: [
              Text("Hell")
            ],
          ),
        )
    );
  }

Expected behavior
If this is bug, it must be resolved. If this is a hidden feature, there must be another property of NavigationPane to override the leading Widget.

Screenshots
Check the leading images

P.S. I this is a bug, I would be grateful in helping contributing to it.

@WinXaito
Copy link
Collaborator

See here: https://github.com/bdlukaa/fluent_ui/blob/master/lib/src/controls/navigation/navigation_view/view.dart#L538-L549

  /// The widget at the beggining of the app bar, before [title].
  ///
  /// Typically the [leading] widget is an [Icon] or an [IconButton].
  ///
  /// If this is null and [automaticallyImplyLeading] is set to true, the
  /// view will imply an appropriate widget. If  the parent [Navigator] can
  /// go back, the app bar will use an [IconButton] that calls [Navigator.maybePop].
  ///
  /// See also:
  ///   * [automaticallyImplyLeading], that controls whether we should try to
  ///     imply the leading widget, if [leading] is null
  final Widget? leading;

Do these comments answer your question? Or perhaps I have misunderstood.

@imp-sike
Copy link
Contributor Author

Add a subheading

When I set
leading: const FlutterLogo(),
in NavigationAppBar same icon seems to appear as NavigationPane leading icons as shown in the image above. And if I am correct, thers is no any leading property to either disable or change the NavigationPane icon.

@fraser-mendeco
Copy link

I'm having this issue too.

Minimal code to reproduce below. See the blue CircleAvatar is rendered twice.

import 'package:fluent_ui/fluent_ui.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return FluentApp(
      title: 'Flutter Demo',
      home: NavigationView(
        appBar: const NavigationAppBar(
          leading: CircleAvatar(),
          title: Text('Flutter Demo'),
        ),
        pane: NavigationPane(
          displayMode: PaneDisplayMode.top,
          items: [
            PaneItem(
              icon: const Icon(FluentIcons.add),
            ),
          ],
        ),
      ),
    );
  }
}

Result
image

@WinXaito
Copy link
Collaborator

Okay, understood. This is effectively a bug.

@WinXaito WinXaito added the bug Something isn't working label Apr 12, 2022
@imp-sike
Copy link
Contributor Author

Can i work on this BTW. I am new to contributing.

@WinXaito
Copy link
Collaborator

Yeah of course, don't hesitate to open a Pull request.

Don't hesite to join the discord for any help or discussion

;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants