@@ -16,6 +16,7 @@ import 'package:ccxgui/screens/settings/hardsubx_settings.dart';
1616import 'package:ccxgui/screens/settings/input_settings.dart' ;
1717import 'package:ccxgui/screens/settings/obscure_settings.dart' ;
1818import 'package:ccxgui/screens/settings/output_settings.dart' ;
19+ import 'package:ccxgui/utils/constants.dart' ;
1920
2021class Home extends StatefulWidget {
2122 @override
@@ -79,63 +80,18 @@ class _HomeState extends State<Home> {
7980 hideTitleBar: true ,
8081 drawerHeaderBuilder: (context) {
8182 return Column (
83+ mainAxisAlignment: MainAxisAlignment .center,
8284 children: < Widget > [
8385 DrawerHeader (
8486 child: SvgPicture .asset (
8587 logo,
8688 semanticsLabel: 'CCExtractor Logo' ,
8789 ),
8890 ),
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 ()
10192 ],
10293 );
10394 },
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- },
13995 currentIndex: _currentIndex,
14096 onTap: (val) {
14197 if (mounted && _currentIndex != val) {
@@ -185,3 +141,66 @@ class _HomeState extends State<Home> {
185141 );
186142 }
187143}
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