From d714e18cbbb81bba386450bb54b759abd7636ff4 Mon Sep 17 00:00:00 2001 From: Lucas Delanier Date: Fri, 18 Aug 2023 16:32:02 +0200 Subject: [PATCH] fix probleme with date displaying "hier" when display date --- .idea/libraries/Dart_Packages.xml | 91 +++++++++++++++++++ .../lib/components/post_component.dart | 18 +++- Sources/justMUSIC/lib/main.dart | 5 +- 3 files changed, 112 insertions(+), 2 deletions(-) diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml index 928a92f..b34dbd8 100644 --- a/.idea/libraries/Dart_Packages.xml +++ b/.idea/libraries/Dart_Packages.xml @@ -401,6 +401,20 @@ + + + + + + + + + + + + @@ -639,6 +653,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -814,6 +870,13 @@ + + + + + + @@ -933,6 +996,20 @@ + + + + + + + + + + + + @@ -989,6 +1066,20 @@ + + + + + + + + + + + + diff --git a/Sources/justMUSIC/lib/components/post_component.dart b/Sources/justMUSIC/lib/components/post_component.dart index e53d326..8c1c979 100644 --- a/Sources/justMUSIC/lib/components/post_component.dart +++ b/Sources/justMUSIC/lib/components/post_component.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:gradient_borders/box_borders/gradient_box_border.dart'; +import 'package:intl/intl.dart'; import 'package:justmusic/components/profil_picture_component.dart'; import 'package:text_scroll/text_scroll.dart'; import 'package:zoom_tap_animation/zoom_tap_animation.dart'; @@ -30,6 +31,21 @@ class _PostComponentState extends State with TickerProviderStateM }); } + final List frenchMonths = [ + 'Janvier', + 'Février', + 'Mars', + 'Avril', + 'Mai', + 'Juin', + 'Juillet', + 'Août', + 'Septembre', + 'Octobre', + 'Novembre', + 'Décembre' + ]; + @override void initState() { print("post: ${widget.post.date.toString()}"); @@ -87,7 +103,7 @@ class _PostComponentState extends State with TickerProviderStateM color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13), ) : Text( - "hier, ${widget.post.date.hour}:${widget.post.date.minute}", + '${widget.post.date.day} ${frenchMonths[widget.post.date.month - 1]}, ${widget.post.date.hour}:${widget.post.date.minute}', style: GoogleFonts.plusJakartaSans( color: Colors.white.withOpacity(0.4), fontWeight: FontWeight.w300, fontSize: 13), ), diff --git a/Sources/justMUSIC/lib/main.dart b/Sources/justMUSIC/lib/main.dart index 383e0f6..1cf347a 100644 --- a/Sources/justMUSIC/lib/main.dart +++ b/Sources/justMUSIC/lib/main.dart @@ -8,6 +8,7 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:intl/date_symbol_data_file.dart'; import 'package:justmusic/screens/add_friend_screen.dart'; import 'package:justmusic/screens/explanations_screen.dart'; import 'package:justmusic/screens/feed_screen.dart'; @@ -30,7 +31,8 @@ import 'package:timezone/data/latest.dart' as tz; Future main() async { tz.initializeTimeZones(); Paint.enableDithering = true; - WidgetsFlutterBinding.ensureInitialized(); + WidgetsFlutterBinding.ensureInitialized(); // Initialize for French locale + await Firebase.initializeApp( options: DefaultFirebaseOptions.currentPlatform, ); @@ -88,6 +90,7 @@ class _MyAppState extends State { Widget build(BuildContext context) { SystemChrome.setEnabledSystemUIMode(SystemUiMode.immersiveSticky); Paint.enableDithering = true; + return ScreenUtilInit( useInheritedMediaQuery: true, builder: (context, child) {