Skip to content

Commit

Permalink
Merge pull request #27 from moesaid/stage
Browse files Browse the repository at this point in the history
0.0.5
  • Loading branch information
moesaid authored Feb 28, 2024
2 parents 2d05337 + ff77062 commit 895e61b
Show file tree
Hide file tree
Showing 9 changed files with 67 additions and 30 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/windows_ci_cd.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
on:
push:
branches: [main]
workflow_dispatch
# push:
# branches: [main]

name: Windows

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class SetupLocalFlutterPathController extends GetxController {
},
{
'mac': 'echo \$PATH | tr \':\' \'\\n\'',
'windows': 'for %A in ("%PATH:;=" "%") do @echo %~A',
'windows': '\$Env:flutter',
},
];

Expand Down
2 changes: 2 additions & 0 deletions lib/App/Providers/Cmd/cmd_env_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ class CmdEnvProvider {
resItems.add({'head': true, 'body': item});
} else if (item.contains('✗')) {
resItems.add({'head': false, 'body': item});
} else if (item.contains('!')) {
resItems.add({'head': null, 'body': item});
}
}

Expand Down
10 changes: 8 additions & 2 deletions lib/App/Providers/Cmd/cmd_read_create_dir_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'dart:async';
import 'dart:io';

import 'package:flutterpp/Config/app_print.dart';
import 'package:get/get.dart';
import 'package:process_run/process_run.dart';

class CmdReadCreateDirProvider {
Expand All @@ -11,7 +12,9 @@ class CmdReadCreateDirProvider {
String? option,
}) async {
try {
var result = await runExecutableArguments('ls', [option ?? '', path]);
String command = GetPlatform.isWindows ? 'dir' : 'ls';

var result = await runExecutableArguments(command, [option ?? '', path]);

List<String> res = [];
for (var item in result.outLines) {
Expand All @@ -28,14 +31,17 @@ class CmdReadCreateDirProvider {

Future<void> createDirectory(String path) async {
try {
await runExecutableArguments('mkdir', ['-p', path]);
ProcessResult res = await runExecutableArguments('mkdir', ['-p', path]);
AppPrint.print('mkdir: ${res.stdout}');
} catch (e) {
AppPrint.print('Error creating directory: $e');
}
}

// create file
Future<void> createFile(String path) async {
String command = GetPlatform.isWindows ? 'type nul' : 'touch';

try {
await runExecutableArguments('touch', [path]);
} catch (e) {
Expand Down
10 changes: 9 additions & 1 deletion lib/App/Providers/Device/file_maneger_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'dart:typed_data';
import 'package:file_selector/file_selector.dart';
import 'package:flutterpp/App/Services/Global/call_pipeline.dart';
import 'package:flutterpp/Config/app_print.dart';
import 'package:get/get_utils/src/platform/platform.dart';

class FileManegerProvider {
CallPipeline callPipeline = CallPipeline();
Expand Down Expand Up @@ -258,6 +259,10 @@ class FileManegerProvider {

// open folder
Future<void> openFolder({required String location}) async {
String command = GetPlatform.isWindows ? 'start' : 'open';

AppPrint.print({'❌command': command, '❌location': location});

await callPipeline.futurePipeline(
future: () async {
// check if folder exist
Expand All @@ -267,7 +272,10 @@ class FileManegerProvider {
}

// open folder
await Process.run('open', [location]);

ProcessResult res = await Process.run(command, [location]);

AppPrint.print(res.stdout);
},
name: 'open folder',
);
Expand Down
15 changes: 10 additions & 5 deletions lib/App/Providers/FilesGen/vs_code_provider.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:flutterpp/App/Services/Cmd/cmd_read_create_dir_services.dart';
import 'package:flutterpp/Config/app_print.dart';

class VsCodeProvider {
final CmdReadCreateDirServices _cmdRCD = CmdReadCreateDirServices();
Expand All @@ -10,11 +11,6 @@ class VsCodeProvider {
// create .vscode directory
await _cmdRCD.createDirectory('$path/.vscode');

// remove settings.json file if exists
if (File('$path/.vscode/settings.json').existsSync()) {
File('$path/.vscode/settings.json').deleteSync();
}

// content
String content = '''{
"editor.codeActionsOnSave": {
Expand All @@ -24,6 +20,15 @@ class VsCodeProvider {
"editor.formatOnSave": true
}''';

// remove settings.json file if exists
try {
if (await File('$path/.vscode/settings.json').exists()) {
File('$path/.vscode/settings.json').deleteSync();
}
} catch (e) {
AppPrint.printError('Error deleting file: $e');
}

// create file
File file = File('$path/.vscode/settings.json');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,32 @@ class BuildEnvCheckDataState extends StatelessWidget {
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: Get.textTheme.titleSmall!.copyWith(
fontSize: 5.sp,
fontSize: 4.9.sp,
color:
controller.checkEnvModel.flutterDoctor![index].head!
? Colors.green.withOpacity(0.8)
: Colors.red,
controller.checkEnvModel.flutterDoctor![index].head ==
null
? Colors.yellow.withOpacity(0.8)
: controller.checkEnvModel.flutterDoctor![index]
.head ==
true
? Colors.green.withOpacity(0.8)
: Colors.red,
),
),
trailing: Icon(
size: 7.sp,
controller.checkEnvModel.flutterDoctor![index].head!
? Icons.check_circle
: Icons.cancel,
color: controller.checkEnvModel.flutterDoctor![index].head!
? Colors.green
: Colors.red,
controller.checkEnvModel.flutterDoctor![index].head == null
? Icons.warning_amber_rounded
: controller.checkEnvModel.flutterDoctor![index].head!
? Icons.check_circle
: Icons.cancel,
color: controller
.checkEnvModel.flutterDoctor![index].head ==
null
? Colors.yellow
: controller.checkEnvModel.flutterDoctor![index].head!
? Colors.green
: Colors.red,
),
);
},
Expand Down
20 changes: 12 additions & 8 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,18 @@ Future<void> main() async {
await AppInitializer.initialize();

// runApp
await AppInitializer.initSentry(() async {
runApp(DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: const DragToMoveArea(
child: MyApp(),
),
));
});
await AppInitializer.initSentry(
() async {
runApp(
DefaultAssetBundle(
bundle: SentryAssetBundle(),
child: GetPlatform.isWindows
? const DragToMoveArea(child: MyApp())
: const MyApp(),
),
);
},
);
}

class MyApp extends StatelessWidget {
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutterpp
description: A new Flutter project.
publish_to: "none"
version: 0.0.4
version: 0.0.5
environment:
sdk: ">=2.18.6 <3.0.0"

Expand Down

0 comments on commit 895e61b

Please sign in to comment.