Skip to content

Conversation

@TahaTesser
Copy link
Member

fixes NavigationRail can't have a transparent Hover color because there is always opacity set

Code sample

expand to view the code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.green).copyWith(
          primary: Colors.transparent,
        ),
      ),
      home: const Example(),
    );
  }
}

class Example extends StatefulWidget {
  const Example({Key? key}) : super(key: key);

  @override
  State<StatefulWidget> createState() => _ExampleState();
}

class _ExampleState extends State<Example> {
  int _selectedIndex = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('NavigationRail Example'),
      ),
      body: Row(
        children: <Widget>[
          NavigationRail(
            selectedIndex: _selectedIndex,
            onDestinationSelected: (int index) {
              setState(() {
                _selectedIndex = index;
              });
            },
            labelType: NavigationRailLabelType.all,
            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'),
              ),
            ],
          ),
          const VerticalDivider(thickness: 1, width: 1),
          Expanded(
            child: Center(
              child: Text('Selected Index: $_selectedIndex'),
            ),
          )
        ],
      ),
    );
  }
}

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Oct 11, 2023
Copy link
Contributor

@HansMuller HansMuller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 13, 2023
@TahaTesser TahaTesser force-pushed the fix_navigation_rail_indicator_ink_transparent branch from aaaf700 to c661de6 Compare October 16, 2023 06:13
@auto-submit auto-submit bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2023
@auto-submit
Copy link
Contributor

auto-submit bot commented Oct 16, 2023

auto label is removed for flutter/flutter/136359, due to - The status or check suite Linux android views has failed. Please fix the issues identified (or deflake) before re-applying this label.

@TahaTesser TahaTesser added the autosubmit Merge PR when tree becomes green via auto submit App label Oct 16, 2023
@auto-submit auto-submit bot merged commit 17c664f into flutter:master Oct 16, 2023
@TahaTesser TahaTesser deleted the fix_navigation_rail_indicator_ink_transparent branch October 16, 2023 08:49
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 16, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Oct 16, 2023
flutter/flutter@b00216b...afc3916

2023-10-16 [email protected] Roll Flutter Engine from cfff75967b06 to 505c720fd10f (1 revision) (flutter/flutter#136636)
2023-10-16 [email protected] Roll Flutter Engine from bd038d688ed3 to cfff75967b06 (1 revision) (flutter/flutter#136635)
2023-10-16 [email protected] Roll Flutter Engine from 15dee700867b to bd038d688ed3 (1 revision) (flutter/flutter#136626)
2023-10-16 [email protected] Roll Flutter Engine from 41b3b4f90cd9 to 15dee700867b (1 revision) (flutter/flutter#136625)
2023-10-16 [email protected] Fix `NavigationRail`'s indicator inkwell doesn't support transparent color. (flutter/flutter#136359)
2023-10-16 [email protected] Roll Flutter Engine from 12122eac2820 to 41b3b4f90cd9 (1 revision) (flutter/flutter#136623)
2023-10-16 [email protected] Roll Flutter Engine from 539ad5b232a6 to 12122eac2820 (2 revisions) (flutter/flutter#136619)
2023-10-16 [email protected] Roll Flutter Engine from 452e75f2a6b6 to 539ad5b232a6 (1 revision) (flutter/flutter#136617)
2023-10-16 [email protected] Roll Flutter Engine from 72598229bec9 to 452e75f2a6b6 (1 revision) (flutter/flutter#136614)
2023-10-15 [email protected] Roll Flutter Engine from f8eb68b115f1 to 72598229bec9 (2 revisions) (flutter/flutter#136611)
2023-10-15 [email protected] Test cover cupertino for memory leaks and fix Opacity Layer not disposed. (flutter/flutter#136576)
2023-10-15 [email protected] Test cover cupertino for memory leaks tracking -2  (flutter/flutter#136577)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
@lucasjinreal
Copy link

image

the hover color still, can not be set...

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

Labels

autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NavigationRail can't have a transparent Hover color because there is always opacity set

3 participants