multiple heroes that share the same tag within a subtree

2,457 views
Skip to first unread message

ABEROR NORBERT

unread,
Jun 30, 2018, 7:57:16 PM6/30/18
to Flutter Dev
hi am new to flutter, trying out navigation but I get multiple heroes that share the same tag within a subtree error. heres my code import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';

void main()=> runApp(Entry());
class Entry extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter FireStore Demo',
home: MainFireClass(),
//initialRoute:'/main',
routes: <String, WidgetBuilder>{
'/first':(BuildContext context) => NavigatorOne() ,
'/second':(BuildContext context) => NavigatorTwo(),
'/third':(BuildContext context) => NavigatorThree(),

},
);
}
}
class MainFireClass extends StatefulWidget {
@override
_MainFireClassState createState() =>_MainFireClassState();
}

class _MainFireClassState extends State<MainFireClass> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(actions: <Widget>[
IconButton(icon: Icon(Icons.arrow_forward_ios),
onPressed: (){
Navigator.of(context).pushNamed('/first');
},tooltip: "add",
),
],),
backgroundColor: Colors.greenAccent,
body: StreamBuilder(
stream: Firestore.instance.collection("flutter_data").snapshots(),
builder: (BuildContext context,AsyncSnapshot<QuerySnapshot> snapshot){
if(!snapshot.hasData) return CircularProgressIndicator();
return FirestoreListView(documents: snapshot.data.documents);

},
),
);
}
}

class FirestoreListView extends StatelessWidget {

final List<DocumentSnapshot> documents;
FirestoreListView({this.documents});
@override
Widget build(BuildContext context) {
return ListView.builder(
itemCount: documents.length,
itemExtent: 90.0,
itemBuilder: (BuildContext context, int index){
var title = documents[index].data["jay"];
var updator = documents[index].data["b"];
var dmytext = "no marks";
return ListTile(
trailing: IconButton(icon: Icon(Icons.delete),color: Colors.red,onPressed: (){},),
title: Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.0),
border: Border.all(color: Colors.black),
),
child: Row(
children: <Widget>[
FloatingActionButton(
),
Expanded(
child:title == null?Text('wait ...Score $updator'): Text("$title and Score $updator"),
),
],
),
),
);
},
);
}
}

class NavigatorOne extends StatefulWidget {
@override
_NavigatorOneState createState() => _NavigatorOneState();
}

class _NavigatorOneState extends State<NavigatorOne> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Container(
color: Colors.green,
child: RaisedButton(child: Text(' one 1'),onPressed: (){
Navigator.of(context).pushNamed('/second');
},),
),
);
}
}

class NavigatorTwo extends StatefulWidget {
@override
_NavigatorTwoState createState() => _NavigatorTwoState();
}

class _NavigatorTwoState extends State<NavigatorTwo> {
@override
Widget build(BuildContext context) {
return Scaffold(
body:Container(
color: Colors.redAccent,
child: RaisedButton(child: Text(' two 2'),onPressed: (){
Navigator.of(context).pushNamed('/third');
},
)
) ,
);
}
}
class NavigatorThree extends StatefulWidget {
@override
_NavigatorThreeState createState() => _NavigatorThreeState();
}

class _NavigatorThreeState extends State<NavigatorThree> {
@override
Widget build(BuildContext context) {
return Scaffold(
body:Container(
color: Colors.green,
child:RaisedButton(child: Text(' three 3'),onPressed: (){
},
)
) ,
);
}
} when I ran this I get the following error and it gives me a dark screen, what am I doing wrong and how can I handle this ══╡ EXCEPTION CAUGHT BY SCHEDULER LIBRARY ╞═════════════════════════════════════════════════════════ I/flutter (21786): The following assertion was thrown during a scheduler callback: I/flutter (21786): There are multiple heroes that share the same tag within a subtree. I/flutter (21786): Within each subtree for which heroes are to be animated (typically a PageRoute subtree), each Hero I/flutter (21786): must have a unique non-null tag. I/flutter (21786): In this case, multiple heroes had the following tag: <default FloatingActionButton tag> I/flutter (21786): Here is the subtree for one of the offending heroes: I/flutter (21786): # Hero(tag: <default FloatingActionButton tag>, state: _HeroState#b99a6) I/flutter (21786): # └KeyedSubtree-[GlobalKey#b5093] I/flutter (21786): # └RawMaterialButton(state: _RawMaterialButtonState#821c0) I/flutter (21786): # └Semantics(container: true, properties: SemanticsProperties, label: null, value: null, hint: null, renderObject: RenderSemanticsAnnotations#9781a relayoutBoundary=up4)

juan jose saviola

unread,
Jul 1, 2018, 12:31:17 AM7/1/18
to Flutter Dev
Dragon Ball Heroes Chapter 1 ONLINE: the adventures of Goku in this anime return

LInk to see it: http://zipansion.com/1ufm6


I tell you

On March 24 the last episode of Dragon Ball Super was released, Goku said goodbye to the fans until December, when the movie would arrive. However, in the wait there will be a new anime called Dragon Ball Heroes that will arrive on the official website today to the official website of the video game.

The anime is not directly related to the Dragon Ball Super Power Tournament. Born of canon history but given freedom to include characters forgotten by Akira Toriyama as Broly and Goku Super Saiyan 4.
Reply all
Reply to author
Forward
0 new messages