diff --git a/Sources/dafl_project_flutter/assets/images/bouton_messages.png b/Sources/dafl_project_flutter/assets/images/bouton_messages.png new file mode 100644 index 0000000..26d6806 Binary files /dev/null and b/Sources/dafl_project_flutter/assets/images/bouton_messages.png differ diff --git a/Sources/dafl_project_flutter/assets/images/icon_messages.png b/Sources/dafl_project_flutter/assets/images/icon_messages.png new file mode 100644 index 0000000..0ae98bb Binary files /dev/null and b/Sources/dafl_project_flutter/assets/images/icon_messages.png differ diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index d04dbe5..f1f0439 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -31,7 +31,7 @@ class MyApp extends StatelessWidget { } } -enum CardStatus { like, disLike, discovery} +enum CardStatus { like, disLike, discovery, message} class CardProvider extends ChangeNotifier{ List _urlImages = []; @@ -98,6 +98,9 @@ class CardProvider extends ChangeNotifier{ case CardStatus.discovery: discovery(); break; + case CardStatus.message: + message(context); + break; default: resetPosition(); } @@ -121,7 +124,8 @@ class CardProvider extends ChangeNotifier{ CardStatus? getStatus({bool force = false}) { final x = _position.dx; final y = _position.dy; - final forceDiscovery = x.abs() < 20; + final forceDiscovery = x.abs() < 80; + final forceMessage = x.abs() < 100; if(force) { final delta = 100; @@ -130,15 +134,19 @@ class CardProvider extends ChangeNotifier{ return CardStatus.like; } else if ( x <= -delta){ return CardStatus.disLike; - } else if ( y <= -delta / 2 && forceDiscovery){ + } else if ( y <= -delta/2 && forceDiscovery){ + return CardStatus.message; + } else if (y >= delta * 2 && x.abs() < 100) { return CardStatus.discovery; } } else{ final delta = 20; if(y <= -delta * 2 && forceDiscovery) { + return CardStatus.message; + } else if (y >= delta *2 && x.abs() < 80) { return CardStatus.discovery; - } else if ( x >= delta) { + }else if ( x >= delta) { return CardStatus.like; } else if ( x <= -delta) { return CardStatus.disLike; @@ -157,7 +165,7 @@ class CardProvider extends ChangeNotifier{ void discovery() { print("discovery"); _angle = 0; - _position -= Offset(0, _screenSize.height); + _position -= Offset(0, -_screenSize.height); _discovery_card(); Fluttertoast.showToast( msg: 'Ajouté', @@ -171,6 +179,122 @@ class CardProvider extends ChangeNotifier{ notifyListeners(); } + void message(context) { + print("message"); + _angle = 0; + _position -= Offset(0, _screenSize.height); + _message_card(); + showModalBottomSheet( + isDismissible: false, + useRootNavigator: true, + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + constraints: BoxConstraints( + maxWidth: 600, + maxHeight: double.infinity, + ), + builder: (context) => buildSheet(),); + notifyListeners(); + } + Widget buildSheet() => Container( + height: 550, + width: 350, + decoration: BoxDecoration( + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.4), + offset: const Offset( + 0, + 0, + ), + blurRadius: 10.0, + spreadRadius: 2.0, + ), + BoxShadow( + color: Colors.white.withOpacity(0.3), + offset: const Offset(0.0, 0.0), + blurRadius: 0.0, + spreadRadius: 0.0, + ),//BoxShadow//BoxShadow + ], + color: Color(0xFF232123), + borderRadius: BorderRadius.only( + topRight: Radius.circular(30), + topLeft: Radius.circular(30), + ), + ), + child: Padding( + padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + child: Column( + children: [ + + Container( + height: 5, + width: 130, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF8A8A8A), + ), + ), + SizedBox(height: 30,), + Container( + width: double.infinity, + height: 300, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(20), + color: Color(0xFF302C30), + ), + child: Padding( + padding: EdgeInsets.all(20), + child: TextField( + maxLength: 300, + style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), + expands: true, + maxLines: null, + keyboardType: TextInputType.multiline, + decoration: InputDecoration( + hintStyle: TextStyle( + color: Colors.white, + ), + border: InputBorder.none, + hintText: "Mon message", + ), + ), + ), + ), + SizedBox(height: 20,), + SizedBox( + width: double.infinity, + height: 70, + child: ElevatedButton( + onPressed: () {}, + style: ElevatedButton.styleFrom( + primary: Color(0xFF3F1DC3), + textStyle: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold), + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(17) + ), + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + Text("Envoyer"), + Opacity(opacity: 0.2, + child: Image.asset("assets/images/send_logo.png",),) + ], + ), + ), + ) + ], + ), + ), + + ); + + void like(context) { print("like"); _angle = 20; @@ -193,6 +317,11 @@ class CardProvider extends ChangeNotifier{ resetPosition(); } + Future _message_card() async { + await Future.delayed(Duration(milliseconds: 200)); + resetPosition(); + } + } diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_card.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_card.dart index 6a095b5..8009b40 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_card.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_card.dart @@ -77,6 +77,9 @@ class _CardWidgetState extends State{ case CardStatus.discovery: final child = buildStamp(image: 'assets/images/icon_discovery.png', opacity: opacity); return child; + case CardStatus.message: + final child = buildStamp(image: 'assets/images/icon_messages.png', opacity: opacity); + return child; default: return Container(); @@ -124,7 +127,7 @@ class _CardWidgetState extends State{ ..translate(-center.dx, -center.dy); return AnimatedContainer( - curve: Curves.easeInOut, + curve: Curves.easeOut, duration: Duration(milliseconds: milliseconds), transform: rotatedMatrix..translate(position.dx, position.dy), child: Stack( 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 25923ec..8408c11 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 @@ -75,7 +75,7 @@ class _SpotsWidgetState extends State { top: height*0.68, width: width, child: Row( - mainAxisAlignment: MainAxisAlignment.center, + mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ GestureDetector( onTap: () { @@ -90,9 +90,6 @@ class _SpotsWidgetState extends State { fit: BoxFit.cover, ), ), - SizedBox( - width: width*0.1, - ), GestureDetector( onTap: () { final provider = Provider.of(context, listen: false); @@ -105,22 +102,19 @@ class _SpotsWidgetState extends State { fit: BoxFit.cover, ), ), - SizedBox( - width: width*0.1, - ), GestureDetector( - onLongPress: (){ - showModalBottomSheet( - useRootNavigator: true, - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - constraints: BoxConstraints( - maxWidth: 600, - maxHeight: double.infinity, - ), - builder: (context) => buildSheet(),); + onTap: () { + final provider = Provider.of(context, listen: false); + provider.message(this.context); }, + child: Image.asset( + 'assets/images/bouton_messages.png', + height: 70, + width: 70, + fit: BoxFit.cover, + ), + ), + GestureDetector( onTap: () { final provider = Provider.of(context, listen: false); provider.like(this.context); @@ -183,84 +177,6 @@ class _SpotsWidgetState extends State { ); } - Widget buildSheet() => Container( - height: 550, - width: 330, - decoration: BoxDecoration( - color: Color(0xFF232123), - borderRadius: BorderRadius.only( - topRight: Radius.circular(30), - topLeft: Radius.circular(30), - ), - ), - child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), - child: Column( - children: [ - - Container( - height: 5, - width: 130, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Color(0xFF8A8A8A), - ), - ), - SizedBox(height: 30,), - Container( - width: double.infinity, - height: 300, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(20), - color: Color(0xFF302C30), - ), - child: Padding( - padding: EdgeInsets.all(20), - child: TextField( - maxLength: 200, - style: TextStyle(fontFamily: 'DMSans', color: Colors.white.withOpacity(1) ,fontSize: 17, fontWeight: FontWeight.w200), - expands: true, - maxLines: null, - keyboardType: TextInputType.multiline, - decoration: InputDecoration( - hintStyle: TextStyle( - color: Colors.white, - ), - border: InputBorder.none, - hintText: "Mon message", - ), - ), - ), - ), - SizedBox(height: 20,), - SizedBox( - width: double.infinity, - height: 70, - child: ElevatedButton( - onPressed: () {}, - style: ElevatedButton.styleFrom( - primary: Color(0xFF3F1DC3), - textStyle: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold), - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(17) - )), - child: Row( - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Text("Envoyer"), - Opacity(opacity: 0.2, - child: Image.asset("assets/images/send_logo.png",),) - ], - ), - ), - ) - ], - ), - ), - - ); }