You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Using a RaisedButton in a non-material app doesn't hint as to what is wrong #243
import 'package:flutter/material.dart';
void main() {
runApp(new MyApp());
}
class MyApp extends StatelessComponent {
Widget build(BuildContext context) {
return new Column([
new Center(child: new Text("first")),
new Center(child: new Text("second")),
new Center(child: new RaisedButton(child: new Text("third")))
], justifyContent: FlexJustifyContent.spaceAround);
}
}
There are no warnings or errors. It launches correctly on the phone (from what I can tell)
Expected: the button is displayed, or some error telling me why this isn't allowed
Actual: I see "first", and "second", but not a button for "third"
If this is not valid code, could we error out with a message, or provide some feedback somehow (even on the screen) that lets the developer know what's wrong?
Comment by Hixie Saturday Oct 31, 2015 at 15:33 GMT
Yeah we should probably have Theme.of() take an optional boolean "nullOk" that defaults to false and if it would return null when nullOk is false then it asserts saying there's no theme and "Did you use MaterialApp" or something.
Having said that, I'm not sure that's the problem here. Material doesn't introduce a Theme. I'm not sure why the button disappears. Is the text just black on black or something?
Comment by sethladd Saturday Oct 31, 2015 at 19:12 GMT
Thanks for looking into this!
Is the text just black on black or something?
Probably? Without using the Material wrapper, the default background is black.
I'm not sure how the button gets its default style. When a button is using in a tree with Material above it, the button color is gray and the text is black. However, if the button was always gray, I would expect to see the gray button on the default black background.
I don't see the button, nor any text, unless I use Material.
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.
Activity
FlutterIssues commentedon Nov 9, 2015
Thursday Oct 29, 2015 at 22:31 GMT
FWIW, the solution was to wrap my column in a
new Material. Not sure how to prompt the user to use material components inside of aMaterialcomponent.FlutterIssues commentedon Nov 9, 2015
Friday Oct 30, 2015 at 05:11 GMT
We could print a warning in checked mode if a component detects that it has no theme?
FlutterIssues commentedon Nov 9, 2015
Saturday Oct 31, 2015 at 15:33 GMT
Yeah we should probably have Theme.of() take an optional boolean "nullOk" that defaults to false and if it would return null when nullOk is false then it asserts saying there's no theme and "Did you use MaterialApp" or something.
Having said that, I'm not sure that's the problem here.
Materialdoesn't introduce a Theme. I'm not sure why the button disappears. Is the text just black on black or something?FlutterIssues commentedon Nov 9, 2015
Saturday Oct 31, 2015 at 19:12 GMT
Thanks for looking into this!
Probably? Without using the
Materialwrapper, the default background is black.I'm not sure how the button gets its default style. When a button is using in a tree with Material above it, the button color is gray and the text is black. However, if the button was always gray, I would expect to see the gray button on the default black background.
I don't see the button, nor any text, unless I use
Material.github-actions commentedon Sep 6, 2021
This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of
flutter doctor -vand a minimal reproduction of the issue.