这是代码。代码:
class ThemeChangerWidget extends StatelessWidget {
final List<String> string = ['Light', 'Dark', 'Amoled'];
@override
Widget build(BuildContext context) {
final stateData = Provider.of<ThemeNotifier>(context);
final ThemeData state = stateData.getTheme();
return Theme(
data: state.copyWith(unselectedWidgetColor: state.accentColor),
child: AlertDialog(
backgroundColor: state.primaryColor,
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.0)),
title: Text('Select Theme', style: state.textTheme.body1),
content: ListView.builder(
shrinkWrap: true,
itemBuilder: (context, index) {
return RadioListTile(
value: index,
groupValue: themes.indexOf(state),
onChanged: (ind) {
onThemeChanged(ind, stateData);
},
title: Text(
string[index],
style: state.textTheme.body2,
),
);
},
itemCount: string.length,
)),
);
}
}'
Run Code Online (Sandbox Code Playgroud)
错误 - …