From 8e777e1b00c2aaf83f7a5c2bd710c369265150af Mon Sep 17 00:00:00 2001 From: Mohit Kumar Yadav Date: Wed, 26 Feb 2025 10:38:51 +0530 Subject: [PATCH 1/3] Update files to null saftey --- lib/app_bootstrap.dart | 12 ++-- lib/localization/app_localizations.dart | 6 +- lib/main.dart | 6 +- lib/models/player.dart | 4 +- lib/models/server.dart | 10 +-- lib/routes/custom_router.dart | 2 +- lib/steam_api/steam_api.dart | 2 +- lib/ui/pages/home_page/home_page.dart | 10 +-- .../server_details_page.dart | 60 ++++++++--------- lib/ui/pages/settings_page/settings_page.dart | 14 ++-- lib/ui/widgets/add_server.dart | 64 +++++++++---------- .../player_widgets/player_profile.dart | 32 +++++----- .../widgets/player_widgets/players_list.dart | 12 ++-- lib/ui/widgets/server_widgets/console.dart | 2 +- .../server_widgets/empty_server_state.dart | 4 +- .../server_widgets/server_controls.dart | 30 ++++----- .../server_widgets/server_details_header.dart | 4 +- .../widgets/server_widgets/server_item.dart | 12 ++-- pubspec.yaml | 2 +- test/widget_test.dart | 30 --------- 20 files changed, 144 insertions(+), 174 deletions(-) delete mode 100644 test/widget_test.dart diff --git a/lib/app_bootstrap.dart b/lib/app_bootstrap.dart index c245501..f09a78a 100644 --- a/lib/app_bootstrap.dart +++ b/lib/app_bootstrap.dart @@ -9,22 +9,22 @@ import 'localization/app_localizations.dart'; import 'models/language.dart'; class AppBootstrap extends StatefulWidget { - const AppBootstrap(this.selectedLocale, {Key key,}) : super(key: key); + const AppBootstrap(this.selectedLocale, {Key? key,}) : super(key: key); - final Locale selectedLocale; + final Locale? selectedLocale; @override _AppBootstrapState createState() => _AppBootstrapState(); static void setLocale(BuildContext context, Locale locale) { final _AppBootstrapState state = context - .findAncestorStateOfType<_AppBootstrapState>(); + .findAncestorStateOfType<_AppBootstrapState>()!; state.setLocale(locale); } } class _AppBootstrapState extends State { - Locale _selectedLocale; + Locale? _selectedLocale; @override void initState() { @@ -57,14 +57,14 @@ class _AppBootstrapState extends State { ], locale: _selectedLocale, supportedLocales: Language.supportedLocales(), - localeResolutionCallback: (Locale deviceLocale, + localeResolutionCallback: (Locale? deviceLocale, Iterable supportedLocales) { if (_selectedLocale != null) { return _selectedLocale; } // set device locale as selected locale for (final Locale locale in supportedLocales) { - if (locale.languageCode == deviceLocale.languageCode + if (locale.languageCode == deviceLocale!.languageCode && locale.countryCode == deviceLocale.countryCode) { return deviceLocale; } diff --git a/lib/localization/app_localizations.dart b/lib/localization/app_localizations.dart index 4bd6033..c088b47 100644 --- a/lib/localization/app_localizations.dart +++ b/lib/localization/app_localizations.dart @@ -10,10 +10,10 @@ class AppLocalizations { final Locale locale; - static AppLocalizations of (BuildContext context) => + static AppLocalizations? of (BuildContext context) => Localizations.of(context, AppLocalizations); - Map _localizationValues; + late Map _localizationValues; Future load() async { final String jsonStringValues = await rootBundle @@ -25,7 +25,7 @@ class AppLocalizations { MapEntry(key, value.toString())); } - String getTranslatedValue(String key) => _localizationValues[key]; + String? getTranslatedValue(String key) => _localizationValues[key]; static const LocalizationsDelegate delegate = _AppLocalizationsDelegate(); diff --git a/lib/main.dart b/lib/main.dart index ec45bee..72eb2a2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -18,8 +18,8 @@ void main () { // get selected settings for theme and locale SharedPreferences.getInstance().then((SharedPreferences prefs) { final bool darkModeOn = prefs.getBool('darkMode') ?? true; - final String selectedLocaleCode = prefs.getString('selectedLocale'); - Locale selectedLocale; + final String? selectedLocaleCode = prefs.getString('selectedLocale'); + Locale? selectedLocale; if (selectedLocaleCode != null) { if (selectedLocaleCode.split('-').length == 2) { @@ -46,7 +46,7 @@ class MyApp extends StatelessWidget { const MyApp(this._darkModeOn, this._selectedLocale,); final bool _darkModeOn; - final Locale _selectedLocale; + final Locale? _selectedLocale; @override Widget build(BuildContext context) { diff --git a/lib/models/player.dart b/lib/models/player.dart index f31b02d..6665b02 100644 --- a/lib/models/player.dart +++ b/lib/models/player.dart @@ -8,7 +8,7 @@ class Player { String ping; String id; String steamId; - String flag; + String? flag; String timesConnected; @override @@ -16,7 +16,7 @@ class Player { return name; } - Map toJson() => { + Map toJson() => { 'name': name, 'score': score, 'duration': duration, diff --git a/lib/models/server.dart b/lib/models/server.dart index 2282f70..12d0cb9 100644 --- a/lib/models/server.dart +++ b/lib/models/server.dart @@ -2,18 +2,18 @@ class Server { Server(this.serverName, this.serverIp, this.serverPort, this.serverRcon, this.serverGame); - String serverName; - String serverIp; + String? serverName; + String? serverIp; String serverPort; - String serverRcon; + String? serverRcon; String serverGame; @override String toString() { - return serverName; + return serverName!; } - Map toJson() => { + Map toJson() => { 'serverName': serverName, 'serverIp': serverIp, 'serverPort': serverPort, diff --git a/lib/routes/custom_router.dart b/lib/routes/custom_router.dart index 0fedf41..a93fc41 100644 --- a/lib/routes/custom_router.dart +++ b/lib/routes/custom_router.dart @@ -17,7 +17,7 @@ class CustomRouter { case serverDetailsRoute: return MaterialPageRoute( builder: (_) => ServerDetailsPage( - routeSettings.arguments as Server)); + routeSettings.arguments as Server?)); default: return MaterialPageRoute(builder: (_) => const HomePage()); diff --git a/lib/steam_api/steam_api.dart b/lib/steam_api/steam_api.dart index 8c35f78..5620eec 100644 --- a/lib/steam_api/steam_api.dart +++ b/lib/steam_api/steam_api.dart @@ -18,7 +18,7 @@ Future getPlayerDetails(String id) async { } } -Future checkForSvUpdate(String ver) async { +Future checkForSvUpdate(String? ver) async { final http.Response response = await http.get( Uri.parse('http://api.steampowered.com/ISteamApps/UpToDateCheck/v0001/' diff --git a/lib/ui/pages/home_page/home_page.dart b/lib/ui/pages/home_page/home_page.dart index cecb260..11eea22 100644 --- a/lib/ui/pages/home_page/home_page.dart +++ b/lib/ui/pages/home_page/home_page.dart @@ -11,7 +11,7 @@ import 'package:turrant/ui/pages/pages.dart'; import 'package:turrant/ui/widgets/widgets.dart'; class HomePage extends StatefulWidget { - const HomePage({Key key,}) : super(key: key); + const HomePage({Key? key,}) : super(key: key); @override _HomePageState createState() => _HomePageState(); @@ -20,7 +20,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { final GlobalKey scaffoldKey = GlobalKey(); List servers = []; - Server _currentServer; + Server? _currentServer; @override void initState() { @@ -30,19 +30,19 @@ class _HomePageState extends State { @override Widget build(BuildContext context) { - final String _title = AppLocalizations.of(context) + final String? _title = AppLocalizations.of(context)! .getTranslatedValue('app_bar_title'); final bool isSmallScreen = MediaQuery.of(context).size.width < 900; if (!isSmallScreen) { - return _buildLargeScreenLayout(context, _title); + return _buildLargeScreenLayout(context, _title!); } return Scaffold( body: CustomScrollView( slivers: [ - _buildAppBar(context, _title), + _buildAppBar(context, _title!), ServersList(servers, _removeServer, _handleSvLongPress, _setSelectedServer), ], diff --git a/lib/ui/pages/server_details_page/server_details_page.dart b/lib/ui/pages/server_details_page/server_details_page.dart index 5c00cd5..23a4eac 100644 --- a/lib/ui/pages/server_details_page/server_details_page.dart +++ b/lib/ui/pages/server_details_page/server_details_page.dart @@ -16,7 +16,7 @@ import 'package:turrant/utils/utils.dart'; class ServerDetailsPage extends StatefulWidget { const ServerDetailsPage(this.server); - final Server server; + final Server? server; @override _ServerDetailsPageState createState() => _ServerDetailsPageState(); @@ -26,9 +26,9 @@ class ServerDetailsPage extends StatefulWidget { class Choice { Choice({this.title, this.icon, this.onSelect}); - final String title; - final IconData icon; - final Function onSelect; + final String? title; + final IconData? icon; + final Function? onSelect; } const List defaultMaps = [ @@ -37,20 +37,20 @@ const List defaultMaps = [ ]; class _ServerDetailsPageState extends State { - String ip; - int port; - String rconPassword; + String? ip; + late int port; + String? rconPassword; bool isLoading = true; - SourceServer sourceServer; - List players; + SourceServer? sourceServer; + List? players; List maps = defaultMaps; List commands = []; - String map; - String numOfPlayers; - String maxPlayers; - String version; - int tvPort; + String? map; + String? numOfPlayers; + String? maxPlayers; + String? version; + int? tvPort; bool isPublic = true; bool isVacEnabled = true; bool isTvEnabled = false; @@ -62,9 +62,9 @@ class _ServerDetailsPageState extends State { void initState() { super.initState(); - ip = widget.server.serverIp; - port = int.parse(widget.server.serverPort); - rconPassword = widget.server.serverRcon; + ip = widget.server!.serverIp; + port = int.parse(widget.server!.serverPort); + rconPassword = widget.server!.serverRcon; refreshInfo(); choices = [ @@ -77,9 +77,9 @@ class _ServerDetailsPageState extends State { @override void didUpdateWidget(covariant ServerDetailsPage oldWidget) { - ip = widget.server.serverIp; - port = int.parse(widget.server.serverPort); - rconPassword = widget.server.serverRcon; + ip = widget.server!.serverIp; + port = int.parse(widget.server!.serverPort); + rconPassword = widget.server!.serverRcon; refreshInfo(); choices = [ @@ -94,7 +94,7 @@ class _ServerDetailsPageState extends State { void _selectChoice(Choice choice) { if (choice.onSelect != null) { - choice.onSelect(context); + choice.onSelect!(context); } } @@ -112,7 +112,7 @@ class _ServerDetailsPageState extends State { durationSec: 2); final ClipboardData data = ClipboardData( - text: '${widget.server.serverIp}:${widget.server.serverPort}'); + text: '${widget.server!.serverIp}:${widget.server!.serverPort}'); await Clipboard.setData(data); } @@ -124,7 +124,7 @@ class _ServerDetailsPageState extends State { length: 2, child: Scaffold( appBar: AppBar( - title: Text(widget.server.serverName), + title: Text(widget.server!.serverName!), actions: [ // overflow menu PopupMenuButton( @@ -137,7 +137,7 @@ class _ServerDetailsPageState extends State { children: [ Icon(choice.icon), const SizedBox(width: 10,), - Text(choice.title), + Text(choice.title!), ], ), ); @@ -167,8 +167,8 @@ class _ServerDetailsPageState extends State { children: [ const FaIcon(FontAwesomeIcons.infoCircle, size: 18), const SizedBox(width: 10,), - Text(AppLocalizations.of(context) - .getTranslatedValue('details_tab_label'), + Text(AppLocalizations.of(context)! + .getTranslatedValue('details_tab_label')!, style: AppStyles.tabItemLabelStyle,) ], ), @@ -178,8 +178,8 @@ class _ServerDetailsPageState extends State { children: [ const FaIcon(FontAwesomeIcons.terminal, size: 18,), const SizedBox(width: 10,), - Text(AppLocalizations.of(context) - .getTranslatedValue('console_tab_label'), + Text(AppLocalizations.of(context)! + .getTranslatedValue('console_tab_label')!, style: AppStyles.tabItemLabelStyle,) ], ), @@ -211,7 +211,7 @@ class _ServerDetailsPageState extends State { sendCommandToSv, showToast, maps, numOfPlayers, maxPlayers, version, tvPort, isSvOutDated), PlayersList(players, refreshInfo, sendCommandToSv, showToast), - if (players.isEmpty) EmptyServerState(), + if (players!.isEmpty) EmptyServerState(), ], ) : const Center(child: CircularProgressIndicator()), ); @@ -241,7 +241,7 @@ class _ServerDetailsPageState extends State { } } - Future sendCommandToSv(String cmd, {Function callback}) async { + Future sendCommandToSv(String cmd, {Function? callback}) async { // clear console history if (cmd == 'clear') { setState(() { diff --git a/lib/ui/pages/settings_page/settings_page.dart b/lib/ui/pages/settings_page/settings_page.dart index 27fa1c2..c999215 100644 --- a/lib/ui/pages/settings_page/settings_page.dart +++ b/lib/ui/pages/settings_page/settings_page.dart @@ -11,7 +11,7 @@ import 'package:turrant/themes/styling.dart'; import 'package:turrant/themes/theme_notifier.dart'; class SettingsPage extends StatefulWidget { - const SettingsPage({Key key,}) : super(key: key); + const SettingsPage({Key? key,}) : super(key: key); @override _SettingsPageState createState() => _SettingsPageState(); @@ -19,7 +19,7 @@ class SettingsPage extends StatefulWidget { class _SettingsPageState extends State { bool isDarkModeOn = false; - Language currentLanguage = Language.supportedLanguages[0]; + Language? currentLanguage = Language.supportedLanguages[0]; @override void initState() { @@ -29,8 +29,8 @@ class _SettingsPageState extends State { @override Widget build(BuildContext context) { - final String _title = AppLocalizations.of(context) - .getTranslatedValue('setting_page_app_bar_title'); + final String _title = AppLocalizations.of(context)! + .getTranslatedValue('setting_page_app_bar_title')!; return Scaffold( appBar: AppBar( @@ -63,7 +63,7 @@ class _SettingsPageState extends State { dropdownColor: AppStyles.charcoalGrey, value: currentLanguage, underline: const SizedBox(), - onChanged: (Language language) { + onChanged: (Language? language) { _changeLanguage(context, language); }, iconEnabledColor: Theme.of(context).accentColor, @@ -82,10 +82,10 @@ class _SettingsPageState extends State { ); } - void _changeLanguage(BuildContext context, Language language) { + void _changeLanguage(BuildContext context, Language? language) { SharedPreferences.getInstance().then((SharedPreferences prefs) { prefs.setString('selectedLocale', - '${language.languageCode}-${language.countryCode}'); + '${language!.languageCode}-${language.countryCode}'); setState(() { currentLanguage = language; }); diff --git a/lib/ui/widgets/add_server.dart b/lib/ui/widgets/add_server.dart index 2693b76..da555da 100644 --- a/lib/ui/widgets/add_server.dart +++ b/lib/ui/widgets/add_server.dart @@ -13,9 +13,9 @@ import 'package:turrant/themes/styling.dart'; class AddServerForm extends StatefulWidget { const AddServerForm( - {Key key, @required this.refreshServers, this.sv}) : super(key: key); + {Key? key, required this.refreshServers, this.sv}) : super(key: key); final Function refreshServers; - final Server sv; + final Server? sv; @override _AddServerFormState createState() => _AddServerFormState(); @@ -25,10 +25,10 @@ class _AddServerFormState extends State { final GlobalKey _key = GlobalKey(); // state - String ip; - String name; - int port; - String password; + String? ip; + String? name; + int? port; + String? password; bool isEditing = false; bool isLoading = false; int connectionAttempt = 0; @@ -37,10 +37,10 @@ class _AddServerFormState extends State { void initState() { super.initState(); if (widget.sv != null) { - name = widget.sv.serverName; - ip = widget.sv.serverIp; - port = int.parse(widget.sv.serverPort); - password = widget.sv.serverRcon; + name = widget.sv!.serverName; + ip = widget.sv!.serverIp; + port = int.parse(widget.sv!.serverPort); + password = widget.sv!.serverRcon; isEditing = true; } } @@ -64,7 +64,7 @@ class _AddServerFormState extends State { const SizedBox(height: 10,), TextFormField( enabled: !isLoading, - onSaved: (String val) => setState(() => name = val), + onSaved: (String? val) => setState(() => name = val), initialValue: name, decoration: InputDecoration( contentPadding: const EdgeInsets.all(10.0), @@ -73,18 +73,18 @@ class _AddServerFormState extends State { Radius.circular(10.0), ), ), - labelText: AppLocalizations.of(context) + labelText: AppLocalizations.of(context)! .getTranslatedValue('form_name_field_txt'), - hintText: AppLocalizations.of(context) + hintText: AppLocalizations.of(context)! .getTranslatedValue('form_name_field_txt'), ), ), const SizedBox(height: 20,), TextFormField( enabled: !isLoading, - validator: (String val) => val.isEmpty ? AppLocalizations.of(context) + validator: (String? val) => val!.isEmpty ? AppLocalizations.of(context)! .getTranslatedValue('form_ip_field_err') : null, - onSaved: (String val) => setState(() => ip = val), + onSaved: (String? val) => setState(() => ip = val), initialValue: ip, decoration: InputDecoration( contentPadding: const EdgeInsets.all(10.0), @@ -93,18 +93,18 @@ class _AddServerFormState extends State { Radius.circular(10.0), ), ), - labelText: AppLocalizations.of(context) + labelText: AppLocalizations.of(context)! .getTranslatedValue('form_ip_field_txt'), - hintText: AppLocalizations.of(context) + hintText: AppLocalizations.of(context)! .getTranslatedValue('form_ip_field_txt'), ), ), const SizedBox(height: 20,), TextFormField( enabled: !isLoading, - validator: (String val) => val.isEmpty ? AppLocalizations.of(context) + validator: (String? val) => val!.isEmpty ? AppLocalizations.of(context)! .getTranslatedValue('form_port_field_err') : null, - onSaved: (String val) => setState(() => port = int.parse(val)), + onSaved: (String? val) => setState(() => port = int.parse(val!)), initialValue: port != null ? port.toString() : '', keyboardType: TextInputType.number, decoration: InputDecoration( @@ -114,18 +114,18 @@ class _AddServerFormState extends State { Radius.circular(10.0), ), ), - labelText: AppLocalizations.of(context) + labelText: AppLocalizations.of(context)! .getTranslatedValue('form_port_field_txt'), - hintText: AppLocalizations.of(context) + hintText: AppLocalizations.of(context)! .getTranslatedValue('form_port_field_txt'), ), ), const SizedBox(height: 20,), TextFormField( enabled: !isLoading, - validator: (String val) => val.isEmpty ? AppLocalizations.of(context) + validator: (String? val) => val!.isEmpty ? AppLocalizations.of(context)! .getTranslatedValue('form_pass_field_err') : null, - onSaved: (String val) => setState(() => password = val), + onSaved: (String? val) => setState(() => password = val), initialValue: password, obscureText: true, decoration: InputDecoration( @@ -135,22 +135,22 @@ class _AddServerFormState extends State { Radius.circular(10.0), ), ), - labelText: AppLocalizations.of(context) + labelText: AppLocalizations.of(context)! .getTranslatedValue('form_pass_field_txt'), - hintText: AppLocalizations.of(context) + hintText: AppLocalizations.of(context)! .getTranslatedValue('form_pass_field_txt'), ), ), const SizedBox(height: 15,), MaterialButton( onPressed: isLoading ? null : () { - if (_key.currentState.validate() && !isLoading) { + if (_key.currentState!.validate() && !isLoading) { setState(() { connectionAttempt = 0; isLoading = true; }); - _key.currentState.save(); + _key.currentState!.save(); _connectToServer(); } }, @@ -169,7 +169,7 @@ class _AddServerFormState extends State { ); } - Future _createSourceServer () async{ + Future _createSourceServer () async{ setState(() { connectionAttempt += 1; }); @@ -179,13 +179,13 @@ class _AddServerFormState extends State { } return await SourceServer.connect( - ip, port, password: password + ip, port!, password: password ); } Future _connectToServer() async { try { - final SourceServer server = await _createSourceServer() + final SourceServer? server = await _createSourceServer() .timeout(const Duration(seconds: 2)); if (server == null) { @@ -220,7 +220,7 @@ class _AddServerFormState extends State { server.close(); final Server localServer = Server((name != null - && name.trim().length > 1) ? name : info.name, + && name!.trim().length > 1) ? name : info.name, ip, port.toString(), password, info.game); SharedPreferences.getInstance().then((SharedPreferences prefs) { @@ -231,7 +231,7 @@ class _AddServerFormState extends State { if (isEditing) { final int indexOfCurrentSv = currentAddedServers - .indexOf(jsonEncode(widget.sv.toJson())); + .indexOf(jsonEncode(widget.sv!.toJson())); currentAddedServers.replaceRange( indexOfCurrentSv, indexOfCurrentSv + 1, [jsonLocalServer]); currentAddedServers.join(', '); diff --git a/lib/ui/widgets/player_widgets/player_profile.dart b/lib/ui/widgets/player_widgets/player_profile.dart index 43a4eb9..3c6a874 100644 --- a/lib/ui/widgets/player_widgets/player_profile.dart +++ b/lib/ui/widgets/player_widgets/player_profile.dart @@ -9,17 +9,17 @@ import 'package:turrant/themes/styling.dart'; class PlayerProfile extends StatefulWidget { const PlayerProfile({ - Key key, + Key? key, this.player, this.imgSize, this.bgColor, this.borderRadius, }) : super(key: key); - final Player player; - final double imgSize; - final Color bgColor; - final BorderRadius borderRadius; + final Player? player; + final double? imgSize; + final Color? bgColor; + final BorderRadius? borderRadius; @override _PlayerProfileState createState() => _PlayerProfileState(); @@ -27,16 +27,16 @@ class PlayerProfile extends StatefulWidget { class _PlayerProfileState extends State { bool isLoading = true; - String profileImg; - String name; - String flags; + late String profileImg; + String? name; + String? flags; @override void initState() { _fetchProfile(); - name = widget.player.name; - flags = widget.player.flag; + name = widget.player!.name; + flags = widget.player!.flag; super.initState(); } @@ -85,7 +85,7 @@ class _PlayerProfileState extends State { children: [ SizedBox( width: MediaQuery.of(context).size.width * 0.60, - child: Text(name, style: AppStyles.playerItemTitle, + child: Text(name!, style: AppStyles.playerItemTitle, overflow: TextOverflow.ellipsis,), ), const SizedBox(height: 8,), @@ -96,7 +96,7 @@ class _PlayerProfileState extends State { const SizedBox(width: 6,), SizedBox( width: 52, - child: Text('${widget.player.ping}ms', + child: Text('${widget.player!.ping}ms', style: AppStyles.serverItemSubTitle, overflow: TextOverflow.ellipsis, ), @@ -107,7 +107,7 @@ class _PlayerProfileState extends State { const SizedBox(width: 6,), SizedBox( width: 72, - child: Text('${widget.player.duration} min', + child: Text('${widget.player!.duration} min', style: AppStyles.serverItemSubTitle, overflow: TextOverflow.ellipsis, ), @@ -116,7 +116,7 @@ class _PlayerProfileState extends State { const Icon(FontAwesomeIcons.hashtag, size: 14, color: AppStyles.white40,), const SizedBox(width: 6,), - Text(widget.player.timesConnected, + Text(widget.player!.timesConnected, style: AppStyles.serverItemSubTitle, overflow: TextOverflow.ellipsis, ), @@ -146,7 +146,7 @@ class _PlayerProfileState extends State { return Colors.transparent; } - Widget _buildBadges (BuildContext context) { + Widget? _buildBadges (BuildContext context) { final String userFlags = flags ?? ''; final bool isRoot = userFlags.contains('root') || userFlags.contains('admin'); @@ -181,7 +181,7 @@ class _PlayerProfileState extends State { } Future _fetchProfile () async { - final dynamic playerProfile = await getPlayerDetails(widget.player.id); + final dynamic playerProfile = await getPlayerDetails(widget.player!.id); setState(() { isLoading = false; diff --git a/lib/ui/widgets/player_widgets/players_list.dart b/lib/ui/widgets/player_widgets/players_list.dart index 390fbb0..4e157da 100644 --- a/lib/ui/widgets/player_widgets/players_list.dart +++ b/lib/ui/widgets/player_widgets/players_list.dart @@ -14,7 +14,7 @@ class PlayersList extends StatelessWidget { const PlayersList(this.players, this.refreshInfo, this.sendCommandToSv, this.showToast); - final List players; + final List? players; final Function refreshInfo; final Function sendCommandToSv; final Function showToast; @@ -26,7 +26,7 @@ class PlayersList extends StatelessWidget { shrinkWrap: true, physics: const NeverScrollableScrollPhysics(), padding: const EdgeInsets.all(8), - itemCount: players.length, + itemCount: players!.length, itemBuilder: (BuildContext context, int index) { return Material( @@ -37,7 +37,7 @@ class PlayersList extends StatelessWidget { context: context, isScrollControlled: true, builder: (BuildContext context) => - _buildPlayerOptions(context, players[index])); + _buildPlayerOptions(context, players![index])); }, child: AnimatedContainer( duration: const Duration(milliseconds: 300), @@ -46,7 +46,7 @@ class PlayersList extends StatelessWidget { border: Border.all(width: 2, color: _getBorderColor(context, index),) ), - child: PlayerProfile(player: players[index], imgSize: 50, + child: PlayerProfile(player: players![index], imgSize: 50, bgColor: AppStyles.darkBg, borderRadius: const BorderRadius.all(Radius.circular(8)) ), @@ -62,7 +62,7 @@ class PlayersList extends StatelessWidget { Color _getBorderColor (BuildContext context, int index) { - final String userFlags = players[index].flag ?? ''; + final String userFlags = players![index].flag ?? ''; final bool isRoot = userFlags.contains('root') || userFlags.contains('admin'); final bool isVip = userFlags.contains('res'); @@ -147,7 +147,7 @@ class PlayersList extends StatelessWidget { if (player.flag != null) ListTile( leading: const FaIcon(FontAwesomeIcons.flag, size: 18,), - subtitle: Text(player.flag, + subtitle: Text(player.flag!, style: AppStyles.playerActionSubText,), title: const Text('User flags', style: AppStyles.playerActionText), diff --git a/lib/ui/widgets/server_widgets/console.dart b/lib/ui/widgets/server_widgets/console.dart index 7b92f74..f3944d2 100644 --- a/lib/ui/widgets/server_widgets/console.dart +++ b/lib/ui/widgets/server_widgets/console.dart @@ -187,7 +187,7 @@ class _ConsoleState extends State { void _checkSavedCmds () { SharedPreferences.getInstance().then((SharedPreferences prefs) { - final String currentCmds = prefs.getString('savedCmds'); + final String? currentCmds = prefs.getString('savedCmds'); final List splitCmds = currentCmds != null && currentCmds .isNotEmpty ? currentCmds.split(';') : []; diff --git a/lib/ui/widgets/server_widgets/empty_server_state.dart b/lib/ui/widgets/server_widgets/empty_server_state.dart index 9382997..1bc2ea8 100644 --- a/lib/ui/widgets/server_widgets/empty_server_state.dart +++ b/lib/ui/widgets/server_widgets/empty_server_state.dart @@ -15,8 +15,8 @@ class EmptyServerState extends StatelessWidget { width: 200, ), const SizedBox(height: 20,), - Text(AppLocalizations.of(context) - .getTranslatedValue('empty_sv_msg'), style: AppStyles.emptySvMsg,), + Text(AppLocalizations.of(context)! + .getTranslatedValue('empty_sv_msg')!, style: AppStyles.emptySvMsg,), ], ), ), diff --git a/lib/ui/widgets/server_widgets/server_controls.dart b/lib/ui/widgets/server_widgets/server_controls.dart index c71a016..e87e98e 100644 --- a/lib/ui/widgets/server_widgets/server_controls.dart +++ b/lib/ui/widgets/server_widgets/server_controls.dart @@ -13,16 +13,16 @@ class ServerControls extends StatelessWidget { this.sendCommandToSv, this.showToast, this.maps, this.numOfPlayers, this.maxPlayers, this.version, this.tvPort, this.isSvOutDated); - final Server server; - final String map; + final Server? server; + final String? map; final Function refreshInfo; final Function sendCommandToSv; final Function showToast; final List maps; - final String numOfPlayers; - final String maxPlayers; - final String version; - final int tvPort; + final String? numOfPlayers; + final String? maxPlayers; + final String? version; + final int? tvPort; final bool isSvOutDated; @override @@ -55,10 +55,10 @@ class ServerControls extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(map, overflow: TextOverflow.ellipsis, + Text(map!, overflow: TextOverflow.ellipsis, style: AppStyles.serverDetailsHeaderTitle), const SizedBox(height: 2,), - Text('${server.serverIp}:${server.serverPort}', + Text('${server!.serverIp}:${server!.serverPort}', style: AppStyles.serverDetailsHeaderSubTitle), ], ), @@ -80,8 +80,8 @@ class ServerControls extends StatelessWidget { ), child: Padding( padding: const EdgeInsets.symmetric(horizontal: 5.0), - child: Text(AppLocalizations.of(context) - .getTranslatedValue('change_map'), + child: Text(AppLocalizations.of(context)! + .getTranslatedValue('change_map')!, style: AppStyles.mapBtn,), ), onPressed: () { @@ -113,7 +113,7 @@ class ServerControls extends StatelessWidget { overflow: TextOverflow.ellipsis, style: AppStyles.serverDetailsHeaderTitle), const SizedBox(height: 2,), - Text('${server.serverIp}:$tvPort', + Text('${server!.serverIp}:$tvPort', style: AppStyles.serverDetailsHeaderSubTitle), ], ), @@ -131,7 +131,7 @@ class ServerControls extends StatelessWidget { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text(version, + Text(version!, style: AppStyles.serverDetailsHeaderTitle,), const SizedBox(height: 2,), Text(isSvOutDated ? 'Update available!' : 'Up to Date', @@ -153,7 +153,7 @@ class ServerControls extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text('${AppLocalizations.of(context).getTranslatedValue( + Text('${AppLocalizations.of(context)!.getTranslatedValue( 'player_count')} ($numOfPlayers/$maxPlayers)', style: AppStyles.serverDetailsHeaderSubTitle .copyWith(color: AppStyles.white),), @@ -162,8 +162,8 @@ class ServerControls extends StatelessWidget { child: Row( children: [ Text( - AppLocalizations.of(context) - .getTranslatedValue('refresh_players_tooltip'), + AppLocalizations.of(context)! + .getTranslatedValue('refresh_players_tooltip')!, style: AppStyles.underlineButton, ), ], diff --git a/lib/ui/widgets/server_widgets/server_details_header.dart b/lib/ui/widgets/server_widgets/server_details_header.dart index b787720..f5490f6 100644 --- a/lib/ui/widgets/server_widgets/server_details_header.dart +++ b/lib/ui/widgets/server_widgets/server_details_header.dart @@ -8,8 +8,8 @@ class ServerDetailsHeader extends StatelessWidget { const ServerDetailsHeader(this.server, this.map, this.availableMaps, this.isPublic, this.isVacEnabled, this.isTvEnabled); - final Server server; - final String map; + final Server? server; + final String? map; final bool isPublic; final bool isVacEnabled; final bool isTvEnabled; diff --git a/lib/ui/widgets/server_widgets/server_item.dart b/lib/ui/widgets/server_widgets/server_item.dart index afff1ff..73d1baa 100644 --- a/lib/ui/widgets/server_widgets/server_item.dart +++ b/lib/ui/widgets/server_widgets/server_item.dart @@ -25,7 +25,7 @@ class ServerItem extends StatefulWidget { class _ServerItemState extends State { String playerInfo = '0 / 10'; - Timer _periodicCheckInfo; + late Timer _periodicCheckInfo; bool _isTvEnabled = false; bool _isOffline = false; @@ -83,7 +83,7 @@ class _ServerItemState extends State { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Flexible( - child: Text(widget.server.serverName, + child: Text(widget.server.serverName!, overflow: TextOverflow.ellipsis, style: AppStyles.serverItemTitle,), ), @@ -133,8 +133,8 @@ class _ServerItemState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon(Icons.clear), - Text(AppLocalizations.of(context) - .getTranslatedValue('delete_sv_msg'), + Text(AppLocalizations.of(context)! + .getTranslatedValue('delete_sv_msg')!, style: AppStyles.serverItemActionText,) ], ) @@ -157,8 +157,8 @@ class _ServerItemState extends State { mainAxisAlignment: MainAxisAlignment.center, children: [ const Icon(Icons.edit), - Text(AppLocalizations.of(context) - .getTranslatedValue('edit_sv_msg'), + Text(AppLocalizations.of(context)! + .getTranslatedValue('edit_sv_msg')!, style: AppStyles.serverItemActionText) ], ) diff --git a/pubspec.yaml b/pubspec.yaml index 231e7a5..8572e17 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.3.4+49 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: '>=2.12.0 <3.0.0' dependencies: flutter: diff --git a/test/widget_test.dart b/test/widget_test.dart deleted file mode 100644 index 5224d2f..0000000 --- a/test/widget_test.dart +++ /dev/null @@ -1,30 +0,0 @@ -// This is a basic Flutter widget test. -// -// To perform an interaction with a widget in your test, use the WidgetTester -// utility that Flutter provides. For example, you can send tap and scroll -// gestures. You can also use WidgetTester to find child widgets in the widget -// tree, read text, and verify that the values of widget properties are correct. - -import 'package:flutter/material.dart'; -import 'package:flutter_test/flutter_test.dart'; - -import 'package:turrant/main.dart'; - -void main() { - testWidgets('Counter increments smoke test', (WidgetTester tester) async { - // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); - - // Verify that our counter starts at 0. - expect(find.text('0'), findsOneWidget); - expect(find.text('1'), findsNothing); - - // Tap the '+' icon and trigger a frame. - await tester.tap(find.byIcon(Icons.add)); - await tester.pump(); - - // Verify that our counter has incremented. - expect(find.text('0'), findsNothing); - expect(find.text('1'), findsOneWidget); - }); -} From 9314c7498844988cda947f49a3720a3998e9808e Mon Sep 17 00:00:00 2001 From: Mohit Kumar Yadav Date: Wed, 26 Feb 2025 10:52:26 +0530 Subject: [PATCH 2/3] Upgrade provider and slidable --- .../widgets/server_widgets/server_item.dart | 169 ++++++------------ pubspec.lock | 128 +++++++------ pubspec.yaml | 8 +- 3 files changed, 140 insertions(+), 165 deletions(-) diff --git a/lib/ui/widgets/server_widgets/server_item.dart b/lib/ui/widgets/server_widgets/server_item.dart index 73d1baa..19c0ab4 100644 --- a/lib/ui/widgets/server_widgets/server_item.dart +++ b/lib/ui/widgets/server_widgets/server_item.dart @@ -46,126 +46,73 @@ class _ServerItemState extends State { @override Widget build(BuildContext context) { - return Slidable( - key: Key('${widget.server.serverIp}:${widget.server.serverName}'), - actionPane: const SlidableBehindActionPane(), - actionExtentRatio: 0.25, - child: InkWell( - onTap: () { - final bool isSmallScreen = MediaQuery.of(context).size.width < 900; + return InkWell( + onTap: () { + final bool isSmallScreen = MediaQuery.of(context).size.width < 900; - if (isSmallScreen) { - Navigator.pushNamed(context, serverDetailsRoute, - arguments: widget.server); - } - widget._setSelectedServer(widget.server); - }, - onLongPress: () { - widget._handleSvLongPress(widget.server); - }, - child: Material( - elevation: 8, - shadowColor: (_isOffline ? AppStyles.red : AppStyles.blue2) - .withOpacity(0.1), - child: Container( - width: MediaQuery.of(context).size.width, - decoration: BoxDecoration( - color: (_isOffline ? AppStyles.red : AppStyles.blue2) - .withOpacity(0.2), - borderRadius: const BorderRadius.all(Radius.circular(5)), - ), - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 10), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Flexible( - child: Text(widget.server.serverName!, - overflow: TextOverflow.ellipsis, - style: AppStyles.serverItemTitle,), - ), - if(widget.server.serverRcon != null) const Icon( - Icons.lock_open_rounded, size: 16, - color: AppStyles.white40), - ], - ), - const SizedBox(height: 8,), - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - const Icon(Icons.group, size: 20, - color: AppStyles.white40,), - const SizedBox(width: 5,), - Text(playerInfo, style: AppStyles.serverItemSubTitle), - ], - ), - if (_isTvEnabled) - const Icon(Icons.tv, size: 16, - color: AppStyles.white40,), - if (_isOffline) - const Icon(Icons.signal_wifi_off_sharp, size: 16, - color: AppStyles.white40,), - ], - ), - ], - ), - ), + if (isSmallScreen) { + Navigator.pushNamed(context, serverDetailsRoute, + arguments: widget.server); + } + widget._setSelectedServer(widget.server); + }, + onLongPress: () { + widget._handleSvLongPress(widget.server); + }, + child: Material( + elevation: 8, + shadowColor: (_isOffline ? AppStyles.red : AppStyles.blue2) + .withOpacity(0.1), + child: Container( + width: MediaQuery.of(context).size.width, + decoration: BoxDecoration( + color: (_isOffline ? AppStyles.red : AppStyles.blue2) + .withOpacity(0.2), + borderRadius: const BorderRadius.all(Radius.circular(5)), ), - ), - ), - actions: [ - SlideAction( - child: Container( - width: 105, - margin: const EdgeInsets.only(right: 5), - decoration: const BoxDecoration( - color: AppStyles.red, - borderRadius: BorderRadius.all( - Radius.circular(5.0), - ), - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 10), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Icon(Icons.clear), - Text(AppLocalizations.of(context)! - .getTranslatedValue('delete_sv_msg')!, - style: AppStyles.serverItemActionText,) + Flexible( + child: Text(widget.server.serverName!, + overflow: TextOverflow.ellipsis, + style: AppStyles.serverItemTitle,), + ), + if(widget.server.serverRcon != null) const Icon( + Icons.lock_open_rounded, size: 16, + color: AppStyles.white40), ], - ) - ), - onTap: () => widget._removeServer(widget.server) - ), - ], - secondaryActions: [ - SlideAction( - child: Container( - width: 105, - margin: const EdgeInsets.only(left: 5), - decoration: const BoxDecoration( - color: AppStyles.lightPurple, - borderRadius: BorderRadius.all( - Radius.circular(5.0), - ), ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, + const SizedBox(height: 8,), + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Icon(Icons.edit), - Text(AppLocalizations.of(context)! - .getTranslatedValue('edit_sv_msg')!, - style: AppStyles.serverItemActionText) + Row( + children: [ + const Icon(Icons.group, size: 20, + color: AppStyles.white40,), + const SizedBox(width: 5,), + Text(playerInfo, style: AppStyles.serverItemSubTitle), + ], + ), + if (_isTvEnabled) + const Icon(Icons.tv, size: 16, + color: AppStyles.white40,), + if (_isOffline) + const Icon(Icons.signal_wifi_off_sharp, size: 16, + color: AppStyles.white40,), ], - ) + ), + ], ), - onTap: () => widget._handleSvLongPress(widget.server) + ), ), - ], + ), ); } diff --git a/pubspec.lock b/pubspec.lock index 312bf2d..114c40e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -1,27 +1,20 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - ansicolor: - dependency: transitive - description: - name: ansicolor - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.1" archive: dependency: transitive description: name: archive url: "https://pub.dartlang.org" source: hosted - version: "3.1.2" + version: "3.4.2" args: dependency: transitive description: name: args url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.3.1" async: dependency: transitive description: @@ -50,6 +43,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.2.0" + cli_util: + dependency: transitive + description: + name: cli_util + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.5" clock: dependency: transitive description: @@ -64,6 +64,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.15.0" + console: + dependency: transitive + description: + name: console + url: "https://pub.dartlang.org" + source: hosted + version: "4.1.0" + convert: + dependency: transitive + description: + name: convert + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" crypto: dependency: transitive description: @@ -77,7 +91,7 @@ packages: name: cupertino_icons url: "https://pub.dartlang.org" source: hosted - version: "1.0.2" + version: "1.0.5" fake_async: dependency: transitive description: @@ -91,14 +105,14 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "1.0.0" + version: "1.2.1" file: dependency: transitive description: name: file url: "https://pub.dartlang.org" source: hosted - version: "6.1.0" + version: "6.1.4" flutter: dependency: "direct main" description: flutter @@ -117,7 +131,7 @@ packages: name: flutter_launcher_icons url: "https://pub.dartlang.org" source: hosted - version: "0.9.0" + version: "0.9.3" flutter_localizations: dependency: "direct main" description: flutter @@ -129,7 +143,7 @@ packages: name: flutter_slidable url: "https://pub.dartlang.org" source: hosted - version: "0.6.0" + version: "1.3.2" flutter_test: dependency: "direct dev" description: flutter @@ -146,7 +160,7 @@ packages: name: font_awesome_flutter url: "https://pub.dartlang.org" source: hosted - version: "9.1.0" + version: "10.4.0" freezed_annotation: dependency: transitive description: @@ -154,6 +168,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.14.2" + get_it: + dependency: transitive + description: + name: get_it + url: "https://pub.dartlang.org" + source: hosted + version: "7.6.0" http: dependency: "direct main" description: @@ -167,21 +188,14 @@ packages: name: http_parser url: "https://pub.dartlang.org" source: hosted - version: "4.0.0" + version: "4.0.2" image: dependency: transitive description: name: image url: "https://pub.dartlang.org" source: hosted - version: "3.0.2" - injector: - dependency: transitive - description: - name: injector - url: "https://pub.dartlang.org" - source: hosted - version: "2.0.0" + version: "3.1.3" intl: dependency: "direct main" description: @@ -209,7 +223,7 @@ packages: name: logging url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "1.1.0" matcher: dependency: transitive description: @@ -230,7 +244,7 @@ packages: name: msix url: "https://pub.dartlang.org" source: hosted - version: "2.1.3" + version: "3.7.0" nested: dependency: transitive description: @@ -244,7 +258,7 @@ packages: name: package_config url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.0" path: dependency: transitive description: @@ -258,21 +272,21 @@ packages: name: path_provider_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.6" path_provider_platform_interface: dependency: transitive description: name: path_provider_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.4" path_provider_windows: dependency: transitive description: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.6" pedantic: dependency: transitive description: @@ -293,49 +307,63 @@ packages: name: platform url: "https://pub.dartlang.org" source: hosted - version: "3.0.0" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.1.3" + pointycastle: + dependency: transitive + description: + name: pointycastle + url: "https://pub.dartlang.org" + source: hosted + version: "3.6.2" process: dependency: transitive description: name: process url: "https://pub.dartlang.org" source: hosted - version: "4.2.1" + version: "4.2.3" provider: dependency: "direct main" description: name: provider url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "6.1.2" + pub_semver: + dependency: transitive + description: + name: pub_semver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.2" shared_preferences: dependency: "direct main" description: name: shared_preferences url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.0.7" shared_preferences_linux: dependency: transitive description: name: shared_preferences_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.4" shared_preferences_macos: dependency: transitive description: name: shared_preferences_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.2" shared_preferences_platform_interface: dependency: transitive description: @@ -349,14 +377,14 @@ packages: name: shared_preferences_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.4" shared_preferences_windows: dependency: transitive description: name: shared_preferences_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.4" sky_engine: dependency: transitive description: flutter @@ -424,42 +452,42 @@ packages: name: url_launcher url: "https://pub.dartlang.org" source: hosted - version: "6.0.6" + version: "6.0.10" url_launcher_linux: dependency: transitive description: name: url_launcher_linux url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.3" url_launcher_macos: dependency: transitive description: name: url_launcher_macos url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.3" url_launcher_platform_interface: dependency: transitive description: name: url_launcher_platform_interface url: "https://pub.dartlang.org" source: hosted - version: "2.0.3" + version: "2.0.5" url_launcher_web: dependency: transitive description: name: url_launcher_web url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "2.0.7" url_launcher_windows: dependency: transitive description: name: url_launcher_windows url: "https://pub.dartlang.org" source: hosted - version: "2.0.0" + version: "2.0.2" vector_math: dependency: transitive description: @@ -473,7 +501,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.0.5" + version: "2.2.10" window_size: dependency: "direct main" description: @@ -489,7 +517,7 @@ packages: name: xdg_directories url: "https://pub.dartlang.org" source: hosted - version: "0.2.0" + version: "0.2.0+3" xml: dependency: transitive description: @@ -503,14 +531,14 @@ packages: name: xml2json url: "https://pub.dartlang.org" source: hosted - version: "5.3.1" + version: "5.3.2" yaml: dependency: transitive description: name: yaml url: "https://pub.dartlang.org" source: hosted - version: "3.1.0" + version: "3.1.1" sdks: - dart: ">=2.12.0 <3.0.0" + dart: ">=2.13.0 <3.0.0" flutter: ">=2.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index 8572e17..e333dbf 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -32,11 +32,11 @@ dependencies: cupertino_icons: ^1.0.2 # 3rd party dependencies - provider: ^5.0.0 + provider: ^6.1.2 shared_preferences: ^2.0.5 source_server: ^3.2.0-dev - flutter_slidable: ^0.6.0 - font_awesome_flutter: ^9.1.0 + flutter_slidable: ^1.3.2 + font_awesome_flutter: ^10.4.0 http: ^0.13.3 xml2json: ^5.3.1 url_launcher: ^6.0.6 @@ -51,7 +51,7 @@ dev_dependencies: sdk: flutter flutter_launcher_icons: ^0.9.0 - msix: ^2.1.3 + msix: ^3.7.0 # For information on the generic Dart part of this file, see the # following page: https://dart.dev/tools/pub/pubspec From 66d2654aad143c2e9ca25654448c4565f30f5514 Mon Sep 17 00:00:00 2001 From: Mohit Kumar Yadav Date: Wed, 26 Mar 2025 11:06:02 +0100 Subject: [PATCH 3/3] Fix prod release --- android/app/build.gradle | 4 ++-- android/app/src/main/AndroidManifest.xml | 1 + android/gradle.properties | 2 +- pubspec.yaml | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/android/app/build.gradle b/android/app/build.gradle index 653d52c..f33dfa1 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -45,8 +45,8 @@ android { defaultConfig { // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). applicationId "come.csgo.server.manager" - minSdkVersion 16 - targetSdkVersion 29 + minSdkVersion 26 + targetSdkVersion 35 versionCode flutterVersionCode.toInteger() versionName flutterVersionName } diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index 83735f4..4b814ae 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -15,6 +15,7 @@ android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" + android:exported="true" android:windowSoftInputMode="adjustResize">