fix date 2 digits
continuous-integration/drone/push Build is passing Details

pull/59/head
Lucas Delanier 2 years ago
parent e776abfeab
commit db48302aa0

@ -3,7 +3,6 @@ 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';
@ -55,6 +54,13 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
@override
Widget build(BuildContext context) {
var mins = "0";
if (widget.post.date.minute < 10) {
mins = "0${widget.post.date.minute}";
} else {
mins = widget.post.date.minute.toString();
}
return GestureDetector(
onTap: switchChoice,
child: SizedBox(
@ -98,12 +104,12 @@ class _PostComponentState extends State<PostComponent> with TickerProviderStateM
DateTime(today.year, today.month, today.day).isAtSameMomentAs(
DateTime(widget.post.date.year, widget.post.date.month, widget.post.date.day))
? Text(
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
"Aujourd'hui, ${widget.post.date.hour}:$mins",
style: GoogleFonts.plusJakartaSans(
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}:${widget.post.date.minute}',
'${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),
),

@ -8,7 +8,6 @@ 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';
@ -78,68 +77,50 @@ class _MyAppState extends State<MyApp> {
return ScreenUtilInit(
useInheritedMediaQuery: true,
builder: (context, child) {
return StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (ConnectionState.waiting == snapshot.connectionState) {
return const CupertinoActivityIndicator();
}
if (snapshot.hasData) {
return FutureBuilder<userJustMusic.User?>(
future: MyApp.userViewModel.getUser(snapshot.data!.uid),
builder: (context, userSnapshot) {
if (userSnapshot.connectionState == ConnectionState.waiting) {
return const CupertinoActivityIndicator();
} else {
if (userSnapshot.hasData) {
MyApp.userViewModel.userCurrent = userSnapshot.data!;
return MaterialApp(
routes: {
'/welcome': (context) => const WellcomeScreen(),
'/feed': (context) => const FeedScreen(),
'/login': (context) => const LoginScreen(),
'/register': (context) => const RegistrationScreen(),
'/post': (context) => const PostScreen(),
'/profile': (context) => const ProfileScreen(),
'/explanation': (context) => const ExplanationsScreen(),
'/addFriend': (context) => const AddFriendScreen(),
'/launchingRocket': (context) => const LaunchingRocketScreen(),
'/verifyEmail': (context) => const VerifyEmailScreen(),
'/forgetPassword': (context) => const ForgetPasswordScreen(),
},
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: FeedScreen());
} else {
return const Text('User data not found');
}
}
},
);
} else {
return MaterialApp(
routes: {
'/welcome': (context) => const WellcomeScreen(),
'/feed': (context) => const FeedScreen(),
'/login': (context) => const LoginScreen(),
'/register': (context) => const RegistrationScreen(),
'/post': (context) => const PostScreen(),
'/profile': (context) => const ProfileScreen(),
'/explanation': (context) => const ExplanationsScreen(),
'/addFriend': (context) => const AddFriendScreen(),
'/launchingRocket': (context) => const LaunchingRocketScreen(),
'/verifyEmail': (context) => const VerifyEmailScreen(),
'/forgetPassword': (context) => const ForgetPasswordScreen(),
},
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: WellcomeScreen());
}
});
return MaterialApp(
routes: {
'/welcome': (context) => const WellcomeScreen(),
'/feed': (context) => const FeedScreen(),
'/login': (context) => const LoginScreen(),
'/register': (context) => const RegistrationScreen(),
'/post': (context) => const PostScreen(),
'/profile': (context) => const ProfileScreen(),
'/explanation': (context) => const ExplanationsScreen(),
'/addFriend': (context) => const AddFriendScreen(),
'/launchingRocket': (context) => const LaunchingRocketScreen(),
'/verifyEmail': (context) => const VerifyEmailScreen(),
'/forgetPassword': (context) => const ForgetPasswordScreen(),
},
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: StreamBuilder(
stream: FirebaseAuth.instance.authStateChanges(),
builder: (context, snapshot) {
if (ConnectionState.waiting == snapshot.connectionState) {
return const CupertinoActivityIndicator();
}
if (snapshot.hasData) {
return FutureBuilder<userJustMusic.User?>(
future: MyApp.userViewModel.getUser(snapshot.data!.uid),
builder: (context, userSnapshot) {
if (userSnapshot.connectionState == ConnectionState.waiting) {
return const CupertinoActivityIndicator();
} else {
if (userSnapshot.hasData) {
MyApp.userViewModel.userCurrent = userSnapshot.data!;
return FeedScreen();
} else {
return const Text('User data not found');
}
}
},
);
} else {
return WellcomeScreen();
}
}));
},
designSize: Size(390, 844),
);

@ -70,6 +70,12 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
@override
Widget build(BuildContext context) {
var mins = "0";
if (widget.post.date.minute < 10) {
mins = "0${widget.post.date.minute}";
} else {
mins = widget.post.date.minute.toString();
}
return GestureDetector(
onTap: () {
FocusScopeNode currentFocus = FocusScope.of(context);
@ -187,7 +193,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
),
)
? Text(
"Aujourd'hui, ${widget.post.date.hour}:${widget.post.date.minute}",
"Aujourd'hui, ${widget.post.date.hour}:$mins",
style: GoogleFonts.plusJakartaSans(
height: 1,
color: Colors.white,
@ -196,7 +202,7 @@ class _DetailPostScreenState extends State<DetailPostScreen> {
),
)
: Text(
"hier, ${widget.post.date.hour}:${widget.post.date.minute}",
"hier, ${widget.post.date.hour}:$mins",
style: GoogleFonts.plusJakartaSans(
height: 1,
color: Colors.white,

Loading…
Cancel
Save