Skip to content

Material 3 snackBar action label textColor not working #120047

@bashor4life

Description

@bashor4life

Steps to Reproduce

  1. Execute flutter run on the code sample
  2. Click "Show SnackBar"

Expected results:
Color of snackBarAction label is red
Actual results:
Color of snackBarAction label is violet

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(
      title: 'Flutter Demo',
      theme: ThemeData(
        useMaterial3: true,
      ),
      home: const MyHomePage(title: 'Flutter Demo Home Page'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});
  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    final snackBar = SnackBar(
      content: const Text('test',
          style: TextStyle(
            color: Colors.red,
          )),
      duration: const Duration(seconds: 10),
      action: SnackBarAction(
        label: 'action',
        onPressed: () {},
        textColor: Colors.red,
      ),
    );
    return Scaffold(
      body: Center(
        child: TextButton(
            onPressed: () =>
                ScaffoldMessenger.of(context).showSnackBar(snackBar),
            child: const Text('Show SnackBar')),
      ),
    );
  }
}
[✓] Flutter (Channel stable, 3.7.1, on macOS 13.0.1 22A400 darwin-arm64, locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
[✓] Xcode - develop for iOS and macOS (Xcode 14.2)
[✓] Android Studio (version 2022.1)
[✓] VS Code (version 1.75.0)
[✓] Connected device (1 available)
[✓] HTTP Host Availability

• No issues found!

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: regressionIt was better in the past than it is nowf: material designflutter/packages/flutter/material repository.found in release: 3.7Found to occur in 3.7found in release: 3.8Found to occur in 3.8frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer version

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions