'There are multiple heroes that share the same tag within a subtree in Flutterr
I have this error when I navigate from one page to another page using getx library, in first page I use indexed stack and second page using scaffold, I don't know what to do. Please help me solve this problem, I found many solutions in here but these does not same my problem.
First page:
class HomePage extends StatefulWidget {
HomePage({Key? key}) : super(key: key);
static String route = '/home';
final ScrollController _scrollController = ScrollController();
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
bool _isVisible = true;
void _hideFloationgButton(UserScrollNotification notification) {
final ScrollDirection direction = notification.direction;
setState(() {
if (direction == ScrollDirection.reverse) {
_isVisible = false;
} else if (direction == ScrollDirection.forward) {
_isVisible = true;
}
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0xFFEDF0F3),
appBar: HomeAppBar('DAK'),
body: NotificationListener<UserScrollNotification>(
onNotification: (notification) {
_hideFloationgButton(notification);
return true;
},
child: SingleChildScrollView(
controller: widget._scrollController,
child: Column(
children: const [
StoryList(),
SizedBox(
height: 30,
),
SocialList(),
SizedBox(
height: 30,
),
MiddleNavList(),
SizedBox(
height: 30,
),
PostList(),
],
),
),
),
floatingActionButton: Visibility(
visible: _isVisible,
child: FloatingActionButton(
backgroundColor: prototypeColor,
onPressed: () {
Get.toNamed(Routes.POST);
},
child: const Icon(
Icons.add_box,
color: Colors.white,
),
)));
}
}
And the second page:
class PostPage extends StatelessWidget {
const PostPage({Key? key}) : super(key: key);
static String route = '/post';
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
leading: InkWell(
onTap: () {
Get.back();
},
child: const Icon(
Icons.arrow_back_ios,
color: accentColor,
),
),
title: const Text(
'Create post',
style: TextStyle(color: accentColor),
),
backgroundColor: backgroundColor,
elevation: 0,
),
body: const PostBody(),
);
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
