As we did for the ProductivityButton, in order to avoid unnecessary code duplication, we can create a button that we can reuse several times within the Settings screen. This button has some properties that are different from the ProductivityButton, so we'll create a new widget using the following steps:
- In the widgets.dart file, let's create a new stateless widget called SettingButton, like this:
class SettingButton extends StatelessWidget { @override Widget build(BuildContext context) { return Container( ); }}
This class will have a few properties that we will use in the constructor method, as follows:
final Color color;final String text;final int value;SettingsButton(this.color, this.text, ...