@@ -319,49 +319,51 @@ class _FlutterSwitchState extends State<FlutterSwitch>
319319
320320 widget.onToggle (! widget.value);
321321 },
322- child: Container (
323- width: widget.width,
324- height: widget.height,
325- padding: EdgeInsets .all (widget.padding),
326- decoration: BoxDecoration (
327- borderRadius: BorderRadius .circular (widget.borderRadius),
328- color: _switchColor,
329- border: _switchBorder,
330- ),
331- child: Row (
332- mainAxisAlignment: MainAxisAlignment .spaceBetween,
333- children: < Widget > [
334- _toggleAnimation.value == Alignment .centerRight
335- ? Expanded (
336- child: Container (
337- padding: EdgeInsets .symmetric (horizontal: 4.0 ),
338- child: _activeText,
339- ),
340- )
341- : Container (),
342- Align (
343- alignment: _toggleAnimation.value,
344- child: Container (
345- width: widget.toggleSize,
346- height: widget.toggleSize,
347- decoration: BoxDecoration (
348- shape: BoxShape .circle,
349- color: _toggleColor ?? Colors .white,
350- border: _toggleBorder,
322+ child: Align (
323+ child: Container (
324+ width: widget.width,
325+ height: widget.height,
326+ padding: EdgeInsets .all (widget.padding),
327+ decoration: BoxDecoration (
328+ borderRadius: BorderRadius .circular (widget.borderRadius),
329+ color: _switchColor,
330+ border: _switchBorder,
331+ ),
332+ child: Row (
333+ mainAxisAlignment: MainAxisAlignment .spaceBetween,
334+ children: < Widget > [
335+ _toggleAnimation.value == Alignment .centerRight
336+ ? Expanded (
337+ child: Container (
338+ padding: EdgeInsets .symmetric (horizontal: 4.0 ),
339+ child: _activeText,
340+ ),
341+ )
342+ : Container (),
343+ Align (
344+ alignment: _toggleAnimation.value,
345+ child: Container (
346+ width: widget.toggleSize,
347+ height: widget.toggleSize,
348+ decoration: BoxDecoration (
349+ shape: BoxShape .circle,
350+ color: _toggleColor ?? Colors .white,
351+ border: _toggleBorder,
352+ ),
353+ child: _icon,
351354 ),
352- child: _icon,
353355 ),
354- ),
355- _toggleAnimation.value == Alignment .centerLeft
356- ? Expanded (
357- child : Container (
358- padding : EdgeInsets . symmetric (horizontal : 4.0 ) ,
359- alignment : Alignment .centerRight ,
360- child : _inactiveText ,
361- ),
362- )
363- : Container () ,
364- ] ,
356+ _toggleAnimation.value == Alignment .centerLeft
357+ ? Expanded (
358+ child : Container (
359+ padding : EdgeInsets . symmetric (horizontal : 4.0 ),
360+ alignment : Alignment .centerRight ,
361+ child : _inactiveText ,
362+ ) ,
363+ )
364+ : Container (),
365+ ] ,
366+ ) ,
365367 ),
366368 ),
367369 );
0 commit comments