fix: improve the UI for small devices

This commit is contained in:
Freek van de Ven 2025-05-07 11:21:09 +02:00
parent 9487cf2e57
commit 44e6901664
7 changed files with 67 additions and 51 deletions

View file

@ -1,3 +1,7 @@
## 1.2.0
* Improve the UI for smaller screens to prevent overflows
## 1.1.1 ## 1.1.1
* Removed custom definition of CustomSemantics to use the one from flutter_accessibility instead * Removed custom definition of CustomSemantics to use the one from flutter_accessibility instead

View file

@ -70,10 +70,12 @@ class AvailabilityClearSection extends StatelessWidget {
), ),
), ),
const SizedBox(width: 8), const SizedBox(width: 8),
Text( Expanded(
child: Text(
unavailableText, unavailableText,
style: textTheme.bodyMedium, style: textTheme.bodyMedium,
), ),
),
], ],
), ),
], ],

View file

@ -73,7 +73,14 @@ class CalendarView extends StatelessWidget {
(element) => element.templateDeviation, (element) => element.templateDeviation,
); );
var monthDateSelector = Row( var monthDateSelector = LayoutBuilder(
builder: (context, constraints) {
var monthWidth =
_calculateTextWidthOfLongestMonth(context, translations);
var sideSpace =
((constraints.maxWidth - monthWidth) / 2 - 44).clamp(0.0, 44.0);
return Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
CustomSemantics( CustomSemantics(
@ -82,15 +89,13 @@ class CalendarView extends StatelessWidget {
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
icon: const Icon(Icons.chevron_left), icon: const Icon(Icons.chevron_left),
onPressed: () { onPressed: () {
onMonthChanged( onMonthChanged(DateTime(month.year, month.month - 1));
DateTime(month.year, month.month - 1),
);
}, },
), ),
), ),
const SizedBox(width: 44), SizedBox(width: sideSpace),
SizedBox( SizedBox(
width: _calculateTextWidthOfLongestMonth(context, translations), width: monthWidth,
child: CustomSemantics( child: CustomSemantics(
identifier: identifiers.monthNameTextIdentifier, identifier: identifiers.monthNameTextIdentifier,
child: Text( child: Text(
@ -100,21 +105,21 @@ class CalendarView extends StatelessWidget {
), ),
), ),
), ),
const SizedBox(width: 44), SizedBox(width: sideSpace),
CustomSemantics( CustomSemantics(
identifier: identifiers.nextMonthButtonIdentifier, identifier: identifiers.nextMonthButtonIdentifier,
child: IconButton( child: IconButton(
padding: EdgeInsets.zero, padding: EdgeInsets.zero,
icon: const Icon(Icons.chevron_right), icon: const Icon(Icons.chevron_right),
onPressed: () { onPressed: () {
onMonthChanged( onMonthChanged(DateTime(month.year, month.month + 1));
DateTime(month.year, month.month + 1),
);
}, },
), ),
), ),
], ],
); );
},
);
var calendarGrid = CalendarGrid( var calendarGrid = CalendarGrid(
month: month, month: month,

View file

@ -167,9 +167,12 @@ class _CalendarDay extends StatelessWidget {
children: [ children: [
Center( Center(
child: Container( child: Container(
padding: const EdgeInsets.symmetric(horizontal: 4), padding: const EdgeInsets.symmetric(horizontal: 2),
decoration: decoration, decoration: decoration,
child: Text(day.date.day.toString(), style: textStyle), child: Text(
day.date.day.toString(),
style: textStyle,
),
), ),
), ),
if (day.templateDeviation) ...[ if (day.templateDeviation) ...[

View file

@ -76,10 +76,12 @@ class _TemplateLegendState extends State<TemplateLegend> {
const SizedBox(width: 12), const SizedBox(width: 12),
const Icon(Icons.add, size: 20), const Icon(Icons.add, size: 20),
const SizedBox(width: 6), const SizedBox(width: 6),
Text( Expanded(
child: Text(
translations.createTemplateButton, translations.createTemplateButton,
style: textTheme.bodyLarge, style: textTheme.bodyLarge,
), ),
),
], ],
), ),
), ),

View file

@ -1,6 +1,6 @@
name: flutter_availability name: flutter_availability
description: "Flutter availability userstory package" description: "Flutter availability userstory package"
version: 1.1.1 version: 1.2.0
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub
@ -14,7 +14,7 @@ dependencies:
flutter_hooks: ^0.20.5 flutter_hooks: ^0.20.5
flutter_availability_data_interface: flutter_availability_data_interface:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^1.1.1 version: ^1.2.0
flutter_accessibility: flutter_accessibility:
hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub hosted: https://forgejo.internal.iconica.nl/api/packages/internal/pub
version: ^0.0.3 version: ^0.0.3

View file

@ -1,6 +1,6 @@
name: flutter_availability_data_interface name: flutter_availability_data_interface
description: "The data interface for the flutter_availability component" description: "The data interface for the flutter_availability component"
version: 1.1.1 version: 1.2.0
publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub publish_to: https://forgejo.internal.iconica.nl/api/packages/internal/pub