fix somes issues #60

Merged
emre.kartal merged 1 commits from fix/fix-issues into master 1 year ago

@ -3,7 +3,7 @@ package="com.justdev.justmusic">
<application <application
android:label="JustMUSIC" android:label="JustMUSIC"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/launcher_icon">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

After

Width:  |  Height:  |  Size: 421 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 282 B

After

Width:  |  Height:  |  Size: 729 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 704 B

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 406 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 862 B

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 B

After

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

@ -10,11 +10,21 @@ class CommentComponent extends StatelessWidget {
final Comment comment; final Comment comment;
const CommentComponent({Key? key, required this.comment}) : super(key: key); const CommentComponent({Key? key, required this.comment}) : super(key: key);
String calculateTimeDifference(DateTime startDate) {
Duration difference = DateTime.now().difference(startDate);
if (difference.inDays > 0) {
return '${difference.inDays} jours';
} else if (difference.inHours > 0) {
return '${difference.inHours} heures';
} else if (difference.inMinutes > 0) {
return '${difference.inMinutes} minutes';
} else {
return '${difference.inSeconds} secondes';
}
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final now = DateTime.now();
final difference = now.difference(comment.date);
return Container( return Container(
width: double.infinity, width: double.infinity,
@ -56,7 +66,7 @@ class CommentComponent extends StatelessWidget {
Padding( Padding(
padding: EdgeInsets.only(top: 6, left: 10), padding: EdgeInsets.only(top: 6, left: 10),
child: Text( child: Text(
"il y a ${difference.inHours > 0 ? difference.inHours : difference.inMinutes}${difference.inHours > 0 ? "h" : "m"}", "il y a ${calculateTimeDifference(comment.date)}",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
color: Colors.white.withOpacity(0.6), fontWeight: FontWeight.w400, fontSize: 10), color: Colors.white.withOpacity(0.6), fontWeight: FontWeight.w400, fontSize: 10),
), ),

@ -284,6 +284,7 @@ class _EditablePostComponentState extends State<EditablePostComponent> with Tick
child: SizedBox( child: SizedBox(
width: double.infinity, width: double.infinity,
child: TextFormField( child: TextFormField(
keyboardType: TextInputType.text,
onChanged: (value) { onChanged: (value) {
_updateDescription(value); _updateDescription(value);
}, },

@ -29,22 +29,30 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
choice = !choice; choice = !choice;
}); });
} }
String formatPostDate(DateTime postDate) {
DateTime now = DateTime.now();
DateTime yesterday = DateTime(now.year, now.month, now.day - 1);
final List<String> frenchMonths = [ if (postDate.year == now.year && postDate.month == now.month && postDate.day == now.day) {
'Janvier', // Aujourd'hui
'Février', return "Aujourd'hui, ${postDate.hour}:${postDate.minute.toString().padLeft(2, '0')}";
'Mars', } else if (postDate.year == yesterday.year && postDate.month == yesterday.month && postDate.day == yesterday.day) {
'Avril', // Hier
'Mai', return 'hier, ${postDate.hour}:${postDate.minute.toString().padLeft(2, '0')}';
'Juin', } else {
'Juillet', // Autre date
'Août', return '${postDate.day} ${_getMonthAbbreviation(postDate.month)} ${postDate.hour}:${postDate.minute.toString().padLeft(2, '0')}';
'Septembre', }
'Octobre', }
'Novembre',
'Décembre' String _getMonthAbbreviation(int month) {
const List<String> monthsAbbreviation = [
'janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.',
]; ];
return monthsAbbreviation[month - 1];
}
@override @override
void initState() { void initState() {
print("post: ${widget.post.date.toString()}"); print("post: ${widget.post.date.toString()}");
@ -101,18 +109,11 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
), ),
), ),
), ),
DateTime(today.year, today.month, today.day).isAtSameMomentAs( Text(
DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day)) formatPostDate(widget.post.date),
? Text(
"Aujourd'hui, ${widget.post.date.hour}:$mins",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13), color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
) )
: Text(
'${widget.post.date.day} ${frenchMonths[widget.post.date.month - 1]}, ${widget.post.date.hour}:$mins',
style: GoogleFonts.plusJakartaSans(
color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13),
),
], ],
), ),
SizedBox(height: 10), SizedBox(height: 10),

