@@ -16,6 +16,7 @@ import 'package:ccxgui/screens/settings/hardsubx_settings.dart';
16
16
import 'package:ccxgui/screens/settings/input_settings.dart' ;
17
17
import 'package:ccxgui/screens/settings/obscure_settings.dart' ;
18
18
import 'package:ccxgui/screens/settings/output_settings.dart' ;
19
+ import 'package:ccxgui/utils/constants.dart' ;
19
20
20
21
class Home extends StatefulWidget {
21
22
@override
@@ -79,63 +80,18 @@ class _HomeState extends State<Home> {
79
80
hideTitleBar: true ,
80
81
drawerHeaderBuilder: (context) {
81
82
return Column (
83
+ mainAxisAlignment: MainAxisAlignment .center,
82
84
children: < Widget > [
83
85
DrawerHeader (
84
86
child: SvgPicture .asset (
85
87
logo,
86
88
semanticsLabel: 'CCExtractor Logo' ,
87
89
),
88
90
),
89
- BlocBuilder <ProcessBloc , ProcessState >(
90
- builder: (context, state) {
91
- return Text (
92
- 'Version: ' + state.version! .trim (),
93
- style: TextStyle (
94
- fontSize: 12 ,
95
- color: Theme .of (context)
96
- .bottomNavigationBarTheme
97
- .backgroundColor),
98
- );
99
- },
100
- ),
91
+ _CheckForUpdatesButton ()
101
92
],
102
93
);
103
94
},
104
- drawerFooterBuilder: (context) {
105
- return Platform .isWindows
106
- ? Padding (
107
- padding: const EdgeInsets .only (left: 20.0 , bottom: 16 ),
108
- child: BlocBuilder <ProcessBloc , ProcessState >(
109
- builder: (context, processState) {
110
- return MaterialButton (
111
- hoverColor: Colors .transparent,
112
- onPressed: () {
113
- context
114
- .read <UpdaterBloc >()
115
- .add (CheckForUpdates (processState.version! ));
116
- },
117
- child: Row (
118
- children: [
119
- Icon (
120
- Icons .update,
121
- color: Colors .white54,
122
- ),
123
- SizedBox (
124
- width: 20 ,
125
- ),
126
- Text (
127
- 'Check for updates' ,
128
- style: TextStyle (
129
- color: Colors .white60, fontSize: 14 ),
130
- ),
131
- ],
132
- ),
133
- );
134
- },
135
- ),
136
- )
137
- : Container ();
138
- },
139
95
currentIndex: _currentIndex,
140
96
onTap: (val) {
141
97
if (mounted && _currentIndex != val) {
@@ -185,3 +141,66 @@ class _HomeState extends State<Home> {
185
141
);
186
142
}
187
143
}
144
+
145
+ class _CheckForUpdatesButton extends StatelessWidget {
146
+ const _CheckForUpdatesButton ({
147
+ Key ? key,
148
+ }) : super (key: key);
149
+
150
+ @override
151
+ Widget build (BuildContext context) {
152
+ if (! Platform .isWindows) return Container ();
153
+
154
+ return BlocBuilder <ProcessBloc , ProcessState >(
155
+ builder: (context, state) {
156
+ return InkWell (
157
+ borderRadius: BorderRadius .circular (25 ),
158
+ hoverColor: Colors .transparent,
159
+ onTap: () {
160
+ context.read <UpdaterBloc >().add (CheckForUpdates (state.version! ));
161
+ },
162
+ child: Container (
163
+ margin: const EdgeInsets .all (10 ),
164
+ padding: const EdgeInsets .all (12 ),
165
+ decoration: BoxDecoration (
166
+ borderRadius: BorderRadius .circular (25 ),
167
+ color: kBgLightColor,
168
+ ),
169
+ child: Material (
170
+ type: MaterialType .transparency,
171
+ child: IntrinsicHeight (
172
+ child: Row (
173
+ children: [
174
+ Icon (
175
+ Icons .update,
176
+ color: Colors .white54,
177
+ ),
178
+ VerticalDivider (),
179
+ Expanded (
180
+ child: FittedBox (
181
+ child: Text (
182
+ 'Check for updates' ,
183
+ style: TextStyle (color: Colors .white, fontSize: 15 ),
184
+ textAlign: TextAlign .center,
185
+ ),
186
+ ),
187
+ ),
188
+ VerticalDivider (),
189
+ Text (
190
+ 'V${state .version !.trim ()}' ,
191
+ style: TextStyle (
192
+ fontSize: 12 ,
193
+ fontWeight: FontWeight .bold,
194
+ color: Colors .white60,
195
+ ),
196
+ ),
197
+ ],
198
+ ),
199
+ ),
200
+ ),
201
+ ),
202
+ );
203
+ },
204
+ );
205
+ }
206
+ }
0 commit comments