From 08856fe818cb7d7d88873808028f243794286fab Mon Sep 17 00:00:00 2001 From: ludelanier Date: Sat, 25 Nov 2023 21:07:18 +0100 Subject: [PATCH] historic page and profil page responsive --- .../lib/components/historic_component.dart | 99 ++++++++++--------- .../lib/screens/capsule_historic_screen.dart | 4 +- .../justMUSIC/lib/screens/user_screen.dart | 11 ++- 3 files changed, 61 insertions(+), 53 deletions(-) diff --git a/Sources/justMUSIC/lib/components/historic_component.dart b/Sources/justMUSIC/lib/components/historic_component.dart index 52a8fd6..07f7bc3 100644 --- a/Sources/justMUSIC/lib/components/historic_component.dart +++ b/Sources/justMUSIC/lib/components/historic_component.dart @@ -34,59 +34,62 @@ class _HistoricComponentState extends State { .getHistoryCapsulesMonthWhitIdUser(MyApp.userViewModel.userCurrent.id, widget.month, widget.year), builder: (context, snapshot) { if (snapshot.hasData) { - return Wrap( - spacing: 14, - runSpacing: 14, - children: List.generate(getNumberOfDaysInMonth(widget.year, widget.month), (index) { - Tuple2? checkCapsule; - if (snapshot.data != null) { - for (var element in snapshot.data!) { - if (element.item1 == index + 1) { - checkCapsule = element; + return Container( + constraints: const BoxConstraints( maxWidth: 420), + child: Wrap( + spacing: 14, + runSpacing: 14, + children: List.generate(getNumberOfDaysInMonth(widget.year, widget.month), (index) { + Tuple2? checkCapsule; + if (snapshot.data != null) { + for (var element in snapshot.data!) { + if (element.item1 == index + 1) { + checkCapsule = element; + } } } - } - if ((widget.year > DateTime.now().year || widget.month > DateTime.now().month) || - (widget.year == DateTime.now().year && - widget.month == DateTime.now().month && - index > DateTime.now().day)) { - return Container( - decoration: BoxDecoration( - gradient: LinearGradient(colors: [ - Color(0xFF1E1E1E).withOpacity(0.7), - Color(0xFF1E1E1E).withOpacity(0), - ], begin: Alignment.topCenter, end: Alignment.bottomCenter), - borderRadius: BorderRadius.circular(5)), - height: 60, - width: 60, - ); - } - if (checkCapsule != null) { - return Container( - decoration: BoxDecoration( - image: DecorationImage(image: NetworkImage((checkCapsule.item2.cover)!)), - borderRadius: BorderRadius.circular(5)), - height: 60, - width: 60, - ); - } else { - return Container( - color: bgColor, - height: 60, - width: 60, - child: Center( - child: Text( - (index + 1).toString(), - style: - GoogleFonts.plusJakartaSans(color: Colors.white, fontSize: 22, fontWeight: FontWeight.w800), + if ((widget.year > DateTime.now().year || widget.month > DateTime.now().month) || + (widget.year == DateTime.now().year && + widget.month == DateTime.now().month && + index > DateTime.now().day)) { + return Container( + decoration: BoxDecoration( + gradient: LinearGradient(colors: [ + Color(0xFF1E1E1E).withOpacity(0.7), + Color(0xFF1E1E1E).withOpacity(0), + ], begin: Alignment.topCenter, end: Alignment.bottomCenter), + borderRadius: BorderRadius.circular(5)), + height: 60, + width: 60, + ); + } + if (checkCapsule != null) { + return Container( + decoration: BoxDecoration( + image: DecorationImage(image: NetworkImage((checkCapsule.item2.cover)!)), + borderRadius: BorderRadius.circular(5)), + height: 60, + width: 60, + ); + } else { + return Container( + color: bgColor, + height: 60, + width: 60, + child: Center( + child: Text( + (index + 1).toString(), + style: + GoogleFonts.plusJakartaSans(color: Colors.white, fontSize: 22, fontWeight: FontWeight.w800), + ), ), - ), - ); - } + ); + } - // Generate widgets - }), + // Generate widgets + }), + ), ); } else { return CupertinoActivityIndicator(); diff --git a/Sources/justMUSIC/lib/screens/capsule_historic_screen.dart b/Sources/justMUSIC/lib/screens/capsule_historic_screen.dart index 6187694..a29a04d 100644 --- a/Sources/justMUSIC/lib/screens/capsule_historic_screen.dart +++ b/Sources/justMUSIC/lib/screens/capsule_historic_screen.dart @@ -77,8 +77,9 @@ class _CapsuleHistoricScreenState extends State { mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( + Container( padding: const EdgeInsets.only(top: 80, left: 60, right: 60), + constraints: const BoxConstraints( maxWidth: 450), child: Align( alignment: Alignment.center, child: Row( @@ -131,7 +132,6 @@ class _CapsuleHistoricScreenState extends State { width: double.infinity, child: Container( padding: EdgeInsets.symmetric(horizontal: 15), - constraints: BoxConstraints(maxWidth: 600), child: Column( children: [ HistoricComponent( diff --git a/Sources/justMUSIC/lib/screens/user_screen.dart b/Sources/justMUSIC/lib/screens/user_screen.dart index 187584a..9d5efb2 100644 --- a/Sources/justMUSIC/lib/screens/user_screen.dart +++ b/Sources/justMUSIC/lib/screens/user_screen.dart @@ -143,10 +143,11 @@ class _UserScreenState extends State { padding: const EdgeInsets.symmetric(horizontal: settingPadding), child: Column( mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - Padding( + Container( padding: EdgeInsets.only(top: 68.h, bottom: 40), + constraints: const BoxConstraints( maxWidth: 500), child: Stack( alignment: Alignment.center, children: [ @@ -249,7 +250,11 @@ class _UserScreenState extends State { SizedBox( height: 40, ), - RecapComponent(user: widget.user) + Container( + constraints: const BoxConstraints( maxWidth: 500), + child: RecapComponent(user: widget.user), + ) + ], ), ),