@@ -21,10 +21,13 @@ import 'package:netshare/util/utility_functions.dart';
2121import 'package:netshare/config/constants.dart' ;
2222import 'package:netshare/ui/send/uploading_widget.dart' ;
2323
24+ import 'data/preload_data.dart' ;
25+
2426void main () async {
2527 WidgetsFlutterBinding .ensureInitialized ();
2628 await initPlugins ();
2729 setupDI ();
30+ await PreloadData .inject ();
2831 runApp (const MyApp ());
2932}
3033
@@ -41,7 +44,8 @@ class _MyAppState extends State<MyApp> {
4144
4245 final GoRouter _router = GoRouter (
4346 navigatorKey: _navigatorKey,
44- errorBuilder: (BuildContext context, GoRouterState state) => ErrorWidget (state.error! ),
47+ errorBuilder: (BuildContext context, GoRouterState state) =>
48+ ErrorWidget (state.error! ),
4549 routes: < GoRoute > [
4650 GoRoute (
4751 path: mRootPath,
@@ -71,7 +75,8 @@ class _MyAppState extends State<MyApp> {
7175 GoRoute (
7276 name: mSendPath,
7377 path: mSendPath,
74- builder: (BuildContext context, GoRouterState state) => const SendWidget (),
78+ builder: (BuildContext context, GoRouterState state) =>
79+ const SendWidget (),
7580 routes: [
7681 GoRoute (
7782 name: mUploadingPath,
@@ -88,7 +93,8 @@ class _MyAppState extends State<MyApp> {
8893 GoRoute (
8994 name: mScanningPath,
9095 path: mScanningPath,
91- builder: (BuildContext context, GoRouterState state) => const ScanQRWidget (),
96+ builder: (BuildContext context, GoRouterState state) =>
97+ const ScanQRWidget (),
9298 ),
9399 ],
94100 ),
@@ -110,29 +116,36 @@ class _MyAppState extends State<MyApp> {
110116 theme: ThemeData (
111117 useMaterial3: true ,
112118 appBarTheme: const AppBarTheme (color: backgroundColor),
113- colorScheme: ColorScheme .fromSeed (seedColor: seedColor, background: backgroundColor),
119+ colorScheme: ColorScheme .fromSeed (
120+ seedColor: seedColor, background: backgroundColor),
121+ iconButtonTheme: const IconButtonThemeData (
122+ style: ButtonStyle (
123+ iconColor: MaterialStatePropertyAll <Color >(textIconButtonColor),
124+ ),
125+ ),
114126 ),
115127 routerConfig: _router,
116128 builder: (context, child) {
117129 // Handle keyboard listener here
118- RawKeyboard .instance.addListener ((RawKeyEvent value) => _handleKeyEvent (value));
130+ RawKeyboard .instance
131+ .addListener ((RawKeyEvent value) => _handleKeyEvent (value));
119132 return child ?? const SizedBox .shrink ();
120133 },
121134 ),
122135 );
123136 }
124137
125138 void _handleKeyEvent (RawKeyEvent value) async {
126- if (! _isKeyboardListenerEnabled) return ;
139+ if (! _isKeyboardListenerEnabled) return ;
127140
128141 // If user pressed Command/Control + W keys, quit the app
129142 if (value.isMetaPressed && value.logicalKey == LogicalKeyboardKey .keyW ||
130143 value.isControlPressed && value.logicalKey == LogicalKeyboardKey .keyW) {
131-
132- if (_navigatorKey.currentContext == null ) return ;
144+ if (_navigatorKey.currentContext == null ) return ;
133145
134146 // show confirm dialog
135- _showQuitAppConfirmationDialog (_navigatorKey.currentContext! , (confirmCallback) {
147+ _showQuitAppConfirmationDialog (_navigatorKey.currentContext! ,
148+ (confirmCallback) {
136149 if (confirmCallback) {
137150 SystemNavigator .pop (); // Quit the app
138151 }
@@ -142,7 +155,8 @@ class _MyAppState extends State<MyApp> {
142155 }
143156 }
144157
145- void _showQuitAppConfirmationDialog (BuildContext context, Function (bool )? confirmCallback) {
158+ void _showQuitAppConfirmationDialog (
159+ BuildContext context, Function (bool )? confirmCallback) {
146160 // Disable the keyboard listener.
147161 _isKeyboardListenerEnabled = false ;
148162
0 commit comments