@@ -19,27 +19,33 @@ class _HeaderState extends State<Header> {
1919 crossAxisAlignment: CrossAxisAlignment .center,
2020 mainAxisAlignment:
2121 theme.isLtr () ? MainAxisAlignment .end : MainAxisAlignment .start,
22- children: [
23- ButtonIcon (
24- icon: Icons .swap_horiz,
25- size: 46 ,
26- onPress: () => theme.changePosition (),
27- brightness: theme.data ().brightness,
28- ),
29- ButtonIcon (
30- icon: theme.data ().primaryColor == Colors .blueGrey[800 ]
31- ? Icons .wb_sunny
32- : Icons .nightlight_round,
33- size: 46 ,
34- onPress: () => this .changeMode (theme),
35- brightness: theme.data ().brightness,
36- ),
37- ],
22+ children: this .children (theme),
3823 ),
3924 ),
4025 );
4126 }
4227
28+ List <Widget > children (ThemeProvider theme) {
29+ List <Widget > widgets = [
30+ ButtonIcon (
31+ icon: Icons .swap_horiz,
32+ size: 46 ,
33+ onPress: () => theme.changePosition (),
34+ brightness: theme.data ().brightness,
35+ ),
36+ ButtonIcon (
37+ icon: theme.data ().primaryColor == Colors .blueGrey[800 ]
38+ ? Icons .wb_sunny
39+ : Icons .nightlight_round,
40+ size: 46 ,
41+ onPress: () => this .changeMode (theme),
42+ brightness: theme.data ().brightness,
43+ ),
44+ ];
45+
46+ return theme.isLtr () ? widgets : widgets.reversed.toList ();
47+ }
48+
4349 void changeMode (ThemeProvider themeProvider) {
4450 // if was dark mode
4551 if (themeProvider.data ().primaryColor == Colors .blueGrey[800 ]) {
0 commit comments