Merge pull request #520 from pangeachat/fix-analytics-overflow

Fix analytics overflow
pull/1384/head
ggurdin 1 year ago committed by GitHub
commit ea44994218
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -13,36 +13,40 @@ class AnalyticsViewButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PopupMenuButton<BarChartViewSelection>( return Flexible(
tooltip: L10n.of(context)!.changeAnalyticsView, child: PopupMenuButton<BarChartViewSelection>(
initialValue: value, tooltip: L10n.of(context)!.changeAnalyticsView,
onSelected: (BarChartViewSelection? view) { initialValue: value,
if (view == null) { onSelected: (BarChartViewSelection? view) {
debugPrint("when is view null?"); if (view == null) {
return; debugPrint("when is view null?");
} return;
onChange(view); }
}, onChange(view);
itemBuilder: (BuildContext context) => BarChartViewSelection.values },
.map<PopupMenuEntry<BarChartViewSelection>>( itemBuilder: (BuildContext context) => BarChartViewSelection.values
(BarChartViewSelection view) { .map<PopupMenuEntry<BarChartViewSelection>>(
return PopupMenuItem<BarChartViewSelection>( (BarChartViewSelection view) {
value: view, return PopupMenuItem<BarChartViewSelection>(
child: Text(view.string(context)), value: view,
); child: Text(
}).toList(), view.string(context),
child: TextButton.icon( ),
label: Text( );
value.string(context), }).toList(),
style: TextStyle( child: TextButton.icon(
label: Text(
value.string(context),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
icon: Icon(
value.icon,
color: Theme.of(context).colorScheme.onSurface, color: Theme.of(context).colorScheme.onSurface,
), ),
onPressed: null,
), ),
icon: Icon(
value.icon,
color: Theme.of(context).colorScheme.onSurface,
),
onPressed: null,
), ),
); );
} }

@ -14,35 +14,37 @@ class TimeSpanMenuButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return PopupMenuButton<TimeSpan>( return Flexible(
tooltip: L10n.of(context)!.changeDateRange, child: PopupMenuButton<TimeSpan>(
initialValue: value, tooltip: L10n.of(context)!.changeDateRange,
onSelected: (TimeSpan? timeSpan) { initialValue: value,
if (timeSpan == null) { onSelected: (TimeSpan? timeSpan) {
debugPrint("when is timeSpan null?"); if (timeSpan == null) {
return; debugPrint("when is timeSpan null?");
} return;
onChange(timeSpan); }
}, onChange(timeSpan);
itemBuilder: (BuildContext context) => },
TimeSpan.values.map<PopupMenuEntry<TimeSpan>>((TimeSpan timeSpan) { itemBuilder: (BuildContext context) =>
return PopupMenuItem<TimeSpan>( TimeSpan.values.map<PopupMenuEntry<TimeSpan>>((TimeSpan timeSpan) {
value: timeSpan, return PopupMenuItem<TimeSpan>(
child: Text(timeSpan.string(context)), value: timeSpan,
); child: Text(timeSpan.string(context)),
}).toList(), );
child: TextButton.icon( }).toList(),
label: Text( child: TextButton.icon(
value.string(context), label: Text(
style: TextStyle( value.string(context),
style: TextStyle(
color: Theme.of(context).colorScheme.onSurface,
),
),
icon: Icon(
Icons.calendar_month_outlined,
color: Theme.of(context).colorScheme.onSurface, color: Theme.of(context).colorScheme.onSurface,
), ),
onPressed: null,
), ),
icon: Icon(
Icons.calendar_month_outlined,
color: Theme.of(context).colorScheme.onSurface,
),
onPressed: null,
), ),
); );
} }

Loading…
Cancel
Save