This repository has been archived by the owner on Sep 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- `drag_and_drop_windows` → `desktop_drop`
- Loading branch information
1 parent
0492ed0
commit d333ee3
Showing
23 changed files
with
208 additions
and
212 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,68 @@ | ||
import 'package:cross_file/cross_file.dart'; | ||
import 'package:desktop_drop/desktop_drop.dart'; | ||
import 'package:dotted_border/dotted_border.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
Widget dragAndDropSquare( | ||
VoidCallback onClick, | ||
ColorScheme colorScheme, | ||
String aboveText, | ||
String belowText, | ||
IconData icon, | ||
) { | ||
return GestureDetector( | ||
onTap: onClick, | ||
child: DottedBorder( | ||
color: colorScheme.tertiary, | ||
dashPattern: const [15, 6], | ||
strokeWidth: 3, | ||
child: MouseRegion( | ||
cursor: SystemMouseCursors.click, | ||
child: Container( | ||
height: 350, | ||
width: 350, | ||
color: colorScheme.tertiaryContainer, | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Text( | ||
aboveText, | ||
style: | ||
const TextStyle(fontWeight: FontWeight.w500, fontSize: 18), | ||
textAlign: TextAlign.center, | ||
), | ||
Icon(icon, size: 100), | ||
Text( | ||
belowText, | ||
style: | ||
const TextStyle(fontWeight: FontWeight.w500, fontSize: 18), | ||
class DragAndDropSquare extends ConsumerWidget { | ||
const DragAndDropSquare({ | ||
required this.onClick, | ||
required this.onDragDone, | ||
required this.colorScheme, | ||
required this.aboveText, | ||
required this.belowText, | ||
required this.icon, | ||
super.key, | ||
}); | ||
|
||
final VoidCallback onClick; | ||
final void Function(List<XFile> files) onDragDone; | ||
final ColorScheme colorScheme; | ||
final String aboveText; | ||
final String belowText; | ||
final IconData icon; | ||
|
||
@override | ||
Widget build(BuildContext context, WidgetRef ref) { | ||
return GestureDetector( | ||
onTap: onClick, | ||
child: DropTarget( | ||
onDragDone: (details) => onDragDone(details.files), | ||
child: DottedBorder( | ||
color: colorScheme.tertiary, | ||
dashPattern: const [15, 6], | ||
strokeWidth: 3, | ||
child: MouseRegion( | ||
cursor: SystemMouseCursors.click, | ||
child: Container( | ||
height: 350, | ||
width: 350, | ||
color: colorScheme.tertiaryContainer, | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
Text( | ||
aboveText, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.w500, | ||
fontSize: 18, | ||
), | ||
textAlign: TextAlign.center, | ||
), | ||
Icon(icon, size: 100), | ||
Text( | ||
belowText, | ||
style: const TextStyle( | ||
fontWeight: FontWeight.w500, | ||
fontSize: 18, | ||
), | ||
), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.