diff --git a/app_version_check/app_version.json b/app_version_check/app_version.json index c521a81b..56db8eec 100644 --- a/app_version_check/app_version.json +++ b/app_version_check/app_version.json @@ -1,11 +1,10 @@ { "name": "PSO2NGS Mod Manager", - "version": "1.4.0", + "version": "1.4.1", "description": [ - "Added new version notification", - "Linux version beta", - "Removed app reload button (it's faster to just close and reopen)", - "Bug fixes" + "Added a new refresh list button (near search bar)", + "Fixed a bug when applying duplicated mods", + "Minor bug fixes" ], "windows_file": "", "linux_file": "" diff --git a/lib/file_functions.dart b/lib/file_functions.dart index 18de3a05..f33394c3 100644 --- a/lib/file_functions.dart +++ b/lib/file_functions.dart @@ -206,7 +206,8 @@ Future modsToDataAdder(List modList) async { //set backup path to file modFile.backupIcePath = '$backupDirPath$s${modFile.iceName}'; for (var lists in modFilesList) { - List matchingList = lists.where((element) => element.iceName == modFile.iceName && element.isApplied == true).toList(); + List matchingList = + lists.where((element) => (element.iceName == modFile.iceName || element.modName == modFile.modName) && element.isApplied == true).toList(); if (matchingList.isNotEmpty) { duplicateModsApplied.add(matchingList); diff --git a/lib/home_page.dart b/lib/home_page.dart index 324d348c..b5fbd529 100644 --- a/lib/home_page.dart +++ b/lib/home_page.dart @@ -37,6 +37,7 @@ List isLoading = []; bool isModAddFolderOnly = true; bool isViewingFav = false; bool isSearching = false; +bool isRefreshing = false; bool previewZoomState = true; int totalAppliedItems = 0; int totalAppliedFiles = 0; @@ -213,7 +214,7 @@ class _HomePageState extends State with TickerProviderStateMixin { flexibleSpace: Container( height: 30, width: double.maxFinite, - padding: EdgeInsets.only(left: searchBoxLeftPadding, right: 100, bottom: 3), + padding: EdgeInsets.only(left: searchBoxLeftPadding, right: 135, bottom: 3), child: Focus( onFocusChange: (hasFocus) { setState(() { @@ -275,56 +276,88 @@ class _HomePageState extends State with TickerProviderStateMixin { ), )), actions: [ - Padding( - padding: const EdgeInsets.only(right: 2.5), - child: Tooltip( - message: 'New Category', - height: 25, - textStyle: TextStyle(fontSize: 15, color: Theme.of(context).canvasColor), - waitDuration: const Duration(seconds: 1), - child: SizedBox( - width: 40, - height: 30, - child: MaterialButton( - onPressed: addCategoryVisible - ? null - : (() { - setState(() { - switch (cateAdderAniController.status) { - case AnimationStatus.dismissed: - Provider.of(context, listen: false).addingBoxStateTrue(); - addCategoryVisible = true; - cateAdderAniController.forward(); - break; - default: - } - }); - }), - child: Stack( - children: [ - Icon( - Icons.category_outlined, + Tooltip( + message: 'Refresh List', + height: 25, + textStyle: TextStyle(fontSize: 15, color: Theme.of(context).canvasColor), + waitDuration: const Duration(seconds: 1), + child: SizedBox( + width: 40, + height: 30, + child: MaterialButton( + onPressed: addItemVisible || isRefreshing + ? null + : (() { + if (!isRefreshing) { + isModSelected = false; + modsViewAppBarName = 'Available Mods'; + isRefreshing = true; + //cateList.clear(); + setState(() {}); + } + refreshList(); + }), + child: Row( + children: [ + Icon( + Icons.refresh, + color: addItemVisible || isRefreshing + ? Theme.of(context).disabledColor + : MyApp.themeNotifier.value == ThemeMode.light + ? Theme.of(context).primaryColorDark + : Theme.of(context).iconTheme.color, + ) + ], + )), + )), + Tooltip( + message: 'New Category', + height: 25, + textStyle: TextStyle(fontSize: 15, color: Theme.of(context).canvasColor), + waitDuration: const Duration(seconds: 1), + child: SizedBox( + width: 40, + height: 30, + child: MaterialButton( + onPressed: addCategoryVisible + ? null + : (() { + setState(() { + switch (cateAdderAniController.status) { + case AnimationStatus.dismissed: + Provider.of(context, listen: false).addingBoxStateTrue(); + addCategoryVisible = true; + cateAdderAniController.forward(); + break; + default: + } + }); + }), + child: Stack( + children: [ + Icon( + Icons.category_outlined, + color: addCategoryVisible + ? Theme.of(context).disabledColor + : MyApp.themeNotifier.value == ThemeMode.light + ? Theme.of(context).primaryColorDark + : Theme.of(context).iconTheme.color, + ), + Positioned( + left: 11.5, + bottom: 10, + child: Icon( + Icons.add, + size: 16, color: addCategoryVisible ? Theme.of(context).disabledColor : MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Theme.of(context).iconTheme.color, - ), - Positioned( - left: 11.5, - bottom: 10, - child: Icon( - Icons.add, - size: 16, - color: addCategoryVisible - ? Theme.of(context).disabledColor - : MyApp.themeNotifier.value == ThemeMode.light - ? Theme.of(context).primaryColorDark - : Theme.of(context).iconTheme.color, - )), - ], - )), - ))), + )), + ], + )), + )), Padding( padding: const EdgeInsets.only(right: 10), child: Tooltip( @@ -367,7 +400,15 @@ class _HomePageState extends State with TickerProviderStateMixin { ), //Category List - if (!isSearching) + if (isRefreshing) + const Padding( + padding: EdgeInsets.only(top: 10), + child: Text( + 'Refreshing List', + style: TextStyle(fontWeight: FontWeight.w500), + ), + ), + if (!isSearching && !isRefreshing) Expanded( child: SingleChildScrollView( controller: AdjustableScrollController(80), @@ -673,7 +714,12 @@ class _HomePageState extends State with TickerProviderStateMixin { trailing: Wrap( children: [ if (cateList[index].allModFiles.indexWhere((element) => element.modName == cateList[index].itemNames[i] && element.isNew == true) != -1) - SizedBox(height: 50, child: Icon(Icons.new_releases, color: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber,)), + SizedBox( + height: 50, + child: Icon( + Icons.new_releases, + color: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber, + )), //Buttons Tooltip( @@ -944,7 +990,12 @@ class _HomePageState extends State with TickerProviderStateMixin { trailing: Wrap( children: [ if (cateListSearchResult[index].allModFiles.indexWhere((element) => element.modName == cateListSearchResult[index].itemNames[i] && element.isNew == true) != -1) - SizedBox(height: 50, child: Icon(Icons.new_releases, color: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber,)), + SizedBox( + height: 50, + child: Icon( + Icons.new_releases, + color: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber, + )), //Buttons Tooltip( @@ -1056,7 +1107,12 @@ class _HomePageState extends State with TickerProviderStateMixin { trailing: Wrap( children: [ if (cateListSearchResult[index].allModFiles.indexWhere((element) => element.modName == cateListSearchResult[index].itemNames[i] && element.isNew == true) != -1) - SizedBox(height: 50, child: Icon(Icons.new_releases, color: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber,)), + SizedBox( + height: 50, + child: Icon( + Icons.new_releases, + color: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber, + )), //Buttons Tooltip( @@ -1971,7 +2027,13 @@ class _HomePageState extends State with TickerProviderStateMixin { margin: const EdgeInsets.only(left: 3, right: 3, top: 2, bottom: 2), shape: RoundedRectangleBorder( borderRadius: const BorderRadius.all(Radius.circular(5.0)), - side: BorderSide(width: 1, color: modFilesList[index].indexWhere((e) => e.isNew == true) != -1 ? MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColorDark : Colors.amber : Theme.of(context).primaryColor)), + side: BorderSide( + width: 1, + color: modFilesList[index].indexWhere((e) => e.isNew == true) != -1 + ? MyApp.themeNotifier.value == ThemeMode.light + ? Theme.of(context).primaryColorDark + : Colors.amber + : Theme.of(context).primaryColor)), child: ExpansionTile( initiallyExpanded: modViewExpandAll, textColor: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColor : Theme.of(context).iconTheme.color, @@ -3023,4 +3085,20 @@ class _HomePageState extends State with TickerProviderStateMixin { ], ); } + + //Helpers functions + + void refreshList() { + Future.delayed(const Duration(milliseconds: 500), () async { + allModFiles = await modsLoader(); + cateList = categories(allModFiles); + appliedModsListGet = getAppliedModsList(); + iceFiles = dataDir.listSync(recursive: true).whereType().toList(); + Provider.of(context, listen: false).cateListItemCountSetNoListener(cateList.length); + isRefreshing = false; + }).whenComplete(() { + isRefreshing = false; + setState(() {}); + }); + } } diff --git a/windows/runner/Runner.rc b/windows/runner/Runner.rc index 831bacb5..07317538 100644 --- a/windows/runner/Runner.rc +++ b/windows/runner/Runner.rc @@ -63,13 +63,13 @@ IDI_APP_ICON ICON "resources\\app_icon.ico" #ifdef FLUTTER_BUILD_NUMBER #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER #else -#define VERSION_AS_NUMBER 1,4,0 +#define VERSION_AS_NUMBER 1,4,1 #endif #ifdef FLUTTER_BUILD_NAME #define VERSION_AS_STRING #FLUTTER_BUILD_NAME #else -#define VERSION_AS_STRING "1.4.0" +#define VERSION_AS_STRING "1.4.1" #endif VS_VERSION_INFO VERSIONINFO