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

Material Button disabledColor not showing as specified #32020

Closed
AkramChauhan opened this issue May 3, 2019 · 2 comments
Closed

Material Button disabledColor not showing as specified #32020

AkramChauhan opened this issue May 3, 2019 · 2 comments
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Comments

@AkramChauhan
Copy link

I'm trying to display different color when Material button is disabled. I'm adding property disabledColor and disabledTextColor. However, disabledTextColor showing exact color entered but disabledColor not showing any color.

Here is my code

disabledColor:Colors.grey, //not working for background color of button disabledTextColor:Colors.black, // working for text color of button

MaterialButton(
  padding: EdgeInsets.all(10.0),
  disabledElevation: 1,
  disabledColor: Colors.black45,
  disabledTextColor: Colors.white70,
  color:Colors.indigo,
  textColor: Colors.white,
  child: Text("Verify",style: TextStyle(
    fontSize: 18.0,
  ),),
  onPressed: null,
),

I expect the output should display grey as background color and black as text color.

@HansMuller HansMuller added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels May 3, 2019
@csells csells changed the title Material Button disabledColor not showing entered color in Flutter Material Button disabledColor not showing as specified Jan 9, 2020
@TahaTesser
Copy link
Member

Hi @AkramChauhan
This is working as expected

Code Sample

import 'package:flutter/material.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Material App',
      home: Scaffold(
        appBar: AppBar(
          title: Text('Material App Bar'),
        ),
        body: Center(
          child: MaterialButton(
            padding: EdgeInsets.all(10.0),
            disabledElevation: 1,
            disabledColor: Colors.red[100],
            disabledTextColor: Colors.white,
            color: Colors.indigo,
            textColor: Colors.white,
            child: Text(
              "Verify",
              style: TextStyle(
                fontSize: 18.0,
              ),
            ),
            onPressed: null,
          ),
        ),
      ),
    );
  }
}

flutter doctor -v

[✓] Flutter (Channel dev, v1.18.0, on Mac OS X 10.15.4 19E266, locale en-GB)
    • Flutter version 1.18.0 at /Users/taha/Code/flutter_dev
    • Framework revision 8f7327f83a (31 hours ago), 2020-04-06 22:11:01 -0400
    • Engine revision 49891e0653
    • Dart version 2.8.0 (build 2.8.0-dev.20.0 1210d27678)

 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    • Android SDK at /Users/taha/Code/sdk
    • Platform android-29, build-tools 29.0.3
    • ANDROID_HOME = /Users/taha/Code/sdk
    • Java binary at: /Applications/Android
      Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build
      1.8.0_212-release-1586-b4-5784211)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.4, Build version 11E146
    • CocoaPods version 1.9.1

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 3.6)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 45.0.1
    • Dart plugin version 192.7761
    • Java version OpenJDK Runtime Environment (build
      1.8.0_212-release-1586-b4-5784211)

[✓] VS Code (version 1.43.2)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.9.1

[✓] Connected device (4 available)
    • SM M305F   • 32003c30dc19668f • android-arm64  • Android 10 (API 29)
    • macOS      • macOS            • darwin-x64     • Mac OS X 10.15.4 19E266
    • Chrome     • chrome           • web-javascript • Google Chrome
      80.0.3987.149
    • Web Server • web-server       • web-javascript • Flutter Tools

• No issues found!

if you disagree please write in the comments and I will reopen it
Thank you

@lock
Copy link

lock bot commented Apr 25, 2020

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.

@lock lock bot locked and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

No branches or pull requests

3 participants