import 'package:JAPANESE/data/hiraganaall.dart';
import 'package:flutter/material.dart';
class HiraganaPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(
"Hiragana",
style: TextStyle(
color: Colors.white,
),
),
centerTitle: true,
backgroundColor: Colors.blueAccent,
),
body: ListView.separated(
separatorBuilder: (context, index) {
return Divider(
thickness: 3.0,
height: 1.0,
);
},
itemCount: data.length,
itemBuilder: (context, index) {
return Container(
decoration: BoxDecoration(color: Colors.grey[300]),
child: ListTile(
leading: CircleAvatar(
backgroundColor: Colors.white,
radius: 28,
child: Image.network(
data[index]["writing"],
),
),
title: Text(
"Text: " + data[index]["key"],
style: TextStyle(
fontFamily: "Merienda",
fontSize: 18.22,
),
),
subtitle: Text(
"Reading: " + data[index]["reading"],
style: TextStyle(
fontFamily: "Merienda",
fontSize: 18.22,
),
),
),
);
},
),
);
}
}
I've made a ListView in Flutter, but now I have some ListTiles in this ListView that can be selected. Upon selection, I want the background color to change to a color of my choice. I don't know how to do that. In the docs they mention that a ListTile has a property style. However, when I try to add that (as in third last line in the code below), this style property gets a squiggly red line underneath and the compiler tells me that The named parameter 'style' isn't defined.