How can I remove the space on the left and on the right?
How Bogdan Orzea said, in Flutter last release (version 1.9.1) isn't possible to change the padding of the ToggleButtons's children. Probably in the next Flutter release it will be possible. If you can't wait until the next release, you can update Flutter to version 1.12.13+hotfix.3 (beta). In this beta version the ToggleButtons's children will be square like is shown in ToggleButtons-Example, and you can change the padding using Padding Widget, like the code below:
ToggleButtons(
children: <Widget>[
Padding(
padding: EdgeInsets.only(left: 40.0, right: 40.0),
child: Text('Option 1')
),
Padding(
padding: EdgeInsets.only(left: 40.0, right: 40.0),
child: Text('Option 2')
),
Padding(
padding: EdgeInsets.only(left: 40.0, right: 40.0),
child: Text('Option 3')
),
Padding(
padding: EdgeInsets.only(left: 40.0, right: 40.0),
child: Text('Option 4')
)
],
)
And is it possible scroll the toggleButtons - or even to "page" them (clicking f. e. on buttons on the left and on the right of the toggle buttons and "scroll/move" by one icon in a direction)?
Wrap your ToggleButton inside the SingleChildScrollView widget:
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: ToggleButtons(
children: (...)
)
)