qwert2603/circular_reveal_animation

animate from bottom center

Closed this issue · 4 comments

how can i change Offset to animate from bottom center?

Hello! Now you can specify center parameter of CircularRevealAnimation to needed point -- center of animation -- Offset(height, width / 2). In future releases there may be possibility to specify center via Alignment.
P.S.: PRs are welcome.

@qwert2603 i'm not sure this is correct or i'm doing wrong

    showGeneralDialog(
      barrierLabel: "Label",
      barrierDismissible: true,
      barrierColor: Colors.black.withOpacity(0.5),
      transitionDuration: Duration(milliseconds: 400),
      context: context,
      pageBuilder: (context, anim1, anim2) {
        return Align(
          alignment: false ? Alignment.topCenter : Alignment.bottomCenter,
          child: Container(
            width:300,
            height: 400,
            child: SizedBox.expand(child: Container(
              child: Padding(
                padding: const EdgeInsets.all(12.0),
                child: Image.asset('assets/klimt.png'),
              ),
              margin: EdgeInsets.only(top: 50, left: 12, right: 12, bottom: 0),
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius: BorderRadius.circular(5),
              ),
            )),
          ),
        );
      },
      transitionBuilder: (context, anim1, anim2, child) {
        return CircularRevealAnimation(
            center: Offset(400, 150),
            child: child, animation: anim1);
      },
    );

You can use:

transitionBuilder: (context, anim1, anim2, child) {
  final Size size = MediaQuery.of(context).size;
  return CircularRevealAnimation(
    center: Offset(size.width / 2, size.height),
    child: child,
    animation: anim1,
  );
},

Or get widget's size via LayoutBuilder.

@qwert2603 ok thanks let me to try that