Thanks to visit codestin.com
Credit goes to github.com

Skip to content

StarBorder does not lerp to Oval #108707

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

Closed
bernaferrari opened this issue Jul 31, 2022 · 4 comments Β· Fixed by #108743
Closed

StarBorder does not lerp to Oval #108707

bernaferrari opened this issue Jul 31, 2022 · 4 comments Β· Fixed by #108743
Labels
r: fixed Issue is closed as already fixed in a newer version

Comments

@bernaferrari
Copy link
Contributor

bernaferrari commented Jul 31, 2022

The new StarBorder has a genius 2-3 step lerp for most shapes, except Circle, where it works well except when eccentricity != 0. I think it was forgotten in the implementation, as Oval is only a few weeks old. I propose adding the 2-way lerp to circle, so oval works. cc @gspencergoog

Related: in the upcoming BoderSide.only PR, which may or may not be accepted, Star -> Circle is the only lerp that doesn't work, as it draws a path all the time. The other shapes draw a path until 50%, then their shape until 100%, so lerp is good (not great, might need a few fixes). I see two potential solutions:

  • Add 2 step lerp for Oval (and eccentricity != 0).
  • Add 2 step lerp for all circles.

If you fix oval only, in a hypothetical future, we might need to do if (multiBorder) 2-step lerp for circle, which is also fine. Just telling you the plan.

Screen.Recording.2022-07-31.at.17.45.57.mov

Simple sample:

StarBorder(
    side: BorderSide(color: Colors.yellow.withOpacity(0.5), width: 10),
).lerpTo(RoundedRectangleBorder(side: BorderSide(color: Colors.red.withOpacity(0.5), width: 10), 0.5)
@maheshj01 maheshj01 added the in triage Presently being triaged by the triage team label Aug 1, 2022
@maheshj01
Copy link
Member

Hi @bernaferrari, Thanks for filing the issue. Can you please share a code sample or confirm if this code sample is right?

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        theme: ThemeData(
          primarySwatch: Colors.blue,
        ),
        home: Material(
          child: SizedBox(
            height: 100,
            width: 100,
            child: Container(
              alignment: Alignment.center,
              decoration: ShapeDecoration(
                  color: Colors.white,
                  shape: StarBorder(
                    side: BorderSide(
                        color: Colors.yellow.withOpacity(0.5), width: 10),
                  ).lerpTo(
                      RoundedRectangleBorder(
                          side: BorderSide(
                              color: Colors.red.withOpacity(0.5), width: 10)),
                      0.5)!),
            ),
          ),
        ));
  }
}
[βœ“] Flutter (Channel master, 3.1.0-0.0.pre.2009, on macOS 12.4 21F79 darwin-arm, locale en-IN)
    β€’ Flutter version 3.1.0-0.0.pre.2009 on channel master at /Users/mahesh/Documents/flutter_master
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision 9d96c7b8be (8 hours ago), 2022-08-01 00:39:06 -0400
    β€’ Engine revision cf0db3e546
    β€’ Dart version 2.19.0 (build 2.19.0-49.0.dev)
    β€’ DevTools version 2.16.0

@maheshj01 maheshj01 added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 1, 2022
@bernaferrari
Copy link
Contributor Author

I knew by the time I went to answer this, there would be a PR already. Nice work @gspencergoog! lol

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Aug 1, 2022
@bernaferrari
Copy link
Contributor Author

bernaferrari commented Aug 1, 2022

Yes, seems like a great sample @maheshmnj. Thanks!

@maheshj01 maheshj01 added r: fixed Issue is closed as already fixed in a newer version and removed in triage Presently being triaged by the triage team labels Aug 2, 2022
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
r: fixed Issue is closed as already fixed in a newer version
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants