8000 GetX routing. Set transitOnUserGestures: true for HERO. Two Hero components appear when the gesture returns · Issue #3350 · jonataslaw/getx · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
GetX routing. Set transitOnUserGestures: true for HERO. Two Hero components appear when the gesture returns #3350
Open
@chjsun

Description

@chjsun

When HERO animation supports gesture return, it performs abnormally, as shown in the following animation

code:

import 'package:flutter/material.dart';
import 'package:get/get.dart';

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

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

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return GetMaterialApp(
      title: 'Flutter Demo',
      getPages: [
        GetPage(name: "/p1", page: () => Page1()),
        GetPage(name: "/p2", page: () => Page2()),
      ],
      initialRoute: "/p1",
    );
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        body: Container(
          alignment: Alignment.topLeft,
          child: Hero(
            tag: 'hero',
            transitionOnUserGestures: true,
            child: Container(
              width: 20,
              height: 20,
              color: Colors.red,
            ),
          ),
        ),
        floatingActionButton: FloatingActionButton(
          onPressed: () => Get.toNamed("p2"),
          child: const Icon(Icons.navigate_next),
        ));
  }
}

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        alignment: Alignment.bottomRight,
        child: Hero(
          tag: 'hero',
          transitionOnUserGestures: true,
          child: Container(
            width: 20,
            height: 20,
            color: Colors.red,
          ),
        ),
      ),
    );
  }
}

To Reproduce
click floatingActionButton . Get.toNamed("p2");

Expected behavior
The animation becomes normal, just like Navigate

Screenshots

ScreenRecording_05-14-2025.18-07-31_1.MP4

Flutter Version:
Flutter 3.27.1 • channel stable • https://github.com/flutter/flutter.git
Framework • revision 17025dd882 (5 months ago) • 2024-12-17 03:23:09 +0900
Engine • revision cb4b5fff73
Tools • Dart 3.6.0 • DevTools 2.40.2

Getx Version:
get: ^5.0.0-release-candidate-9.3.2

Describe on which device you found the bug:
iPhone12 / 18.0.1

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0