diff --git a/Sources/dafl_project_flutter/lib/api/in_app_browser.dart b/Sources/dafl_project_flutter/lib/api/in_app_browser.dart index a04764b..9805ad9 100644 --- a/Sources/dafl_project_flutter/lib/api/in_app_browser.dart +++ b/Sources/dafl_project_flutter/lib/api/in_app_browser.dart @@ -1,9 +1,7 @@ import 'dart:io'; import 'package:flutter_inappwebview/flutter_inappwebview.dart'; -import 'dart:developer' as dev; import '../exceptions/api_exception.dart'; import '../main.dart'; -import 'track.dart'; class MyInAppBrowser extends InAppBrowser { var options = InAppBrowserClassOptions( @@ -29,12 +27,7 @@ class MyInAppBrowser extends InAppBrowser { if (url!.origin + url.path == MyApp.api.redirectUri) { try { await MyApp.api.requestUserAuthorization(url); - - /*String id = await MyApp.api.getRecentlyPlayedTrack(); - Track track = await MyApp.api.getTrackInfo(id); - dev.log('${track.artist} ${track.name} ${track.albumImage}');*/ - - await MyApp.api.getPlaylists(); + //await MyApp.api.getPlaylists(); } on ApiException { // TODO : add notification to show that an error occured } finally { diff --git a/Sources/dafl_project_flutter/lib/controller/controller.dart b/Sources/dafl_project_flutter/lib/controller/controller.dart index 39bc2f2..198299f 100644 --- a/Sources/dafl_project_flutter/lib/controller/controller.dart +++ b/Sources/dafl_project_flutter/lib/controller/controller.dart @@ -14,12 +14,12 @@ class Controller { static Saver saver = DatabaseSaver(); static Loader loader = DatabaseLoader(); - static Searcher _searcher = DatabaseSearcher(); + static final Searcher _searcher = DatabaseSearcher(); User currentUser = User("", ""); factory Controller() { - if (_this == null) _this = Controller._(); + _this ??= Controller._(); return _this!; } @@ -38,34 +38,51 @@ class Controller { } void changeCurrentUser(User user) { - this.currentUser = user; + currentUser = user; } void changeUsernameCourant(String newName) { - if (newName != null) { - this.currentUser.usernameDafl = newName; - } + currentUser.usernameDafl = newName; } void changePasswordCourant(String newPass) { - if (newPass != null) { - this.currentUser.passwDafl = newPass; - } + currentUser.passwDafl = newPass; } Future searchByUsername(String username) async { return await _searcher.searchByUsername(username); } - void chargeExample(){ + void chargeExample() { currentUser.spots = [ - Spot( User('Félix','1234'), Music('Couleurs','Khali','https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg')), - Spot( User('Audric','1234'), Music("J'suis PNL",'PNL','https://m.media-amazon.com/images/I/61aUOMzwS8L._SL1440_.jpg')), - Spot( User('Dorian','1234'), Music('Sundance','Nepal','https://pbs.twimg.com/media/ExJ-My-XMAE3Ko2.jpg')), - Spot( User('Lucas','1234'), Music('Eternelle 2','So La Lune','https://cdns-images.dzcdn.net/images/cover/2818a661c6d533155ce6dffc256b1f51/500x500.jpg')), - Spot( User('David','1234'), Music('M.I.L.S 3','Ninho','https://cdns-images.dzcdn.net/images/cover/b351f0e935c9c3901f8d893b92ab952a/500x500.jpg')), - Spot( User('Hugo','1234'), Music('Deux frères','PNL','https://cdns-images.dzcdn.net/images/cover/65147b581f2ace9e0f0723ee76e70fda/500x500.jpg')), - Spot( User('Alban','1234'), Music('Paradis','Sopico','https://cdns-images.dzcdn.net/images/cover/17a9747927ac3e5ea56f92f635d9180c/500x500.jpg')), + Spot( + User('Félix', '1234'), + Music('Couleurs', 'Khali', + 'https://khaligidilit.com/assets/images/cover-LAI%CC%88LA-Khali.jpeg')), + Spot( + User('Audric', '1234'), + Music("J'suis PNL", 'PNL', + 'https://m.media-amazon.com/images/I/61aUOMzwS8L._SL1440_.jpg')), + Spot( + User('Dorian', '1234'), + Music('Sundance', 'Nepal', + 'https://pbs.twimg.com/media/ExJ-My-XMAE3Ko2.jpg')), + Spot( + User('Lucas', '1234'), + Music('Eternelle 2', 'So La Lune', + 'https://cdns-images.dzcdn.net/images/cover/2818a661c6d533155ce6dffc256b1f51/500x500.jpg')), + Spot( + User('David', '1234'), + Music('M.I.L.S 3', 'Ninho', + 'https://cdns-images.dzcdn.net/images/cover/b351f0e935c9c3901f8d893b92ab952a/500x500.jpg')), + Spot( + User('Hugo', '1234'), + Music('Deux frères', 'PNL', + 'https://cdns-images.dzcdn.net/images/cover/65147b581f2ace9e0f0723ee76e70fda/500x500.jpg')), + Spot( + User('Alban', '1234'), + Music('Paradis', 'Sopico', + 'https://cdns-images.dzcdn.net/images/cover/17a9747927ac3e5ea56f92f635d9180c/500x500.jpg')), ].reversed.toList(); } } diff --git a/Sources/dafl_project_flutter/lib/main.dart b/Sources/dafl_project_flutter/lib/main.dart index 5b2e195..1581d10 100644 --- a/Sources/dafl_project_flutter/lib/main.dart +++ b/Sources/dafl_project_flutter/lib/main.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:io'; import 'package:fluttertoast/fluttertoast.dart'; import 'dart:math'; import './views/pages/home/p_home.dart'; @@ -20,7 +19,6 @@ void main() { class MyApp extends StatelessWidget { static Controller controller = Controller(); - static Api api = Api(); const MyApp({super.key}); @@ -29,15 +27,15 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { Paint.enableDithering = true; - SystemChrome.setEnabledSystemUIOverlays([SystemUiOverlay.top]); + SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, + overlays: [SystemUiOverlay.top]); return ChangeNotifierProvider( - create: (context) => CardProvider(), - child: const MaterialApp( - debugShowCheckedModeBanner: false, - title: 'Flutter Demo', - home: HomePage(), - ), - ); + create: (context) => CardProvider(), + child: const MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Flutter Demo', + home: HomePage(), + )); } } @@ -131,19 +129,19 @@ class CardProvider extends ChangeNotifier { } else if (y >= delta * 2 && x.abs() < 100) { return CardStatus.discovery; } - } else { - const 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) { - return CardStatus.like; - } else if (x <= -delta) { - return CardStatus.disLike; - } } + const 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) { + return CardStatus.like; + } else if (x <= -delta) { + return CardStatus.disLike; + } + return null; } void dislike() { @@ -173,18 +171,16 @@ class CardProvider extends ChangeNotifier { backgroundColor: Colors.red, textColor: Colors.white); } else { - if (MyApp.controller.currentUser.spots.last != null) { - 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(); - } + 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(); } } @@ -234,14 +230,14 @@ class CardProvider extends ChangeNotifier { spreadRadius: 0.0, ), //BoxShadow//BoxShadow ], - color: Color(0xFF232123), - borderRadius: BorderRadius.only( + color: const Color(0xFF232123), + borderRadius: const BorderRadius.only( topRight: Radius.circular(30), topLeft: Radius.circular(30), ), ), child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + padding: const EdgeInsets.fromLTRB(20, 10, 20, 10), child: Column( children: [ Container( @@ -249,10 +245,10 @@ class CardProvider extends ChangeNotifier { width: 130, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFF8A8A8A), + color: const Color(0xFF8A8A8A), ), ), - SizedBox( + const SizedBox( height: 30, ), Container( @@ -260,10 +256,10 @@ class CardProvider extends ChangeNotifier { height: 300, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFF302C30), + color: const Color(0xFF302C30), ), child: Padding( - padding: EdgeInsets.all(20), + padding: const EdgeInsets.all(20), child: TextField( keyboardAppearance: Brightness.dark, controller: messageTextField, @@ -276,7 +272,7 @@ class CardProvider extends ChangeNotifier { expands: true, maxLines: null, textInputAction: TextInputAction.send, - decoration: InputDecoration( + decoration: const InputDecoration( hintStyle: TextStyle( color: Colors.white, ), @@ -286,7 +282,7 @@ class CardProvider extends ChangeNotifier { ), ), ), - SizedBox( + const SizedBox( height: 20, ), SizedBox( @@ -298,16 +294,16 @@ class CardProvider extends ChangeNotifier { MyApp.controller.currentUser.spots.last.user); }, style: ElevatedButton.styleFrom( - primary: Color(0xFF3F1DC3), - textStyle: - TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + backgroundColor: const Color(0xFF3F1DC3), + textStyle: const TextStyle( + fontSize: 20, fontWeight: FontWeight.bold), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(17)), ), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ - Text("Envoyer"), + const Text("Envoyer"), Opacity( opacity: 0.2, child: Image.asset( @@ -383,27 +379,24 @@ class _SplashState extends State { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: const Color(0xFF141414), - body: Center( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: const [ - SizedBox( - height: 300, - width: 300, - child: riv.RiveAnimation.asset('assets/images/new_file (2).riv'), - ), - SizedBox(height: 50), - ], - ), - ), - ); + backgroundColor: const Color(0xFF141414), + body: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: const [ + SizedBox( + height: 300, + width: 300, + child: + riv.RiveAnimation.asset('assets/images/new_file (2).riv'), + ), + SizedBox(height: 50), + ]))); } } Object notify(int index, context, {bool isError = true}) { double height = MediaQuery.of(context).size.height; - double width = MediaQuery.of(context).size.width; String message; if (isError == true) { switch (index) { @@ -447,51 +440,44 @@ Object notify(int index, context, {bool isError = true}) { clipBehavior: Clip.none, children: [ Container( - padding: EdgeInsets.fromLTRB(20, height / 110, 20, 0), - height: 90, - child: Row( - children: [ - Container( + padding: EdgeInsets.fromLTRB(20, height / 110, 20, 0), + height: 90, + decoration: BoxDecoration( + image: const DecorationImage( + image: AssetImage("assets/images/backgroundNotify.png"), + fit: BoxFit.cover), + gradient: const LinearGradient( + colors: [Color(0xFF81052a), Color(0xFF810548)], + begin: Alignment.topLeft, + end: Alignment.bottomRight), + borderRadius: const BorderRadius.all(Radius.circular(20)), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + blurRadius: 10, + offset: const Offset(4, 8), // Shadow position + ), + ], + ), + child: Row(children: [ + const SizedBox( height: 48, width: 48, ), Expanded( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( "Ho ho !", style: TextStyle(fontWeight: FontWeight.bold), ), - Text( - message, - style: TextStyle(), - overflow: TextOverflow.ellipsis, - maxLines: 2, - ), - ], - ), - ), - ], - ), - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/backgroundNotify.png"), - fit: BoxFit.cover), - gradient: LinearGradient( - colors: [Color(0xFF81052a), Color(0xFF810548)], - begin: Alignment.topLeft, - end: Alignment.bottomRight), - borderRadius: BorderRadius.all(Radius.circular(20)), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.3), - blurRadius: 10, - offset: Offset(4, 8), // Shadow position - ), - ], - ), - ), + Text(message, + style: const TextStyle(), + overflow: TextOverflow.ellipsis, + maxLines: 2) + ])) + ])), Positioned( top: -50, left: -20, diff --git a/Sources/dafl_project_flutter/lib/model/user.dart b/Sources/dafl_project_flutter/lib/model/user.dart index ba89aba..df61880 100644 --- a/Sources/dafl_project_flutter/lib/model/user.dart +++ b/Sources/dafl_project_flutter/lib/model/user.dart @@ -1,3 +1,5 @@ +import '../api/track.dart'; +import '../exceptions/api_exception.dart'; import '../main.dart'; import 'conversation.dart'; import 'music.dart'; @@ -13,8 +15,14 @@ class User { late String usernameAPI; late String passwAPI; + //attributes with Spotify API + late String _id; + late Track track; + //constructors - User(this.usernameDafl, this.passwDafl); + User(this.usernameDafl, this.passwDafl) { + _actualiseTrack(); + } User.name(this.usernameDafl); @@ -55,6 +63,15 @@ class User { conversations.forEach((k, v) => v.displayMessages()); } + _actualiseTrack() async { + try { + _id = await MyApp.api.getRecentlyPlayedTrack(); + track = await MyApp.api.getTrackInfo(_id); + } on ApiException { + // TODO : add notification to show that an error occured + } + } + @override String toString() => "$usernameDafl ($passwDafl)"; } diff --git a/Sources/dafl_project_flutter/lib/presentation/custom_icons_icons.dart b/Sources/dafl_project_flutter/lib/presentation/custom_icons_icons.dart index a715b0b..8e2d95d 100644 --- a/Sources/dafl_project_flutter/lib/presentation/custom_icons_icons.dart +++ b/Sources/dafl_project_flutter/lib/presentation/custom_icons_icons.dart @@ -6,8 +6,12 @@ class CustomIcons { static const _kFontFam = 'CustomIcons'; static const String? _kFontPkg = null; - static const IconData podium_outline = IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData spot = IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData podium = IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); - static const IconData spot_outline = IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData podiumOutline = + IconData(0xe801, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData spot = + IconData(0xe802, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData podium = + IconData(0xe803, fontFamily: _kFontFam, fontPackage: _kFontPkg); + static const IconData spotOutline = + IconData(0xe804, fontFamily: _kFontFam, fontPackage: _kFontPkg); } diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart index 371ecaf..9c6c37a 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_conversation.dart @@ -1,10 +1,8 @@ import 'package:flutter/material.dart'; import 'package:dafl_project_flutter/main.dart'; import 'package:dafl_project_flutter/model/user.dart'; -import 'package:dafl_project_flutter/views/pages/main/w_messages.dart'; -import 'package:flutter/cupertino.dart'; - import 'package:dafl_project_flutter/model/message.dart'; +import 'dart:developer' as dev; class ConversationPage extends StatefulWidget { const ConversationPage({Key? key}) : super(key: key); @@ -14,41 +12,41 @@ class ConversationPage extends StatefulWidget { } class _ConversationPageState extends State { - User destinataire = new User("test1", '1234'); + User destinataire = User("test1", '1234'); List messages = []; bool isNull = true; final messageTextField = TextEditingController(); - void SendMessage(String content) { + void sendMessage(String content) { setState(() { messages - .add(MessageWidget(Message(MyApp.controller.currentUser, content))); + .add(messageWidget(Message(MyApp.controller.currentUser, content))); }); } - Widget MessageWidget(Message message) { + Widget messageWidget(Message message) { if (message.sender != MyApp.controller.currentUser) { return Align( alignment: Alignment.centerLeft, child: Container( - margin: EdgeInsets.fromLTRB(40, 7, 80, 7), + margin: const EdgeInsets.fromLTRB(40, 7, 80, 7), decoration: BoxDecoration( - borderRadius: BorderRadius.only( + borderRadius: const BorderRadius.only( bottomRight: Radius.circular(20), topLeft: Radius.circular(20), topRight: Radius.circular(20), bottomLeft: Radius.circular(20), ), border: Border.all( - width: 1.5, color: Color(0xFF9C9C9C).withOpacity(0.3)), - color: Color(0xFF191919), + width: 1.5, color: const Color(0xFF9C9C9C).withOpacity(0.3)), + color: const Color(0xFF191919), ), child: Padding( - padding: EdgeInsets.fromLTRB(15, 15, 15, 15), + padding: const EdgeInsets.fromLTRB(15, 15, 15, 15), child: Text( message.content, - style: TextStyle( + style: const TextStyle( fontFamily: 'DMSans', color: Colors.white, fontSize: 15, @@ -60,8 +58,8 @@ class _ConversationPageState extends State { return Align( alignment: Alignment.centerRight, child: Container( - margin: EdgeInsets.fromLTRB(80, 7, 40, 7), - decoration: BoxDecoration( + margin: const EdgeInsets.fromLTRB(80, 7, 40, 7), + decoration: const BoxDecoration( borderRadius: BorderRadius.only( bottomRight: Radius.circular(20), bottomLeft: Radius.circular(20), @@ -71,10 +69,10 @@ class _ConversationPageState extends State { color: Color(0xFF2F2F2F), ), child: Padding( - padding: EdgeInsets.all(15), + padding: const EdgeInsets.all(15), child: Text( message.content, - style: TextStyle( + style: const TextStyle( fontFamily: 'DMSans', color: Colors.white, fontSize: 15, @@ -90,7 +88,7 @@ class _ConversationPageState extends State { void initState() { super.initState(); messageTextField.addListener(_checkIfNull); - print("INITSATE"); + dev.log("INITSATE"); } @override @@ -100,7 +98,7 @@ class _ConversationPageState extends State { } void _checkIfNull() { - if (messageTextField.text.length > 0) { + if (messageTextField.text.isNotEmpty) { setState(() { isNull = false; }); @@ -122,67 +120,65 @@ class _ConversationPageState extends State { resizeToAvoidBottomInset: true, appBar: AppBar( elevation: 20, - backgroundColor: Color(0xFF141414), + backgroundColor: const Color(0xFF141414), toolbarHeight: 70, - title: Container( - child: Row( - children: [ - Container( - padding: EdgeInsets.fromLTRB(0, 10, 0, 0), - height: 40, - width: 40, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(40), - color: Colors.blue, - ), - ), - SizedBox( - width: 20, + title: Row( + children: [ + Container( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), + height: 40, + width: 40, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(40), + color: Colors.blue, ), - Text("Max"), - Spacer(), - IconButton( - splashColor: Colors.grey.withOpacity(0.2), - splashRadius: 30, - onPressed: () { - showModalBottomSheet( - isDismissible: true, - useRootNavigator: true, - isScrollControlled: true, - backgroundColor: Colors.transparent, - context: context, - constraints: BoxConstraints( - maxWidth: 600, - maxHeight: double.infinity, - ), - builder: (context) => buildSheet(), - ); - }, - icon: Icon( - Icons.report_problem, - color: Colors.grey.withOpacity(0.3), - size: 25, - ), + ), + const SizedBox( + width: 20, + ), + const Text("Max"), + const Spacer(), + IconButton( + splashColor: Colors.grey.withOpacity(0.2), + splashRadius: 30, + onPressed: () { + showModalBottomSheet( + isDismissible: true, + useRootNavigator: true, + isScrollControlled: true, + backgroundColor: Colors.transparent, + context: context, + constraints: const BoxConstraints( + maxWidth: 600, + maxHeight: double.infinity, + ), + builder: (context) => buildSheet(), + ); + }, + icon: Icon( + Icons.report_problem, + color: Colors.grey.withOpacity(0.3), + size: 25, ), - ], - ), + ), + ], ), ), body: SingleChildScrollView( child: Container( - color: Color(0xFF141414), + color: const Color(0xFF141414), height: height * 0.92, width: double.infinity, child: ListView.builder( controller: listScrollController, - physics: BouncingScrollPhysics(), + physics: const BouncingScrollPhysics(), itemCount: messages.length, itemBuilder: (context, index) { return messages[index]; })), ), bottomSheet: BottomAppBar( - color: Color(0xFF141414), + color: const Color(0xFF141414), child: Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, @@ -192,20 +188,20 @@ class _ConversationPageState extends State { color: Colors.transparent, width: width * 0.9, child: Container( - margin: EdgeInsets.fromLTRB(10, 10, 10, 10), + margin: const EdgeInsets.fromLTRB(10, 10, 10, 10), decoration: BoxDecoration( border: Border.all( width: 1, - color: Color(0xFF2F2F2F), + color: const Color(0xFF2F2F2F), ), borderRadius: BorderRadius.circular(100), - color: Color(0xFF141414), + color: const Color(0xFF141414), ), child: Padding( - padding: EdgeInsets.fromLTRB(15, 0, 15, 0), + padding: const EdgeInsets.fromLTRB(15, 0, 15, 0), child: TextField( controller: messageTextField, - style: TextStyle(color: Colors.white), + style: const TextStyle(color: Colors.white), decoration: InputDecoration( hintStyle: TextStyle(color: Colors.white.withOpacity(0.7)), @@ -222,7 +218,7 @@ class _ConversationPageState extends State { onTap: isNull ? null : () { - SendMessage(messageTextField.text); + sendMessage(messageTextField.text); if (listScrollController.hasClients) { final position = listScrollController.position.maxScrollExtent; @@ -231,24 +227,24 @@ class _ConversationPageState extends State { messageTextField.clear(); }, child: isNull == true - ? Container( + ? const SizedBox( height: 1, width: 1, ) : Container( width: 40, height: 40, - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + margin: const EdgeInsets.fromLTRB(0, 0, 0, 0), decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), - gradient: LinearGradient( + gradient: const LinearGradient( colors: [Color(0xff8e24a1), Color(0xff8163ff)], begin: Alignment.topLeft, end: Alignment.bottomRight, )), child: Transform.rotate( angle: -300, - child: Icon( + child: const Icon( Icons.arrow_back, size: 26, color: Colors.white, @@ -262,8 +258,6 @@ class _ConversationPageState extends State { } Widget buildSheet() { - String dropdownValue = list.first; - final messageTextField = TextEditingController(); return SingleChildScrollView( padding: EdgeInsets.only(bottom: MediaQuery.of(context).viewInsets.bottom), @@ -288,14 +282,14 @@ class _ConversationPageState extends State { spreadRadius: 0.0, ), //BoxShadow//BoxShadow ], - color: Color(0xFF232123), - borderRadius: BorderRadius.only( + color: const Color(0xFF232123), + borderRadius: const BorderRadius.only( topRight: Radius.circular(30), topLeft: Radius.circular(30), ), ), child: Padding( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + padding: const EdgeInsets.fromLTRB(20, 10, 20, 10), child: Column( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ @@ -304,10 +298,10 @@ class _ConversationPageState extends State { width: 130, decoration: BoxDecoration( borderRadius: BorderRadius.circular(20), - color: Color(0xFF8A8A8A), + color: const Color(0xFF8A8A8A), ), ), - Padding( + const Padding( padding: EdgeInsets.fromLTRB(0, 20, 0, 20), child: Text( 'Signaler', @@ -318,14 +312,14 @@ class _ConversationPageState extends State { ), ), Container( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + padding: const EdgeInsets.fromLTRB(20, 10, 20, 10), width: double.infinity, decoration: BoxDecoration( color: Colors.grey.shade900, borderRadius: BorderRadius.circular(15), ), child: Column( - children: [ + children: const [ Text( 'Vous êtes sur le point de signaler cet utilisateur. Veuillez renseigner le motif du signalement.', style: TextStyle(color: Colors.grey), @@ -339,11 +333,11 @@ class _ConversationPageState extends State { ), ), Padding( - padding: EdgeInsets.fromLTRB(0, 20, 0, 20), + padding: const EdgeInsets.fromLTRB(0, 20, 0, 20), child: Column( children: [ Container( - padding: EdgeInsets.fromLTRB(20, 10, 20, 10), + padding: const EdgeInsets.fromLTRB(20, 10, 20, 10), width: double.infinity, decoration: BoxDecoration( color: Colors.grey.withOpacity(0.07), @@ -359,7 +353,7 @@ class _ConversationPageState extends State { fontWeight: FontWeight.w200), maxLines: 3, textInputAction: TextInputAction.done, - decoration: InputDecoration( + decoration: const InputDecoration( hintText: '* Commentaires', hintStyle: TextStyle( fontSize: 15, @@ -371,18 +365,18 @@ class _ConversationPageState extends State { ), ], )), - Spacer(), + const Spacer(), Padding( - padding: EdgeInsets.fromLTRB(0, 0, 0, 50), + padding: const EdgeInsets.fromLTRB(0, 0, 0, 50), child: SizedBox( width: double.infinity, height: 70, child: ElevatedButton( onPressed: () {}, style: ElevatedButton.styleFrom( - primary: Colors.red, - textStyle: - TextStyle(fontSize: 20, fontWeight: FontWeight.bold), + backgroundColor: Colors.red, + textStyle: const TextStyle( + fontSize: 20, fontWeight: FontWeight.bold), shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(17)), ), @@ -396,7 +390,7 @@ class _ConversationPageState extends State { size: 100, color: Colors.white.withOpacity(0.2), )), - Center( + const Center( child: Text("Envoyer le signalement"), ), ], diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart b/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart index 39f7306..a4d60e4 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/p_main.dart @@ -42,12 +42,12 @@ class _MainPageState extends State { fontSize: 12, fontWeight: FontWeight.w400, color: Colors.grey)), ), child: ConstrainedBox( - constraints: BoxConstraints( + constraints: const BoxConstraints( minHeight: 100, maxHeight: 100, ), child: NavigationBar( - animationDuration: Duration(microseconds: 800), + animationDuration: const Duration(microseconds: 800), selectedIndex: index, height: height * 0.1, onDestinationSelected: (index) => setState(() => _index = index), @@ -77,12 +77,12 @@ class _MainPageState extends State { NavigationDestination( icon: Icon(CustomIcons.spot, color: Colors.grey), selectedIcon: - Icon(CustomIcons.spot_outline, color: Colors.white), + Icon(CustomIcons.spotOutline, color: Colors.white), label: 'Spots', ), NavigationDestination( icon: Icon( - CustomIcons.podium_outline, + CustomIcons.podiumOutline, color: Colors.grey, ), label: 'Tops', @@ -111,7 +111,9 @@ class _MainPageState extends State { } class GradientText extends StatelessWidget { - const GradientText(this.text, {super.key, + const GradientText( + this.text, { + super.key, required this.gradient, this.style, }); @@ -124,10 +126,9 @@ class GradientText extends StatelessWidget { Widget build(BuildContext context) { return ShaderMask( blendMode: BlendMode.srcIn, - shaderCallback: (bounds) => - gradient.createShader( - Rect.fromLTWH(0, 0, bounds.width, bounds.height), - ), + shaderCallback: (bounds) => gradient.createShader( + Rect.fromLTWH(0, 0, bounds.width, bounds.height), + ), child: Text(text, style: style), ); } 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 ccb5e2d..5ec6158 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 @@ -91,95 +91,92 @@ class _DiscoveryListState extends State { @override Widget build(BuildContext context) { return RefreshIndicator( - child: ListView.builder( - itemCount: MyApp.controller.currentUser.discovery.length, - itemBuilder: (context, index) { - int itemCount = MyApp.controller.currentUser.discovery.length; - int reversedIndex = itemCount - 1 - index; - return Dismissible( - key: Key( - MyApp.controller.currentUser.discovery[reversedIndex].name), - direction: DismissDirection.startToEnd, - child: Container( - margin: EdgeInsets.fromLTRB(0, 10, 0, 0), - padding: EdgeInsets.fromLTRB(30, 0, 30, 0), - child: Column( - children: [ - Container( - margin: EdgeInsets.fromLTRB(0, 5, 0, 0), - width: double.infinity, - child: Row( - children: [ - Container( - height: 60, - width: 60, - decoration: BoxDecoration( - border: Border.all( - width: 0, - color: Colors.grey.withOpacity(0)), - borderRadius: - BorderRadius.all(Radius.circular(10)), - ), - child: Container( + onRefresh: () async { + refreshList(); + }, + key: refreshKey, + child: ListView.builder( + itemCount: MyApp.controller.currentUser.discovery.length, + itemBuilder: (context, index) { + int itemCount = MyApp.controller.currentUser.discovery.length; + int reversedIndex = itemCount - 1 - index; + return Dismissible( + key: Key(MyApp + .controller.currentUser.discovery[reversedIndex].name), + direction: DismissDirection.startToEnd, + onDismissed: (direction) { + if (direction == DismissDirection.startToEnd) { + MyApp.controller.currentUser.discovery + .removeAt(reversedIndex); + } + setState(() { + itemCount -= 1; + }); + }, + background: Container( + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage( + "assets/images/delete_background.png"), + fit: BoxFit.cover))), + child: Container( + margin: const EdgeInsets.fromLTRB(0, 10, 0, 0), + padding: const EdgeInsets.fromLTRB(30, 0, 30, 0), + child: Column(children: [ + Container( + margin: const EdgeInsets.fromLTRB(0, 5, 0, 0), + width: double.infinity, + child: Row(children: [ + Container( + height: 60, + width: 60, + decoration: BoxDecoration( + border: Border.all( + width: 0, + color: Colors.grey.withOpacity(0)), + borderRadius: const BorderRadius.all( + Radius.circular(10)), + ), child: FadeInImage.assetNetwork( placeholder: "assets/images/loadingPlaceholder.gif", image: MyApp.controller.currentUser .discovery[reversedIndex].linkCover), ), - ), - Container( - margin: EdgeInsets.fromLTRB(20, 0, 0, 0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - MyApp.controller.currentUser - .discovery[reversedIndex].name, - style: TextStyle( - fontFamily: 'DMSans', - color: Colors.white.withOpacity(1), - fontSize: 20, - fontWeight: FontWeight.w800), - ), - Text( - MyApp.controller.currentUser - .discovery[reversedIndex].artist, - style: TextStyle( - fontFamily: 'DMSans', - color: Colors.white.withOpacity(0.6), - fontSize: 16, - fontWeight: FontWeight.w400), - ), - ], - ), - ), - ], - ), - ), - ], - )), - onDismissed: (direction) { - if (direction == DismissDirection.startToEnd) - MyApp.controller.currentUser.discovery - .removeAt(reversedIndex); - setState(() { - itemCount -= 1; - }); - }, - background: Container( - decoration: BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/delete_background.png"), - fit: BoxFit.cover), - )), - ); - }), - onRefresh: () async { - refreshList(); - }, - key: refreshKey, - ); + Container( + margin: + const EdgeInsets.fromLTRB(20, 0, 0, 0), + child: Column( + crossAxisAlignment: + CrossAxisAlignment.start, + mainAxisAlignment: + MainAxisAlignment.center, + children: [ + Text( + MyApp.controller.currentUser + .discovery[reversedIndex].name, + style: TextStyle( + fontFamily: 'DMSans', + color: + Colors.white.withOpacity(1), + fontSize: 20, + fontWeight: FontWeight.w800), + ), + Text( + MyApp + .controller + .currentUser + .discovery[reversedIndex] + .artist, + style: TextStyle( + fontFamily: 'DMSans', + color: Colors.white + .withOpacity(0.6), + fontSize: 16, + fontWeight: FontWeight.w400)) + ])) + ])) + ]))); + })); } } diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart index 8a4f617..7d1ffba 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_messages.dart @@ -12,10 +12,10 @@ class MessagesWidget extends StatefulWidget { class _MessagesWidgetState extends State { int indexSectedButton = 0; - Widget currentList = ListConfirmedWidget(); + Widget currentList = const ListConfirmedWidget(); - var colorConfirm = Color(0xFFFFFFFF); - var colorWaiting = Color(0xFFA8A8A8); + var colorConfirm = const Color(0xFFFFFFFF); + var colorWaiting = const Color(0xFFA8A8A8); void changeSelected(int num) { if (indexSectedButton == num) { @@ -23,16 +23,16 @@ class _MessagesWidgetState extends State { } else { if (num == 0) { setState(() { - colorConfirm = Color(0xFFFFFFFF); - colorWaiting = Color(0xFFA8A8A8); - currentList = ListConfirmedWidget(); + colorConfirm = const Color(0xFFFFFFFF); + colorWaiting = const Color(0xFFA8A8A8); + currentList = const ListConfirmedWidget(); indexSectedButton = num; }); } else { setState(() { - colorConfirm = Color(0xFFA8A8A8); - colorWaiting = Color(0xFFFFFFFF); - currentList = ListWaitingWidget(); + colorConfirm = const Color(0xFFA8A8A8); + colorWaiting = const Color(0xFFFFFFFF); + currentList = const ListWaitingWidget(); indexSectedButton = num; }); } @@ -44,83 +44,81 @@ class _MessagesWidgetState extends State { double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return Container( - color: Color(0xFF141414), + color: const Color(0xFF141414), child: Padding( - padding: EdgeInsets.fromLTRB(30, 50, 30, 0), + padding: const EdgeInsets.fromLTRB(30, 50, 30, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Container( - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text('Messages', - style: TextStyle( - color: Colors.white, - fontWeight: FontWeight.w500, - fontSize: 25)), - Padding(padding: EdgeInsets.fromLTRB(0, 5, 0, 0)), - Text( - 'Retrouvez ici vos discussions.', + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Messages', style: TextStyle( - color: Colors.grey.withOpacity(0.4), fontSize: 15), - ), - Padding( - padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, 0), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: [ - SizedBox( - height: 35, - width: width * 0.35, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: colorConfirm, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ), // background// foreground - ), - onPressed: () { - changeSelected(0); - }, - child: Text( - "Validées", - style: TextStyle( - color: Colors.black, - fontSize: 17, - fontWeight: FontWeight.bold), - textAlign: TextAlign.center, - ), + color: Colors.white, + fontWeight: FontWeight.w500, + fontSize: 25)), + const Padding(padding: EdgeInsets.fromLTRB(0, 5, 0, 0)), + Text( + 'Retrouvez ici vos discussions.', + style: TextStyle( + color: Colors.grey.withOpacity(0.4), fontSize: 15), + ), + Padding( + padding: EdgeInsets.fromLTRB(0, height * 0.01, 0, 0), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + SizedBox( + height: 35, + width: width * 0.35, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: colorConfirm, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), // background// foreground + ), + onPressed: () { + changeSelected(0); + }, + child: const Text( + "Validées", + style: TextStyle( + color: Colors.black, + fontSize: 17, + fontWeight: FontWeight.bold), + textAlign: TextAlign.center, ), ), - SizedBox( - height: 35, - width: width * 0.35, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: colorWaiting, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular(15.0), - ), // background// foreground - ), - onPressed: () { - changeSelected(1); - }, - child: Text( - "En attente", - style: TextStyle( - color: Colors.black, - fontSize: 17, - fontWeight: FontWeight.bold), - textAlign: TextAlign.center, - ), + ), + SizedBox( + height: 35, + width: width * 0.35, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: colorWaiting, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(15.0), + ), // background// foreground + ), + onPressed: () { + changeSelected(1); + }, + child: const Text( + "En attente", + style: TextStyle( + color: Colors.black, + fontSize: 17, + fontWeight: FontWeight.bold), + textAlign: TextAlign.center, ), ), - ], - ), + ), + ], ), - ], - ), + ), + ], ), Expanded( child: currentList, @@ -133,36 +131,37 @@ class _MessagesWidgetState extends State { } class MessagesButtonWidget extends StatelessWidget { + const MessagesButtonWidget({super.key}); + @override Widget build(BuildContext context) { - double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; return Container( - margin: EdgeInsets.fromLTRB(0, 0, 0, 10), + margin: const EdgeInsets.fromLTRB(0, 0, 0, 10), child: Column( children: [ Container( color: Colors.transparent, - margin: EdgeInsets.fromLTRB(0, 0, 0, 0), + margin: const EdgeInsets.fromLTRB(0, 0, 0, 0), child: Row( children: [ Container( height: 60, width: 60, decoration: BoxDecoration( - image: DecorationImage( + image: const DecorationImage( image: NetworkImage( 'https://www.goutemesdisques.com/uploads/tx_gmdchron/pi1/L_Etrange_Histoire_de_Mr_Anderson.jpg'), fit: BoxFit.cover, ), border: Border.all( width: 0, color: Colors.grey.withOpacity(0)), - borderRadius: BorderRadius.all(Radius.circular(30)), + borderRadius: const BorderRadius.all(Radius.circular(30)), ), ), Container( width: width - 160, - margin: EdgeInsets.fromLTRB(20, 0, 20, 0), + margin: const EdgeInsets.fromLTRB(20, 0, 20, 0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.center, @@ -209,38 +208,36 @@ class MessagesButtonWidget extends StatelessWidget { } class ListConfirmedWidget extends StatelessWidget { + const ListConfirmedWidget({super.key}); + @override Widget build(BuildContext context) { - double height = MediaQuery.of(context).size.height; - double width = MediaQuery.of(context).size.width; - return ListView( - children: [ - MessagesButtonWidget(), - MessagesButtonWidget(), - MessagesButtonWidget(), - MessagesButtonWidget(), - ], - ); + return ListView(children: const [ + MessagesButtonWidget(), + MessagesButtonWidget(), + MessagesButtonWidget(), + MessagesButtonWidget(), + ]); } } class ListWaitingWidget extends StatelessWidget { + const ListWaitingWidget({super.key}); + @override Widget build(BuildContext context) { - double height = MediaQuery.of(context).size.height; - double width = MediaQuery.of(context).size.width; return ListView( children: [ GestureDetector( onTap: () { Navigator.of(context).push(PageTransition( - duration: Duration(milliseconds: 200), - reverseDuration: Duration(milliseconds: 200), + duration: const Duration(milliseconds: 200), + reverseDuration: const Duration(milliseconds: 200), type: PageTransitionType.rightToLeftWithFade, childCurrent: context.widget, - child: ConversationPage())); + child: const ConversationPage())); }, - child: MessagesButtonWidget(), + child: const MessagesButtonWidget(), ), ], ); diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart index 83f27f7..455e916 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_profile.dart @@ -28,15 +28,14 @@ class _MainPageProfilState extends State { String? username = MyApp.controller.currentUser.usernameDafl; @override - void initState() { + initState() { + username = MyApp.controller.currentUser.usernameDafl; super.initState(); - String username = MyApp.controller.currentUser.usernameDafl ?? "default"; } @override Widget build(BuildContext context) { double height = MediaQuery.of(context).size.height; - double width = MediaQuery.of(context).size.width; return Container( color: const Color(0xFF141414), child: SizedBox( @@ -56,36 +55,32 @@ class _MainPageProfilState extends State { fontFamily: "DMSans")), ), Container( - margin: const EdgeInsets.fromLTRB(0, 10, 0, 10), - height: height * 0.14, - width: height * 0.14, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(100.0), - color: Colors.blue, - border: Border.all(width: 6.0, color: Colors.white), - boxShadow: const [ - BoxShadow( - offset: Offset(0, 0), - spreadRadius: 5, - blurRadius: 10, - color: Color.fromRGBO(0, 0, 0, 1), - ), - ], - ), - child: Center( - child: Text( - username![0], - style: TextStyle( - color: Colors.white, - fontSize: 60, - fontWeight: FontWeight.w500), - textAlign: TextAlign.center, + margin: const EdgeInsets.fromLTRB(0, 10, 0, 10), + height: height * 0.14, + width: height * 0.14, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(100.0), + color: Colors.blue, + border: Border.all(width: 6.0, color: Colors.white), + boxShadow: const [ + BoxShadow( + offset: Offset(0, 0), + spreadRadius: 5, + blurRadius: 10, + color: Color.fromRGBO(0, 0, 0, 1), + ), + ], ), - ), - ), + child: Center( + child: Text(username![0], + style: const TextStyle( + color: Colors.white, + fontSize: 60, + fontWeight: FontWeight.w500), + textAlign: TextAlign.center))), Text( username!, - style: TextStyle( + style: const TextStyle( color: Colors.white, fontSize: 17, fontWeight: FontWeight.w400), @@ -229,34 +224,32 @@ class _MainPageProfilState extends State { crossAxisAlignment: CrossAxisAlignment.center, children: [ Container( - margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), - child: ClipRRect( - borderRadius: BorderRadius.circular(15), - child: FadeInImage.assetNetwork( - height: 90, - width: 90, - placeholder: - "assets/images/loadingPlaceholder.gif", - image: - 'https://images.genius.com/ef4849be3da5fdb22ea9e656679be3a3.600x600x1.jpg'), - ), - ), + margin: const EdgeInsets.fromLTRB(15, 0, 0, 0), + child: ClipRRect( + borderRadius: BorderRadius.circular(15), + child: FadeInImage.assetNetwork( + height: 90, + width: 90, + placeholder: + "assets/images/loadingPlaceholder.gif", + image: MyApp.controller.currentUser.track + .albumImage))), Container( margin: const EdgeInsets.fromLTRB(12, 20, 0, 0), child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, - children: const [ + children: [ Text( - 'BAMBINA', - style: TextStyle( + MyApp.controller.currentUser.track.name, + style: const TextStyle( fontSize: 18, fontWeight: FontWeight.w500, color: Colors.white), ), Text( - 'PNL', - style: TextStyle( + MyApp.controller.currentUser.track.artist, + style: const TextStyle( fontSize: 16, fontWeight: FontWeight.w400, color: Colors.grey), @@ -294,10 +287,10 @@ class _MainPageProfilState extends State { Navigator.push( context, MaterialPageRoute( - builder: (context) => SettingsWidget())) + builder: (context) => const SettingsWidget())) .then((value) => setState(() { username = - MyApp.controller.currentUser.usernameDafl!; + MyApp.controller.currentUser.usernameDafl; })); }, child: Row( diff --git a/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart b/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart index 9f5f56b..f391465 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/main/w_top.dart @@ -65,8 +65,6 @@ class TopWidget extends StatelessWidget { @override Widget build(BuildContext context) { - double height = MediaQuery.of(context).size.height; - double width = MediaQuery.of(context).size.width; return Container( padding: const EdgeInsets.fromLTRB(30, 0, 30, 0), width: double.infinity, @@ -128,12 +126,12 @@ class TopWidget extends StatelessWidget { 'https://images.genius.com/ef4849be3da5fdb22ea9e656679be3a3.600x600x1.jpg'), ), ), - Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.end, + Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.end, children: [ Container( - margin: EdgeInsets.fromLTRB(12, 5, 0, 0), + margin: const EdgeInsets.fromLTRB(12, 5, 0, 0), child: Column( mainAxisAlignment: MainAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.start, @@ -155,21 +153,21 @@ class TopWidget extends StatelessWidget { ], ), ), - GradientText( - '7,2%', - style: const TextStyle(fontWeight: FontWeight.bold, fontSize: 40), - gradient: LinearGradient(colors: [ - Colors.orange, - Colors.red, - Colors.purple, - ]), - ), - ], - ), + const GradientText( + '7,2%', + style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40), + gradient: LinearGradient(colors: [ + Colors.orange, + Colors.red, + Colors.purple, + ]), + ), ], ), ], ), + ], + ), ); } } diff --git a/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart b/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart index b1cb057..0ebe26d 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/sign_in/p_sign_in.dart @@ -1,8 +1,6 @@ import 'package:flutter/material.dart'; import 'package:page_transition/page_transition.dart'; import '../../../main.dart'; -import '../../../model/music.dart'; -import '../../../model/user.dart'; import '../sign_up/p_sign_up.dart'; class SignInPage extends StatefulWidget { @@ -15,11 +13,11 @@ class SignInPage extends StatefulWidget { class _SignInPageState extends State { var boxColor = Colors.white; - @override bool isChecked = false; final userNameTextField = TextEditingController(); final passwordTextField = TextEditingController(); + @override Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, @@ -148,7 +146,7 @@ class _SignInPageState extends State { const SizedBox( height: 10, ), - Container( + SizedBox( width: double.infinity, child: Row( mainAxisAlignment: MainAxisAlignment.center, @@ -179,43 +177,39 @@ class _SignInPageState extends State { height: 50, ), ClipRRect( - borderRadius: BorderRadius.circular(22), - child: Material( - child: InkWell( - highlightColor: Colors.grey.shade100, - splashColor: const Color(0xFF406DE1), - onTap: () { - checkInformations( - userNameTextField.text, passwordTextField.text); - }, - child: Ink( - child: const Align( - alignment: Alignment.center, - child: Icon( - Icons.check, - color: Color(0xFF406DE1), - size: 60.0, - ), - ), - padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), - width: 83, - height: 83, - decoration: BoxDecoration( - color: Colors.white, // Set rounded corner radius - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.3), - spreadRadius: 5, - blurRadius: 7, - offset: const Offset( - 0, 3), // changes position of shadow - ), - ], - ), - ), - ), - ), - ), + borderRadius: BorderRadius.circular(22), + child: Material( + child: InkWell( + highlightColor: Colors.grey.shade100, + splashColor: const Color(0xFF406DE1), + onTap: () { + checkInformations( + userNameTextField.text, passwordTextField.text); + }, + child: Ink( + padding: const EdgeInsets.fromLTRB(0, 10, 0, 0), + width: 83, + height: 83, + decoration: BoxDecoration( + color: Colors.white, + // Set rounded corner radius + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.3), + spreadRadius: 5, + blurRadius: 7, + offset: const Offset( + 0, 3), // changes position of shadow + ), + ], + ), + child: const Align( + alignment: Alignment.center, + child: Icon( + Icons.check, + color: Color(0xFF406DE1), + size: 60.0, + )))))), const SizedBox( height: 100, ), diff --git a/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart b/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart index 4a362c7..9cff4f5 100644 --- a/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart +++ b/Sources/dafl_project_flutter/lib/views/pages/sign_up/p_sign_up.dart @@ -43,10 +43,10 @@ class _SignUpPageState extends State { 'assets/images/Logo.png', width: 250, ), - SizedBox( + const SizedBox( height: 45, ), - Text( + const Text( "S'INSCRIRE", style: TextStyle( fontFamily: 'DMSans', @@ -55,36 +55,37 @@ class _SignUpPageState extends State { fontWeight: FontWeight.w700), textAlign: TextAlign.center, ), - SizedBox( + const SizedBox( height: 10, ), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 0, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 0, 45, 0), child: Stack( children: [ Container( height: 43, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(50)), + borderRadius: + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], ), ), Padding( - padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( keyboardAppearance: Brightness.dark, controller: userNameTextField, - decoration: InputDecoration( + decoration: const InputDecoration( border: InputBorder.none, ), cursorColor: Colors.purple, @@ -92,7 +93,7 @@ class _SignUpPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + margin: const EdgeInsets.fromLTRB(15, 12, 0, 0), child: Image.asset( 'assets/images/profil_logo.png', height: 16, @@ -104,32 +105,33 @@ class _SignUpPageState extends State { )), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), child: Stack( children: [ Container( height: 43, decoration: BoxDecoration( color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(50)), + borderRadius: + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: - Offset(0, 3), // changes position of shadow + offset: const Offset( + 0, 3), // changes position of shadow ), ], ), ), Padding( - padding: EdgeInsets.fromLTRB(50, 0, 20, 0), + padding: const EdgeInsets.fromLTRB(50, 0, 20, 0), child: TextField( keyboardAppearance: Brightness.dark, controller: passwordTextField, obscureText: true, - decoration: InputDecoration( + decoration: const InputDecoration( border: InputBorder.none, ), cursorColor: Colors.purple, @@ -137,7 +139,7 @@ class _SignUpPageState extends State { ), ), Container( - margin: EdgeInsets.fromLTRB(15, 12, 0, 0), + margin: const EdgeInsets.fromLTRB(15, 12, 0, 0), child: Image.asset( 'assets/images/password_logo.png', height: 16, @@ -149,7 +151,7 @@ class _SignUpPageState extends State { )), Container( width: 500, - padding: EdgeInsets.fromLTRB(45, 10, 45, 0), + padding: const EdgeInsets.fromLTRB(45, 10, 45, 0), child: Stack( children: [ Container( @@ -157,13 +159,13 @@ class _SignUpPageState extends State { decoration: BoxDecoration( color: Colors.white, borderRadius: - BorderRadius.all(Radius.circular(50)), + const BorderRadius.all(Radius.circular(50)), boxShadow: [ BoxShadow( color: Colors.black.withOpacity(0.3), spreadRadius: 5, blurRadius: 7, - offset: Offset( + offset: const Offset( 0, 3), // changes position of shadow ), ])), @@ -349,7 +351,7 @@ class _SignUpPageState extends State { reverseDuration: const Duration(milliseconds: 300), type: PageTransitionType.leftToRightJoined, childCurrent: widget, - child: HomePage()), + child: const HomePage()), ); } } diff --git a/Sources/dafl_project_flutter/pubspec.yaml b/Sources/dafl_project_flutter/pubspec.yaml index 95db087..b309a65 100644 --- a/Sources/dafl_project_flutter/pubspec.yaml +++ b/Sources/dafl_project_flutter/pubspec.yaml @@ -56,6 +56,7 @@ flutter: assets: - assets/images/ - assets/fonts/ + - assets/ fonts: - family: DMSans