diff --git a/.idea/Daflv4.iml b/.idea/Daflv4.iml
index 6fa24ac..6b7ffa5 100644
--- a/.idea/Daflv4.iml
+++ b/.idea/Daflv4.iml
@@ -53,6 +53,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
index 0568fe9..b25f471 100644
--- a/.idea/libraries/Dart_Packages.xml
+++ b/.idea/libraries/Dart_Packages.xml
@@ -5,662 +5,686 @@
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Sources/dafl_project_flutter/assets/images/delete_background.png b/Sources/dafl_project_flutter/assets/images/delete_background.png
index 0034184..b1d5e4f 100644
Binary files a/Sources/dafl_project_flutter/assets/images/delete_background.png and b/Sources/dafl_project_flutter/assets/images/delete_background.png differ
diff --git a/Sources/dafl_project_flutter/assets/images/play_background.png b/Sources/dafl_project_flutter/assets/images/play_background.png
new file mode 100644
index 0000000..27c07aa
Binary files /dev/null and b/Sources/dafl_project_flutter/assets/images/play_background.png differ
diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart
index 1581d10..b3c903b 100644
--- a/Sources/dafl_project_flutter/lib/main.dart
+++ b/Sources/dafl_project_flutter/lib/main.dart
@@ -1,4 +1,5 @@
import 'dart:async';
+import 'dart:ui';
import 'package:fluttertoast/fluttertoast.dart';
import 'dart:math';
import './views/pages/home/p_home.dart';
@@ -12,6 +13,7 @@ import 'model/spot.dart';
import 'model/user.dart';
import 'api/api.dart';
import 'dart:developer' as dev;
+import 'package:flutter_styled_toast/flutter_styled_toast.dart';
void main() {
runApp(const MyApp());
@@ -86,7 +88,7 @@ class CardProvider extends ChangeNotifier {
dislike();
break;
case CardStatus.discovery:
- discovery();
+ discovery(context);
break;
case CardStatus.message:
message(context);
@@ -153,33 +155,76 @@ class CardProvider extends ChangeNotifier {
notifyListeners();
}
- void discovery() {
+ void discovery(BuildContext context) {
dev.log("discovery");
_angle = 0;
_position -= Offset(0, -_screenSize.height);
_discoveryCard();
dev.log("discovery");
- if (MyApp.controller.currentUser.discovery
+ showToastWidget(
+ ClipRRect(
+ borderRadius: BorderRadius.circular(25),
+ child: new BackdropFilter(
+ filter: new ImageFilter.blur(sigmaX: 30.0, sigmaY: 30.0),
+ child: new Container(
+ width: 300.0,
+ height: 70.0,
+ decoration: new BoxDecoration(
+ color: Colors.grey.shade900.withOpacity(0.7),
+ ),
+ child: new Center(
+ child: Row(
+ mainAxisAlignment: MainAxisAlignment.center,
+ children: [
+ MyApp.controller.currentUser.discovery
+ .contains(MyApp.controller.currentUser.spots.last.music)
+ ? Icon(
+ Icons.info_rounded,
+ size: 40,
+ color: Colors.grey,
+ )
+ : Icon(
+ Icons.check_rounded,
+ size: 40,
+ color: Colors.grey,
+ ),
+ SizedBox(
+ width: 10,
+ ),
+ MyApp.controller.currentUser.discovery
+ .contains(MyApp.controller.currentUser.spots.last.music)
+ ? Text(
+ "Déja dans vos discovery",
+ style: TextStyle(
+ color: Colors.grey,
+ fontWeight: FontWeight.bold,
+ fontSize: 17),
+ )
+ : Text(
+ "Ajouté à discovery",
+ style: TextStyle(
+ color: Colors.grey,
+ fontWeight: FontWeight.bold,
+ fontSize: 17),
+ ),
+ ],
+ )),
+ ),
+ ),
+ ),
+ context: context,
+ animation: StyledToastAnimation.fade,
+ reverseAnimation: StyledToastAnimation.fade,
+ position: StyledToastPosition.top,
+ animDuration: Duration(milliseconds: 400),
+ duration: Duration(milliseconds: 1500),
+ curve: Curves.linear,
+ reverseCurve: Curves.linear,
+ );
+ if (!MyApp.controller.currentUser.discovery
.contains(MyApp.controller.currentUser.spots.last.music)) {
- MyApp.controller.currentUser.discovery
- .remove(MyApp.controller.currentUser.spots.last.music);
- Fluttertoast.showToast(
- msg: 'Supprimer',
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.TOP,
- timeInSecForIosWeb: 2,
- backgroundColor: Colors.red,
- textColor: Colors.white);
- } else {
MyApp.controller.currentUser
.addDiscovery(MyApp.controller.currentUser.spots.last.music);
- Fluttertoast.showToast(
- msg: 'Ajouté',
- toastLength: Toast.LENGTH_SHORT,
- gravity: ToastGravity.TOP,
- timeInSecForIosWeb: 2,
- backgroundColor: Colors.deepPurple,
- textColor: Colors.white);
notifyListeners();
}
}
diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart
index 5ec6158..11f6032 100644
--- a/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart
+++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_discovery.dart
@@ -103,17 +103,28 @@ class _DiscoveryListState extends State {
return Dismissible(
key: Key(MyApp
.controller.currentUser.discovery[reversedIndex].name),
- direction: DismissDirection.startToEnd,
- onDismissed: (direction) {
- if (direction == DismissDirection.startToEnd) {
+ confirmDismiss: (direction) async {
+ if (direction == DismissDirection.endToStart) {
MyApp.controller.currentUser.discovery
.removeAt(reversedIndex);
+ setState(() {
+ itemCount -= 1;
+ });
+ return true;
+ }
+ },
+ onDismissed: (direction) {
+ if (direction == DismissDirection.startToEnd) {
+ print('play');
}
- setState(() {
- itemCount -= 1;
- });
},
background: Container(
+ decoration: const BoxDecoration(
+ image: DecorationImage(
+ image: AssetImage(
+ "assets/images/play_background.png"),
+ fit: BoxFit.cover))),
+ secondaryBackground: Container(
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart
index f4035db..71305b4 100644
--- a/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart
+++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_spot.dart
@@ -98,7 +98,7 @@ class _SpotsWidgetState extends State {
final provider = Provider.of(
context,
listen: false);
- provider.discovery();
+ provider.discovery(context);
},
child: Image.asset(
'assets/images/bouton_discovery.png',
diff --git a/Sources/dafl_project_flutter/pubspec.lock b/Sources/dafl_project_flutter/pubspec.lock
index ea31ae6..0662299 100644
--- a/Sources/dafl_project_flutter/pubspec.lock
+++ b/Sources/dafl_project_flutter/pubspec.lock
@@ -153,6 +153,11 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.1"
+ flutter_localizations:
+ dependency: transitive
+ description: flutter
+ source: sdk
+ version: "0.0.0"
flutter_native_splash:
dependency: "direct dev"
description:
@@ -160,6 +165,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.11"
+ flutter_styled_toast:
+ dependency: "direct main"
+ description:
+ name: flutter_styled_toast
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "2.1.3"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -275,6 +287,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.2.2"
+ intl:
+ dependency: transitive
+ description:
+ name: intl
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.17.0"
js:
dependency: transitive
description:
diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml
index b309a65..04de6ea 100644
--- a/Sources/dafl_project_flutter/pubspec.yaml
+++ b/Sources/dafl_project_flutter/pubspec.yaml
@@ -28,6 +28,7 @@ dependencies:
font_awesome_flutter: ^10.2.1
home_indicator: ^2.0.2
geolocator: ^9.0.2
+ flutter_styled_toast: ^2.1.3
dev_dependencies:
flutter_test: