In the application, when you click on the screen, you need to change the color to random, but it must be in RGB format. How can I get a random RGB color?
class _HomePageState extends State<HomePage> {
Color _color = Colors.white;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Color picker"),
centerTitle: true,
),
body: GestureDetector(
onTap: () {
setState(() {
_color = ...
});
},
child: Container(
color: _color,
padding: const EdgeInsets.all(20),
),
),
);
}
}