@override
Widget build(BuildContext context) {
return ExpansionTile(
title: Text(S.of(context).theme),
leading: Icon(
Icons.color_lens,
color: Theme.of(context).accentColor,
),
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 10),
child: Wrap(
spacing: 5,
runSpacing: 5,
children: <Widget>[
...Colors.primaries.map((color) {
return Material(
color: color,
child: InkWell(
onTap: () {
var model = Provider.of<ThemeModel>(context);
var brightness = Theme.of(context).brightness;
model.switchTheme(color: color);
},
child: Container(
width: 40,
height: 40,
),
),
);
}).toList(),
Material(
child: InkWell(
onTap: () {
var model = Provider.of<ThemeModel>(context);
var brightness = Theme.of(context).brightness;
model.switchRandomTheme(brightness: brightness);
},
child: Container(
alignment: Alignment.center,
decoration: BoxDecoration(
border:
Border.all(color: Theme.of(context).accentColor)),
width: 40,
height: 40,
child: Text(
"?",
style: TextStyle(
fontSize: 20, color: Theme.of(context).accentColor),
),
),
),
)
],
),
),
],
);
}
下拉控件
最新推荐文章于 2024-09-13 10:34:12 发布