Skip to content

Commit

Permalink
🐛 Review
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Oct 29, 2023
1 parent 53fc064 commit 72dd985
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 388 deletions.
2 changes: 1 addition & 1 deletion lib/ui/views/main_screen/layouts/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AppBarMainScreen extends StatelessWidget implements PreferredSizeWidget {
backgroundColor: Colors.transparent,
elevation: 0,
leading: const Header(),
leadingWidth: Responsive.isMobile(context) ? null : 150,
leadingWidth: Responsive.isMobile(context) ? null : 155,
title: Text(
AppLocalizations.of(context)!.websitesListTitle,
),
Expand Down
320 changes: 0 additions & 320 deletions lib/ui/views/util/choose_path_sync_popup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -267,325 +267,5 @@ class PathSyncPopup with FileMixin {
);
},
);

return showDialog(
context: context,
builder: (context) {
return ScaffoldMessenger(
child: Builder(
builder: (context) {
return Scaffold(
backgroundColor: Colors.transparent,
body: StatefulBuilder(
builder: (context, setState) {
return AlertDialog(
contentPadding: const EdgeInsets.only(
top: 10,
),
content: Container(
color: Colors.transparent,
padding:
const EdgeInsets.only(left: 20, right: 20, top: 10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Row(
children: [
SelectionArea(
child: Text(
AppLocalizations.of(context)!
.pathSyncPopupTitle,
style:
Theme.of(context).textTheme.titleSmall,
),
),
const SizedBox(width: 15),
Expanded(
child: Container(
width: 25,
height: 1,
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [
Color(0x003C89B9),
Color(0xFFCC00FF),
],
stops: [0, 1],
begin: AlignmentDirectional.centerEnd,
end: AlignmentDirectional.centerStart,
),
),
),
),
],
),
const SizedBox(
width: 500,
height: 20,
),
if (kIsWeb)
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
AppLocalizations.of(context)!
.pathSyncPopupSelectArchiveFile,
),
const SizedBox(width: 2),
TextButton(
onPressed: () async {
try {
final result = await FilePicker
.platform
.pickFiles(
type: FileType.custom,
allowedExtensions: [
'zip',
'7z',
'rar',
],
);
if (result != null) {
zipFile =
result.files.first.bytes;
setState(
() {
path =
result.files.first.name;
},
);
}
} on Exception catch (e) {
log('Error while picking folder: $e');
}
},
child: const Icon(Icons.folder),
),
],
),
Text(
path ?? '',
),
],
)
else
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
AppLocalizations.of(context)!
.pathSyncPopupSelectFolder,
),
const SizedBox(width: 2),
TextButton(
onPressed: () async {
try {
final result = await FilePicker
.platform
.getDirectoryPath();
if (result != null) {
setState(
() {
path = '$result/';
},
);
}
} on Exception catch (e) {
log('Error while picking folder: $e');
}
},
child: const Icon(Icons.folder),
),
],
),
Text(
path ?? '',
),
const SizedBox(
height: 10,
),
const WarningSizeLabel(),
const SizedBox(
height: 10,
),
],
),
const SizedBox(
height: 20,
),
Row(
children: [
Text(
AppLocalizations.of(context)!
.pathSyncPopupGitignoreLabel,
),
const SizedBox(width: 2),
SizedBox(
height: 30,
child: FittedBox(
fit: BoxFit.fill,
child: Switch(
thumbIcon: thumbIcon,
value: applyGitIgnoreRules ?? false,
onChanged: (value) {
setState(
() {
applyGitIgnoreRules = value;
},
);
},
),
),
),
IconButtonAnimated(
icon: Icon(
Icons.help,
color:
Theme.of(context).colorScheme.primary,
),
onPressed: () {
launchUrl(
Uri.parse(
'https://wiki.archethic.net/FAQ/aeweb#what-is-the-purpose-of-a-gitignore-file',
),
);
},
color: Theme.of(context)
.colorScheme
.primaryContainer,
),
],
),
const SizedBox(
height: 20,
),
Container(
width: double.infinity,
padding: const EdgeInsets.only(
bottom: 20,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
AppButton(
labelBtn:
AppLocalizations.of(context)!.btn_close,
icon: Iconsax.close_square,
onPressed: () async {
Navigator.of(context).pop();
},
),
AppButton(
labelBtn:
AppLocalizations.of(context)!.btn_sync,
icon: Iconsax.refresh_circle,
onPressed: () async {
late final Map<String,
HostingRefContentMetaData>?
localFiles;
if (kIsWeb) {
if (zipFile == null) {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
backgroundColor: Theme.of(context)
.snackBarTheme
.backgroundColor,
content: Text(
AppLocalizations.of(context)!
.pathSyncPopupArchiveFileMissing,
style: Theme.of(context)
.snackBarTheme
.contentTextStyle,
),
duration:
const Duration(seconds: 3),
),
);
return;
}
localFiles =
await FileMixin.listFilesFromZip(
zipFile!,
applyGitIgnoreRules:
applyGitIgnoreRules ?? false,
);
} else {
if (path == null || path!.isEmpty) {
ScaffoldMessenger.of(context)
.showSnackBar(
SnackBar(
backgroundColor: Theme.of(context)
.snackBarTheme
.backgroundColor,
content: Text(
AppLocalizations.of(context)!
.pathSyncPopupPathMissing,
style: Theme.of(context)
.snackBarTheme
.contentTextStyle,
),
duration:
const Duration(seconds: 3),
),
);
return;
}

localFiles =
await FileMixin.listFilesFromPath(
path!,
applyGitIgnoreRules:
applyGitIgnoreRules ?? false,
);
}

final remoteFiles =
(await ReadWebsiteVersionUseCases()
.getRemote(
transactionRefAddress,
))!
.content!
.metaData;

context.go(
RoutesPath()
.updateWebsiteSync(genesisAddress),
extra: {
'websiteName': websiteName,
'genesisAddress': genesisAddress,
'path': path ?? '',
'zipFile':
zipFile ?? Uint8List.fromList([]),
'localFiles': localFiles,
'comparedFiles': SyncWebsiteUseCases()
.compareFileLists(
localFiles!,
remoteFiles,
),
},
);
},
),
],
),
),
],
),
),
);
},
),
);
},
),
);
},
);
}
}
Loading

0 comments on commit 72dd985

Please sign in to comment.