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

Fix Chip.shape's side is not used when provided in Material 3 #132941

Merged
merged 2 commits into from
Aug 25, 2023

Conversation

TahaTesser
Copy link
Member

@TahaTesser TahaTesser commented Aug 21, 2023

fixes Chip border side color not working in Material3

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(
      theme: ThemeData(
        useMaterial3: true,
        chipTheme: const ChipThemeData(
            // shape: RoundedRectangleBorder(
            //   side: BorderSide(color: Colors.amber),
            //   borderRadius: BorderRadius.all(Radius.circular(12)),
            // ),
            // side: BorderSide(color: Colors.red),
            ),
      ),
      home: const Example(),
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return const Scaffold(
      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          // side: BorderSide(color: Colors.red),
          label: Text('Chip'),
        ),
      ),
    );
  }
}

Before

When RawChip.shape is provided with a BorderSide.

      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          label: Text('Chip'),
        ),
      ),

Screenshot 2023-08-24 at 17 54 54

When RawChip.shape is provided with a BorderSide and also RawChip.side is provided. The RawChip.side overrides the shape's side.

      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          side: BorderSide(color: Colors.red),
          label: Text('Chip'),
        ),
      ),

Screenshot 2023-08-24 at 17 55 37


After

When RawChip.shape is provided with a BorderSide.

      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          label: Text('Chip'),
        ),
      ),

Screenshot 2023-08-24 at 17 51 29

When RawChip.shape is provided with a BorderSide and also RawChip.side is provided. The RawChip.side overrides the shape's side.

      body: Center(
        child: RawChip(
          shape: RoundedRectangleBorder(
            side: BorderSide(color: Colors.amber),
            borderRadius: BorderRadius.all(Radius.circular(12)),
          ),
          side: BorderSide(color: Colors.red),
          label: Text('Chip'),
        ),
      ),

Screenshot 2023-08-24 at 17 52 31


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 Aug 21, 2023
@TahaTesser TahaTesser force-pushed the fix_chip_shape_side_m3 branch from 9193963 to 8446b26 Compare August 21, 2023 09:46
@waleedrana777

This comment was marked as spam.

@TahaTesser TahaTesser requested a review from HansMuller August 23, 2023 07:09
@TahaTesser TahaTesser force-pushed the fix_chip_shape_side_m3 branch 2 times, most recently from c59b20e to 17a75d9 Compare August 24, 2023 14:47
@TahaTesser TahaTesser requested a review from HansMuller August 24, 2023 14:57
@TahaTesser TahaTesser force-pushed the fix_chip_shape_side_m3 branch from 17a75d9 to e39ea12 Compare August 24, 2023 15:15
@TahaTesser TahaTesser changed the title Fix Chip.shape's side doesn't override Chip.side in Material 3 Fix Chip.shape's side is not used when provided in Material 3 Aug 24, 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

dev/tools/gen_defaults/lib/chip_template.dart Show resolved Hide resolved
@HansMuller HansMuller added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 25, 2023
@auto-submit auto-submit bot merged commit 612117a into flutter:master Aug 25, 2023
@TahaTesser TahaTesser deleted the fix_chip_shape_side_m3 branch August 25, 2023 14:50
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 25, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 25, 2023
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Aug 25, 2023
flutter/flutter@deeb811...61d9f55

