try fix layout

This commit is contained in:
Thomas Fransolet 2024-02-28 15:11:57 +01:00
parent 9eaad8b0cf
commit 8d5a0ad1f6
5 changed files with 127 additions and 25 deletions

View File

@ -4,51 +4,121 @@ List<Translation> translations = [
Translation(language: "FR", data: {
"weather.hourly": "Prochaines heures",
"weather.nextdays": "Prochains jours",
"agenda.all": "Tout"
"agenda.all": "Tout",
"monday": "Lundi",
"tuesday": "Mardi",
"wednesday": "Mercredi",
"thursday": "Jeudi",
"friday": "Vendredi",
"saturday": "Samedi",
"sunday": "Dimanche",
}),
Translation(language: "EN", data: {
"weather.hourly": "Hourly",
"weather.nextdays": "Next days",
"agenda.all": "All"
"agenda.all": "All",
"monday": "Monday",
"tuesday": "Tuesday",
"wednesday": "Wednesday",
"thursday": "Thursday",
"friday": "Friday",
"saturday": "Saturday",
"sunday": "Sunday"
}),
Translation(language: "DE", data: {
"weather.hourly": "Nächste Stunden",
"weather.nextdays": "Nächsten Tage",
"agenda.all": "Alle"
"agenda.all": "Alle",
"monday": "Montag",
"tuesday": "Dienstag",
"wednesday": "Mittwoch",
"thursday": "Donnerstag",
"friday": "Freitag",
"saturday": "Samstag",
"sunday": "Sonntag"
}),
Translation(language: "NL", data: {
"weather.hourly": "Volgende uren",
"weather.nextdays": "Volgende dagen",
"agenda.all": "Alle"
"agenda.all": "Alle",
"monday": "Maandag",
"tuesday": "Dinsdag",
"wednesday": "Woensdag",
"thursday": "Donderdag",
"friday": "Vrijdag",
"saturday": "Zaterdag",
"sunday": "Zondag"
}),
Translation(language: "IT", data: {
"weather.hourly": "Le prossime ore",
"weather.nextdays": "Prossimi giorni",
"agenda.all": "Tutto"
"agenda.all": "Tutto",
"monday": "Lunedì",
"tuesday": "Martedì",
"wednesday": "Mercoledì",
"thursday": "Giovedì",
"friday": "Venerdì",
"saturday": "Sabato",
"sunday": "Domenica"
}),
Translation(language: "ES", data: {
"weather.hourly": "Próximas horas",
"weather.nextdays": "Proximos dias",
"agenda.all": "Todo"
"agenda.all": "Todo",
"monday": "Lunes",
"tuesday": "Martes",
"wednesday": "Miércoles",
"thursday": "Jueves",
"friday": "Viernes",
"saturday": "Sábado",
"sunday": "Domingo"
}),
Translation(language: "PL", data: {
"weather.hourly": "Następne godziny",
"weather.nextdays": "Następne dni",
"agenda.all": "Wszystko"
"agenda.all": "Wszystko",
"monday": "Poniedziałek",
"tuesday": "Wtorek",
"wednesday": "Środa",
"thursday": "Czwartek",
"friday": "Piątek",
"saturday": "Sobota",
"sunday": "Niedziela"
}),
Translation(language: "CN", data: {
"weather.hourly": "接下来的几个小时",
"weather.nextdays": "未来几天",
"agenda.all": "全部"
"agenda.all": "全部",
"monday": "星期一",
"tuesday": "星期二",
"wednesday": "星期三",
"thursday": "星期四",
"friday": "星期五",
"saturday": "星期六",
"sunday": "星期日"
}),
Translation(language: "UK", data: {
"weather.hourly": "Наступні години",
"weather.nextdays": "Наступні дні",
"agenda.all": "все"
"agenda.all": "все",
"monday": "Понеділок",
"tuesday": "Вівторок",
"wednesday": "Середа",
"thursday": "Четвер",
"friday": "П'ятниця",
"saturday": "Субота",
"sunday": "Неділя"
}),
Translation(language: "AR", data: {
"weather.hourly": "الساعات القادمة",
"weather.nextdays": "الايام القادمة",
"agenda.all": "الجميع"
"agenda.all": "الجميع",
"monday": "الإثنين",
"tuesday": "الثلاثاء",
"wednesday": "الأربعاء",
"thursday": "الخميس",
"friday": "الجمعة",
"saturday": "السبت",
"sunday": "الأحد"
}),
];

View File

