Skip to content

lerp of ChipThemeData.side is wrong when b is null #173161

@ValentinVignal

Description

@ValentinVignal

Steps to reproduce

The lerp method of ChipThemeData for side doesn't work well when b is null.

Expected results

I expect the transistion to be smooth

Actual results

There is a back and forth in the transition

Code sample

Code sample
import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  BorderSide? _side;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(chipTheme: ChipThemeData(side: _side)),
      home: Scaffold(
        body: Center(
          child: ActionChip(
            label: Text('Chip'),
            onPressed: () {
              setState(() {
                if (_side == null) {
                  _side = BorderSide(width: 5, color: Colors.red);
                } else {
                  _side = null;
                }
              });
            },
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
Screen.Recording.2025-08-02.at.6.36.40.PM.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.r: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions