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

Add a Theme.merge that implements the logic of the main ThemeData constructor #9148

Open
eseidelGoogle opened this issue Apr 3, 2017 · 6 comments · May be fixed by #148449
Open

Add a Theme.merge that implements the logic of the main ThemeData constructor #9148

eseidelGoogle opened this issue Apr 3, 2017 · 6 comments · May be fixed by #148449
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter customer: posse (eap) f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-design Owned by Design Languages team triaged-design Triaged by Design Languages team

Comments

@eseidelGoogle
Copy link
Contributor

"changing the accent color on an input on one screen is complicated" was feedback offered about our theming system.

Ian says on solution here would be to add a copyWith constructor onto theme?

Did I capture that correctly @Hixie?

@eseidelGoogle eseidelGoogle added framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Apr 3, 2017
@Hixie
Copy link
Contributor

Hixie commented Apr 4, 2017

Specifically, I think we need a version of ThemeData.copyWith that implements the logic of the main ThemeData constructor. There's no way right now to take a ThemeData, and say "ok now assume you had this swatch instead, what would you have to change".

@Hixie Hixie added the c: API break Backwards-incompatible API changes label Apr 4, 2017
@Hixie Hixie added this to the 2: Make Early Adopters happy milestone Apr 4, 2017
@eseidelGoogle eseidelGoogle added c: new feature Nothing broken; request for a new capability and removed c: API break Backwards-incompatible API changes labels Apr 4, 2017
@eseidelGoogle eseidelGoogle modified the milestones: 4: Make shippers happy, 2: Make Early Adopters happy Apr 4, 2017
@Hixie Hixie changed the title Theme should be easier to use? Add a ThemeData.copyWith that implements the logic of the main ThemeData constructor May 7, 2017
@Hixie Hixie changed the title Add a ThemeData.copyWith that implements the logic of the main ThemeData constructor Add a Theme.merge that implements the logic of the main ThemeData constructor May 7, 2017
@Hixie
Copy link
Contributor

Hixie commented May 7, 2017

We should probably use the same technique that I used in #9358.

@dllz
Copy link

dllz commented Nov 18, 2019

Over 2 years later is this ever being implemented?

@micimize
Copy link
Contributor

micimize commented Nov 18, 2019

@dllz flutter has 7000+ issues, and this one is marked as severe so I'm guessing the implementation is non-trivial.

Would be nice to see it on the roadmap though

wilkomanger pushed a commit to wilkomanger/flutter that referenced this issue Mar 29, 2020
ThemeData.copyWith now recalculates all default values when
the brightness changes.

Theme.merge uses this to provide a new Theme to their
descendants.

Unfortunately it's not a ThemeData that's passed to Theme.merge,
but the parameters themselves. If it's desired I can change it to
make it pass a ThemeData, but I didn't at first to keep things simpler.

Implements flutter#9148.

Relevant to flutter#9871.
@kf6gpe kf6gpe added the P2 Important issues not at the top of the work list label May 29, 2020
@kf6gpe kf6gpe removed this from the Goals milestone Jun 2, 2020
@Hixie Hixie removed this from the Goals milestone Jun 2, 2020
@Hixie Hixie removed this from the None. milestone Aug 17, 2020
@HansMuller HansMuller added the c: proposal A detailed proposal for a change to Flutter label Nov 12, 2021
@kornha
Copy link

kornha commented Feb 2, 2022

There is still an apparent bug that one cannot override the brightness for a specific scaffold as the Theme does not override. Eg.,

import 'package:entropy/util/extensions.dart';
import 'package:entropy/views/landing/landing.dart';
import 'package:flutter/material.dart';

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

  @override
  Widget build(BuildContext context) {
    return Theme(
      data: ThemeData(brightness: Brightness.dark),
      child: Landing(),
    );
  }
}

Is there a fix to this?

@MrSquaare
Copy link

There should be a merge method for all styling classes (*Decoration, *Style, *Theme, *ThemeData). This would make Theme.merge easier.

By the way, why are there so many terms to refer to styling? Is there a technical reason?

@flutter-triage-bot flutter-triage-bot bot added multiteam-retriage-candidate team-design Owned by Design Languages team labels Jul 8, 2023
@flutter-triage-bot flutter-triage-bot bot added the triaged-design Triaged by Design Languages team label Jul 8, 2023
@nate-thegrate nate-thegrate linked a pull request May 16, 2024 that will close this issue
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: new feature Nothing broken; request for a new capability c: proposal A detailed proposal for a change to Flutter customer: posse (eap) f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. P2 Important issues not at the top of the work list team-design Owned by Design Languages team triaged-design Triaged by Design Languages team
Projects
None yet
9 participants