2023-08-25 [email protected] Update flutter packages to pick up latest vm_service (flutter/flutter#133335)
2023-08-25 [email protected] Roll Flutter Engine from 00f532dcaef4 to 33fca02451ef (1 revision) (flutter/flutter#133337)
2023-08-25 [email protected] Roll Flutter Engine from cb58abd77326 to 00f532dcaef4 (3 revisions) (flutter/flutter#133333)
2023-08-25 [email protected] Fix `PopupMenuItem` with a `ListTile` doesn't use the correct style. (flutter/flutter#133141)
2023-08-25 [email protected] Fix `Chip.shape`'s side is not used when provided in Material 3 (flutter/flutter#132941)
2023-08-25 [email protected] Dispose overlay entries (flutter/flutter#132826)
2023-08-25 [email protected] Roll Flutter Engine from 0f8962208a44 to cb58abd77326 (3 revisions) (flutter/flutter#133320)
2023-08-25 [email protected] Roll Flutter Engine from 09e620d26834 to 0f8962208a44 (2 revisions) (flutter/flutter#133309)
2023-08-25 [email protected] Roll Flutter Engine from 9bcefc74b772 to 09e620d26834 (1 revision) (flutter/flutter#133307)
2023-08-25 [email protected] Roll Flutter Engine from 1382d6d79408 to 9bcefc74b772 (2 revisions) (flutter/flutter#133305)
2023-08-25 [email protected] Allow passing verbose log from flutter daemon. (flutter/flutter#132828)
2023-08-25 [email protected] Roll Flutter Engine from b8ec4da8866c to 1382d6d79408 (1 revision) (flutter/flutter#133298)
2023-08-25 [email protected] Roll Flutter Engine from 965501a25d92 to b8ec4da8866c (11 revisions) (flutter/flutter#133296)
2023-08-24 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 3.5.3 to 3.6.0 (flutter/flutter#133281)
2023-08-24 [email protected] Update the tool to know about all our new platforms (flutter/flutter#132423)
2023-08-24 [email protected] l10n-related documentation improvements (flutter/flutter#133114)
2023-08-24 [email protected] Add hover duration for `Inkwell` widget (flutter/flutter#132176)
2023-08-24 [email protected] [web] benchmark the benchmark harness overhead (flutter/flutter#132999)
2023-08-24 [email protected] Users of ChangeNotifier should dispatch event of object creation in constructor. (flutter/flutter#133210)
2023-08-24 49699333+dependabot[bot]@users.noreply.github.com Bump activesupport from 6.1.7.3 to 6.1.7.6 in /dev/ci/mac (flutter/flutter#133225)
2023-08-24 [email protected] Remove `ImageProvider.load`, `DecoderCallback` and `PaintingBinding.instantiateImageCodec` (flutter/flutter#132679)
2023-08-24 [email protected] Roll Flutter Engine from aa98a9d2e86f to 965501a25d92 (24 revisions) (flutter/flutter#133272)
2023-08-24 [email protected] handle exceptions raised while searching for configured android studio (flutter/flutter#133180)
2023-08-24 [email protected] Fix mac tool_integration_tests with Xcode 15 (flutter/flutter#133217)
2023-08-24 [email protected] Roll Packages from 3060b1a to 383bffa (3 revisions) (flutter/flutter#133256)

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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
XilaiZhang added a commit that referenced this pull request Aug 30, 2023
fluttermirroringbot pushed a commit that referenced this pull request Aug 30, 2023
…ded in Material 3" (#133615)

Reverts #132941
context: b/298110031

The rounded rectangle borders don't appear in some of the internal
golden image tests.
@HansMuller
Copy link
Contributor

The source of the problem appears to be https://github.com/flutter/flutter/pull/132941/files#diff-182e52332f7e266b854b25f1bf7c3d1fa20698ebcd30276bb11abc310bac6c24L2237 which removes the default border for the base Chip class in M3. This is a breaking change although it doesn't appear to have affected any of the external customer tests.

@TahaTesser
Copy link
Member Author

The source of the problem appears to be https://github.com/flutter/flutter/pull/132941/files#diff-182e52332f7e266b854b25f1bf7c3d1fa20698ebcd30276bb11abc310bac6c24L2237 which removes the default border for the base Chip class in M3. This is a breaking change although it doesn't appear to have affected any of the external customer tests.

Thanks for the update! I will look into this change and add regression tests within the framework tests.

auto-submit bot pushed a commit to flutter/cocoon that referenced this pull request Aug 30, 2023
…ice class (#3026)

We are getting alert for 500 errors from the /api/github/webhook-branch-subscription endpoint when attempting to insert a commit for a release branch. The issue is with the timestamp presumably being null when we attempt to insert it into the database since it not a field in the return RepositoryCommit in the github lib.

```
"Failed to process Instance of 'PushMessage'. (500) Invalid argument(s): Error while encoding entity (Bad state: Property validation failed for property timestamp while trying to serialize entity of kind Commit. , #0      _ModelDescription._encodeProperty (package:gcloud/src/db/model_db_impl.dart:449:7)
#1      _ModelDescription.encodeModel.<anonymous closure> (package:gcloud/src/db/model_db_impl.dart:429:7)
#2      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:625:13)
#3      _ModelDescription.encodeModel (package:gcloud/src/db/model_db_impl.dart:428:34)
#4      ModelDBImpl.toDatastoreEntity (package:gcloud/src/db/model_db_impl.dart:121:31)
#5      _commitHelper (package:gcloud/src/db/db.dart:434:38)
#6      Transaction.commit (package:gcloud/src/db/db.dart:118:14)
#7      DatastoreService.insert.<anonymous closure>.<anonymous closure> (package:cocoon_service/src/service/datastore.dart:254:31)
#8      DatastoreDB.withTransaction.<anonymous closure> (package:gcloud/src/db/db.dart:324:32)
#9      _rootRunUnary (dart:async/zone.dart:1407:47)
<asynchronous suspension>
#10     DatastoreService.insert.<anonymous closure> (package:cocoon_service/src/service/datastore.dart:252:11)
<asynchronous suspension>
#11     RetryOptions.retry (package:retry/retry.dart:131:16)
<asynchronous suspension>
#12     DatastoreService.insert (package:cocoon_service/src/service/datastore.dart:250:7)
<asynchronous suspension>
#13     CommitService.handleCreateGithubRequest (package:cocoon_service/src/service/commit_service.dart:42:7)
<asynchronous suspension>
#14     GithubBranchWebhookSubscription.post (package:cocoon_service/src/request_handlers/github/branch_subscription.dart:56:7)
<asynchronous suspension>
#15     RequestHandler.service.<anonymous closure> (package:cocoon_service/src/request_handling/request_handler.dart:53:24)
<asynchronous suspension>
#16     SubscriptionHandler.service (package:cocoon_service/src/request_handling/subscription_handler.dart:138:5)
<asynchronous suspension>
#17     main.<anonymous closure>.<anonymous closure> (file:///app/bin/server.dart:303:11)
<asynchronous suspension>
```

The data returned by the call in the Commit Service looks like this:

```
{
  "sha": "6fd42536b7697eb4bd2a698b19308e0aacac70c7",
  "node_id": "C_kwDOAeUeuNoAKDZmZDQyNTM2Yjc2OTdlYjRiZDJhNjk4YjE5MzA4ZTBhYWNhYzcwYzc",
  "commit": {
    "author": {
      "name": "Xilai Zhang",
      "email": "[email protected]",
      "date": "2023-08-30T02:59:02Z"
    },
    "committer": {
      "name": "GitHub",
      "email": "[email protected]",
      "date": "2023-08-30T02:59:02Z"
    },
    "message": "[flutter roll] Revert \"Fix `Chip.shape`'s side is not used when provided in Material 3\" (#133615)\n\nReverts flutter/flutter#132941\r\ncontext: b/298110031\r\n\r\nThe rounded rectangle borders don't appear in some of the internal\r\ngolden image tests.",
    "tree": {
      "sha": "e5efe7f39155d9b8fc40ad0a59c72f6a36f8b66d",
      "url": "https://api.github.com/repos/flutter/flutter/git/trees/e5efe7f39155d9b8fc40ad0a59c72f6a36f8b66d"
    },

```

The author field in this case has no createdAt timestamp.

*List which issues are fixed by this PR. You must list at least one issue.*
Fixes flutter/flutter#133707

*If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
auto-submit bot pushed a commit that referenced this pull request Sep 7, 2023
… 3" (#133856)

fixes [Chip border side color not working in Material3](#132922)
Relands #132941 with an updated fix and a regression test.

<details>
<summary>expand to view the code sample</summary> 

```dart
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(useMaterial3: true),
      home: const Example(),
    );
  }
}

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

  @OverRide
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Chips'),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: <Widget>[
            const RawChip(
              shape: RoundedRectangleBorder(
                side: BorderSide(color: Colors.amber),
              ),
              side: BorderSide(color: Colors.red),
              label: Text('RawChip'),
            ),
            const Chip(
              shape: RoundedRectangleBorder(
                side: BorderSide(color: Colors.amber),
              ),
              side: BorderSide(color: Colors.red),
              label: Text('Chip'),
            ),
            ActionChip(
              shape: const RoundedRectangleBorder(
                side: BorderSide(color: Colors.amber),
              ),
              side: const BorderSide(color: Colors.red),
              label: const Text('ActionChip'),
              onPressed: () {},
            ),
            FilterChip(
              shape: const RoundedRectangleBorder(
                side: BorderSide(color: Colors.amber),
              ),
              side: const BorderSide(color: Colors.red),
              label: const Text('FilterChip'),
              onSelected: (value) {},
            ),
            ChoiceChip(
              shape: const RoundedRectangleBorder(
                side: BorderSide(color: Colors.amber),
              ),
              side: const BorderSide(color: Colors.red),
              label: const Text('ChoiceChip'),
              selected: false,
              onSelected: (value) {},
            ),
            InputChip(
              shape: const RoundedRectangleBorder(
                side: BorderSide(color: Colors.amber),
              ),
              side: const BorderSide(color: Colors.red),
              label: const Text('InputChip'),
              onSelected: (value) {},
            ),
          ],
        ),
      ),
    );
  }
}
```

</details>

<img src="https://github.com/flutter/flutter/assets/48603081/f713fd84-cf9a-4e52-8cdb-5faba63d8e91" height="450" /> <img src="https://github.com/flutter/flutter/assets/48603081/a142efc7-041e-4e6e-87cf-e6c4ebe735f3" height="450" />

<img src="https://github.com/flutter/flutter/assets/48603081/377df55b-499f-403f-96c5-0be0334795dc" height="450" /> <img src="https://github.com/flutter/flutter/assets/48603081/731a2752-7822-4605-8e9c-db0a71dd6f08" height="450" />
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Nov 15, 2023
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.

Chip border side color not working in Material3
3 participants