Skip to content

Commit

Permalink
Merge pull request #15 from KizKizz/backend-rework
Browse files Browse the repository at this point in the history
File structures change, bug fixes
  • Loading branch information
KizKizz authored Jul 5, 2022
2 parents f710afc + f41cdfa commit 4d498dd
Show file tree
Hide file tree
Showing 6 changed files with 146 additions and 80 deletions.
162 changes: 109 additions & 53 deletions lib/file_functions.dart

Large diffs are not rendered by default.

46 changes: 25 additions & 21 deletions lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,24 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
void initState() {
super.initState();
_itemAdderTabcontroller = TabController(length: 2, vsync: this);
_itemAdderTabcontroller.addListener(() {
setState(() {
if (_itemAdderTabcontroller.index == 0) {
_newItemDragDropList.clear();
newItemAddController.clear();
selectedCategoryForMutipleItems = null;
//isErrorInSingleItemName = false;
context.read<stateProvider>().itemsDropAddClear();
} else {
_newSingleItemDragDropList.clear();
_singleItemIcon = null;
newSingleItemAddController.clear();
selectedCategoryForSingleItem = null;
isErrorInSingleItemName = false;
context.read<stateProvider>().singleItemDropAddClear();
}
});
});
cateAdderAniController = AnimationController(duration: const Duration(milliseconds: 200), vsync: this);
cateAdderAniOffset = Tween<Offset>(begin: const Offset(0.0, 1.1), end: const Offset(0.0, 0.0)).animate(cateAdderAniController);
itemAdderAniController = AnimationController(duration: const Duration(milliseconds: 200), vsync: this);
Expand Down Expand Up @@ -1251,21 +1269,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
TabBar(
labelColor: MyApp.themeNotifier.value == ThemeMode.light ? Theme.of(context).primaryColor : Theme.of(context).iconTheme.color,
controller: _itemAdderTabcontroller,
onTap: (index) {
if (index == 0) {
_newItemDragDropList.clear();
newItemAddController.clear();
selectedCategoryForMutipleItems = null;
//isErrorInSingleItemName = false;
context.read<stateProvider>().itemsDropAddClear();
} else {
_newSingleItemDragDropList.clear();
newSingleItemAddController.clear();
selectedCategoryForMutipleItems = null;
isErrorInSingleItemName = false;
context.read<stateProvider>().singleItemDropAddClear();
}
},
onTap: (index) {},
tabs: const [
Tab(
height: 25,
Expand Down Expand Up @@ -1443,7 +1447,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
child: Padding(
padding: const EdgeInsets.only(top: 10, bottom: 0, left: 0, right: 10),
child: SizedBox(
height: 37.5,
height: isErrorInSingleItemName ? 62.5 : 37.5,
child: TextFormField(
controller: newSingleItemAddController,
//maxLengthEnforcement: MaxLengthEnforcement.enforced,
Expand All @@ -1461,21 +1465,21 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
}
if (selectedCategoryForSingleItem == 'Basewears' ||
selectedCategoryForSingleItem == 'Setwears' ||
selectedCategoryForSingleItem == 'Outerewears' ||
selectedCategoryForSingleItem == 'Outerwears' ||
selectedCategoryForSingleItem == 'Innerwears') {
if (cateList.indexWhere((e) =>
e.categoryName == selectedCategoryForSingleItem &&
e.itemNames.indexWhere((element) => element.toLowerCase().contains(value.toLowerCase())) != -1) !=
e.itemNames.indexWhere((element) => element.toLowerCase().substring(0, element.length - 4).trim() == value.toLowerCase()) != -1) !=
-1) {
isErrorInSingleItemName = true;
return 'The name already exist';
return 'The name already exists';
}
} else {
if (cateList.indexWhere((e) =>
e.categoryName == selectedCategoryForSingleItem && e.itemNames.indexWhere((element) => element.toLowerCase() == value.toLowerCase()) != -1) !=
-1) {
isErrorInSingleItemName = true;
return 'The name already exist';
return 'The name already exists';
}
}
return null;
Expand Down Expand Up @@ -2341,7 +2345,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
return 'Mod name can\'t be empty';
}
if (modFilesList.indexWhere((e) => e.indexWhere((element) => element.iceParent.split(' > ').last == value) != -1) != -1) {
return 'Mod name already exist';
return 'Mod name already exists';
}
return null;
},
Expand Down
2 changes: 1 addition & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ignore_for_file: unnecessary_new
// ignore_for_file: unnecessary_new, unused_import

import 'dart:async';
import 'dart:io';
Expand Down
7 changes: 5 additions & 2 deletions lib/mods_loader.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ Future<List<ModFile>> modsLoader() async {
modPath = iceFile.path.split(modName).first + modName;
}
}
iceParents = iceFile.path.split(modName).last.split('\\${iceFilePathSplit.last}').first.replaceAll('\\', ' > ').trim();
//iceParents = iceFile.path.split(modName).last.split('\\${iceFilePathSplit.last}').first.replaceAll('\\', ' > ').trim();
List<String> pathSplit = iceFile.path.split('\\');
final iceName = pathSplit.removeLast();
pathSplit.removeRange(0, pathSplit.indexWhere((element) => element == modName) + 1);
iceParents = pathSplit.join(' > ').trim();
if (iceParents == '') {
iceParents = '> $modName';
}
Expand All @@ -70,7 +74,6 @@ Future<List<ModFile>> modsLoader() async {
imgFiles.add(imgFile);
}
}


//Vids helper
for (var vidFile in Directory(iceFile.parent.path).listSync(recursive: false).whereType<File>()) {
Expand Down
5 changes: 4 additions & 1 deletion linux/my_application.cc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <bitsdojo_window_linux/bitsdojo_window_plugin.h>
#include "my_application.h"

#include <flutter_linux/flutter_linux.h>
Expand Down Expand Up @@ -47,7 +48,9 @@ static void my_application_activate(GApplication* application) {
gtk_window_set_title(window, "pso2_mod_manager");
}

gtk_window_set_default_size(window, 1280, 720);
auto bdw = bitsdojo_window_from(window); // <--- add this line
bdw->setCustomFrame(true); // <-- add this line
//gtk_window_set_default_size(window, 1280, 720);
gtk_widget_show(GTK_WIDGET(window));

g_autoptr(FlDartProject) project = fl_dart_project_new();
Expand Down
4 changes: 2 additions & 2 deletions windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -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,2,2
#define VERSION_AS_NUMBER 1,2,3
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#else
#define VERSION_AS_STRING "1.2.2"
#define VERSION_AS_STRING "1.2.3"
#endif

VS_VERSION_INFO VERSIONINFO
Expand Down

0 comments on commit 4d498dd

Please sign in to comment.