@ -136,13 +136,11 @@ class EventListItem extends StatelessWidget {
children: <Widget>[
Align(
alignment: Alignment.center,
child: HtmlWidget(
child: AutoSizeText(
eventAgenda.name!,
customStylesBuilder: (element) {
return {'text-align': 'center'};
},
textStyle: TextStyle(fontSize: kDescriptionSize),
)
style: TextStyle(fontSize: kDescriptionSize),
maxFontSize: 15,
),
),
AutoSizeText(
eventAgenda.type!,

View File

@ -220,7 +220,7 @@ class _EventPopupState extends State<EventPopup> {
),
),
SizedBox(
width: size.width * 0.28,
width: size.width * 0.3,
height: size.height * 0.65,
child: Padding(
padding: const EdgeInsets.all(8.0),
@ -230,7 +230,7 @@ class _EventPopupState extends State<EventPopup> {
children: [
widget.eventAgenda.address!.lat != null && widget.eventAgenda.address!.lng != null ?
SizedBox(
width: size.width * 0.28,
width: size.width * 0.25,
height: size.height * 0.2,
child: GoogleMap(
mapToolbarEnabled: false,
@ -304,7 +304,6 @@ class _EventPopupState extends State<EventPopup> {
)
],
),
],
),
],

View File

@ -52,7 +52,7 @@ class _MonthFilterState extends State<MonthFilter> {
title: Text(
'$monthName $annee (${nbrEvents})',
style: TextStyle(
fontSize: 16.0,
fontSize: 14.0,
fontWeight: _selectedMonth == monthYear ? FontWeight.bold : FontWeight.normal,
color: _selectedMonth == monthYear ? kTestSecondColor : null,
),
@ -88,7 +88,7 @@ class _MonthFilterState extends State<MonthFilter> {
title: Text(
'${TranslationHelper.getFromLocale("agenda.all", appContext.getContext())} ($totalEvents)',
style: TextStyle(
fontSize: 16.0,
fontSize: 14.0,
fontWeight: _selectedMonth == null ? FontWeight.bold : FontWeight.normal,
color: _selectedMonth == null ? kTestSecondColor : null,
),

View File

@ -38,6 +38,41 @@ class WeatherView extends StatelessWidget {
return formattedDate;
}
String getTranslatedDayOfWeek(int timestamp, AppContext appContext, bool isDate) {
DateTime dateTime = DateTime.fromMillisecondsSinceEpoch(timestamp * 1000);
String dayToPrint = "";
print("dateTime.weekday");
print(dateTime.weekday);
switch(dateTime.weekday) {
case 1:
dayToPrint = TranslationHelper.getFromLocale("monday", appContext.getContext());
break;
case 2:
dayToPrint = TranslationHelper.getFromLocale("tuesday", appContext.getContext());
break;
case 3:
dayToPrint = TranslationHelper.getFromLocale("wednesday", appContext.getContext());
break;
case 4:
dayToPrint = TranslationHelper.getFromLocale("thursday", appContext.getContext());
break;
case 5:
dayToPrint = TranslationHelper.getFromLocale("friday", appContext.getContext());
break;
case 6:
dayToPrint = TranslationHelper.getFromLocale("saturday", appContext.getContext());
break;
case 7:
dayToPrint = TranslationHelper.getFromLocale("sunday", appContext.getContext());
break;
}
return isDate ? "${dayToPrint} ${formatTimestamp(timestamp, appContext, false, true)}" : dayToPrint;
}
List<WeatherForecast> getNextFiveDaysForecast(List<WeatherForecast> allForecasts) {
List<WeatherForecast> nextFiveDaysForecast = [];
DateTime today = DateTime.now();
@ -129,7 +164,7 @@ class WeatherView extends StatelessWidget {
)
),
height: size.height * 0.9,
width: size.width * 0.7,
width: size.width * 0.8,
child: Stack(
children: [
Positioned(
@ -226,8 +261,8 @@ class WeatherView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: List.generate(
nbrNextHours,
(index) {
final weatherForecast = weatherData.list![index];
(index) {
final weatherForecast = weatherData.list!.sublist(1)[index];
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
@ -308,7 +343,7 @@ class WeatherView extends StatelessWidget {
children: [
Center(child: CachedNetworkImage(imageUrl: "https://openweathermap.org/img/wn/${weatherForecastNextDay.weather!.first.icon!}@2x.png")),
Text('${weatherForecastNextDay.main!.temp!.round().toString()}°', style: TextStyle(fontSize: 25.0, fontWeight: FontWeight.w600, color: Colors.white)),
Text('${formatTimestamp(weatherForecastNextDay.dt!, appContext, false, true)}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w400, color: Colors.white)),
Text('${getTranslatedDayOfWeek(weatherForecastNextDay.dt!, appContext, true)}', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.w400, color: Colors.white)),
],
),
),