お願いします、データを渡したいです (StatefulWidget の ItemList から FloatingActionButton へのインデックスとリスト)
class _mes_adresseState extends State<mes_adresse> {
DatabaseHelper databaseHelper = new DatabaseHelper();
_save(String token) async {
final prefs = await SharedPreferences.getInstance();
final key = 'token';
final value = token;
prefs.setString(key, value);
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton.extended(
backgroundColor: Colors.amber,
onPressed: () {Navigator.of(context).push(
new MaterialPageRoute(
builder: (BuildContext context) => new EditAdress(
index: i // from index in list view.builder ,
list : list // from list in itemlist,
)),
class ItemList extends StatelessWidget {
List list;
ItemList({this.list});
@override
Widget build(BuildContext context) {
return new ListView.builder(
itemCount: list[0] == null ? 0 : list[0].length,
itemBuilder: (context, i) {
return new Container(
padding: const EdgeInsets.all(1.0),
child: new GestureDetector(
onTap: () => Navigator.of(context).push(
new MaterialPageRoute(
builder: (BuildContext context) => new EditAdress(
list: list,
index: i,
)),
// builder: (BuildContext context) => new ShowData(list:list , index:i,) ),
),
);},
floatingActionButton は別のページを返し、ページ mes_addresse から liste と index を持っています