@ -5,6 +5,7 @@ import 'package:justmusic/screens/change_password_screen.dart';
import 'package:justmusic/screens/feed_screen.dart'; import 'package:justmusic/screens/feed_screen.dart';
import 'package:justmusic/screens/profile_screen.dart'; import 'package:justmusic/screens/profile_screen.dart';
import 'package:justmusic/screens/user_screen.dart'; import 'package:justmusic/screens/user_screen.dart';
import 'package:justmusic/screens/welcome_screen.dart';
import '../model/User.dart'; import '../model/User.dart';
@ -109,3 +110,15 @@ Route routeHistoric() {
}, },
); );
} }
Route routeWelcome() {
return PageRouteBuilder(
pageBuilder: (context, animation, secondaryAnimation) => const WellcomeScreen(),
transitionsBuilder: (context, animation, secondaryAnimation, child) {
return FadeTransition(
opacity: animation,
child: child,
);
},
);
}

@ -67,15 +67,45 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
} }
final ScrollController _scrollController = ScrollController(); final ScrollController _scrollController = ScrollController();
String formatPostDate(DateTime postDate) {
DateTime now = DateTime.now();
DateTime yesterday = DateTime(now.year, now.month, now.day - 1);
@override if (postDate.year == now.year && postDate.month == now.month && postDate.day == now.day) {
Widget build(BuildContext context) { // Aujourd'hui
var mins = "0"; return "Aujourd'hui, ${postDate.hour}:${postDate.minute.toString().padLeft(2, '0')}";
if (widget.post.date.minute < 10) { } else if (postDate.year == yesterday.year && postDate.month == yesterday.month && postDate.day == yesterday.day) {
mins = "0${widget.post.date.minute}"; // Hier
return 'hier, ${postDate.hour}:${postDate.minute.toString().padLeft(2, '0')}';
} else { } else {
mins = widget.post.date.minute.toString(); // Autre date
return '${postDate.day} ${_getMonthAbbreviation(postDate.month)} ${postDate.hour}:${postDate.minute.toString().padLeft(2, '0')}';
}
}
String _getMonthAbbreviation(int month) {
const List<String> monthsAbbreviation = [
'janv.', 'févr.', 'mars', 'avr.', 'mai', 'juin', 'juil.', 'août', 'sept.', 'oct.', 'nov.', 'déc.',
];
return monthsAbbreviation[month - 1];
}
// Exemple d'utilisation :
void main() {
DateTime postDate = DateTime(2023, 11, 17, 17, 55); // Remplacez par votre date
String formattedDate = formatPostDate(postDate);
print(formattedDate); // Affichera "17 nov. 17:55" ou "hier, 17:55" selon la date
} }
@override
Widget build(BuildContext context) {
_scrollController.addListener(() {
if (_scrollController.position.pixels < 0) _scrollController.jumpTo(0);
});
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context); FocusScopeNode currentFocus = FocusScope.of(context);
@ -86,6 +116,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
}, },
child: Container( child: Container(
height: 760.h, height: 760.h,
color: bgAppBar,
child: Column( child: Column(
children: [ children: [
Expanded( Expanded(
@ -184,25 +215,8 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
Padding( Padding(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: choice child: choice
? DateTime(today.year, today.month, today.day)
.isAtSameMomentAs(
DateTime(
widget.post.date.year,
widget.post.date.month,
widget.post.date.day,
),
)
? Text( ? Text(
"Aujourd'hui, ${widget.post.date.hour}:$mins", formatPostDate(widget.post.date),
style: GoogleFonts.plusJakartaSans(
height: 1,
color: Colors.white,
fontWeight: FontWeight.w900,
fontSize: 18,
),
)
: Text(
"hier, ${widget.post.date.hour}:$mins",
style: GoogleFonts.plusJakartaSans( style: GoogleFonts.plusJakartaSans(
height: 1, height: 1,
color: Colors.white, color: Colors.white,
@ -263,11 +277,12 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
), ),
), ),
), ),
widget.post.description != null widget.post.description != null ? Align(
? Align(
alignment: Alignment.bottomLeft, alignment: Alignment.bottomLeft,
child: Padding( child: Container(
padding: const EdgeInsets.fromLTRB(50, 35, 50, 35), padding: const EdgeInsets.fromLTRB(50, 35, 50, 35),
color: bgModal,
width: double.infinity,
child: Text( child: Text(
widget.post.description!, widget.post.description!,
textAlign: TextAlign.left, textAlign: TextAlign.left,
@ -281,7 +296,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
), ),
) )
: Container( : Container(
height: 30, height: 0,
), ),
Container( Container(
width: double.infinity, width: double.infinity,
@ -630,12 +645,12 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
_textController.clear(); _textController.clear();
}); });
}, },
icon: Icon( icon: const Icon(
Icons.send, Icons.send,
color: primaryColor, color: primaryColor,
size: 20, size: 20,
)), )),
focusedBorder: OutlineInputBorder( focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(width: 1, color: grayText), borderSide: BorderSide(width: 1, color: grayText),
borderRadius: BorderRadius.all(Radius.circular(100)), borderRadius: BorderRadius.all(Radius.circular(100)),
), ),
@ -643,7 +658,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
fillColor: bgModal, fillColor: bgModal,
filled: true, filled: true,
focusColor: Color.fromRGBO(255, 255, 255, 0.30), focusColor: Color.fromRGBO(255, 255, 255, 0.30),
enabledBorder: OutlineInputBorder( enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(width: 1, color: grayText), borderSide: BorderSide(width: 1, color: grayText),
borderRadius: BorderRadius.all(Radius.circular(100)), borderRadius: BorderRadius.all(Radius.circular(100)),
), ),

@ -19,9 +19,9 @@ class ProfileScreen extends StatefulWidget {
class _ProfileScreenState extends State<ProfileScreen> { class _ProfileScreenState extends State<ProfileScreen> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
Future<void> logout() async { void logout() {
await MyApp.userViewModel.logout(); MyApp.userViewModel.logout();
Navigator.pushNamed(context, '/welcome'); Navigator.of(context).push(routeWelcome());
} }
void _openHistoric() { void _openHistoric() {

@ -13,7 +13,7 @@ const bgTextField = Color(0xFF1C1B23);
const strokeTextField = Color(0xFF373546); const strokeTextField = Color(0xFF373546);
const unactiveFeed = Color(0xFF848484); const unactiveFeed = Color(0xFF848484);
const gradiantPost = Color(0xFF0D0D0D); const gradiantPost = Color(0xFF0D0D0D);
const bgModal = Color(0xFF1E1E1E); const bgModal = Color(0xFF222222);
const textFieldMessage = Color(0xFF232323); const textFieldMessage = Color(0xFF232323);
const bgComment = Color(0xFF222222); const bgComment = Color(0xFF222222);
const bgAppBar = Color(0xFF181818); const bgAppBar = Color(0xFF181818);

@ -161,6 +161,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.0" version: "1.3.0"
checked_yaml:
dependency: transitive
description:
name: checked_yaml
sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff
url: "https://pub.dev"
source: hosted
version: "2.0.3"
circular_reveal_animation: circular_reveal_animation:
dependency: "direct main" dependency: "direct main"
description: description:
@ -169,6 +177,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.1" version: "2.0.1"
cli_util:
dependency: transitive
description:
name: cli_util
sha256: b8db3080e59b2503ca9e7922c3df2072cf13992354d5e944074ffa836fba43b7
url: "https://pub.dev"
source: hosted
version: "0.4.0"
clock: clock:
dependency: transitive dependency: transitive
description: description:
@ -494,6 +510,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.0" version: "1.0.0"
flutter_launcher_icons:
dependency: "direct main"
description:
name: flutter_launcher_icons
sha256: "526faf84284b86a4cb36d20a5e45147747b7563d921373d4ee0559c54fcdbcea"
url: "https://pub.dev"
source: hosted
version: "0.13.1"
flutter_lints: flutter_lints:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -688,6 +712,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "4.0.2" version: "4.0.2"
image:
dependency: transitive
description:
name: image
sha256: a72242c9a0ffb65d03de1b7113bc4e189686fc07c7147b8b41811d0dd0e0d9bf
url: "https://pub.dev"
source: hosted
version: "4.0.17"
image_picker: image_picker:
dependency: "direct main" dependency: "direct main"
description: description:
@ -784,6 +816,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.6.7" version: "0.6.7"
json_annotation:
dependency: transitive
description:
name: json_annotation
sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467
url: "https://pub.dev"
source: hosted
version: "4.8.1"
lints: lints:
dependency: transitive dependency: transitive
description: description:
@ -1173,6 +1213,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "6.3.0" version: "6.3.0"
yaml:
dependency: transitive
description:
name: yaml
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
url: "https://pub.dev"
source: hosted
version: "3.1.2"
zoom_tap_animation: zoom_tap_animation:
dependency: "direct main" dependency: "direct main"
description: description:

@ -76,6 +76,7 @@ dependencies:
firebase_messaging: ^14.6.5 firebase_messaging: ^14.6.5
cached_network_image: ^3.2.3 cached_network_image: ^3.2.3
google_sign_in: ^6.1.4 google_sign_in: ^6.1.4
flutter_launcher_icons: ^0.13.1
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
@ -88,6 +89,14 @@ dev_dependencies:
# rules and activating additional ones. # rules and activating additional ones.
flutter_lints: ^2.0.0 flutter_lints: ^2.0.0
flutter_launcher_icons:
android: "launcher_icon"
ios: true
image_path: "assets/images/logo-JustMusic.png"
remove_alpha_ios: true
min_sdk_android: 21 # android min sdk min:16, default 21
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec # following page: https://dart.dev/tools/pub/pubspec

Loading…
Cancel
Save