mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 12:42:34 +00:00
* chore(packages): Added pedantic package to enforce linting and styling * feat(lunasea): Enforce effective dart styling * Comment and format colours class * Localize additional classes in Dashboard, cleanup additional code * chore(lunasea): Major refactor by running dartfmt on the entire codebase, added widget return for page routers * Additional work on conforming to effective dart style * fix(share_plus): Roll back share_plus package to 2.0.0 to support iOS 12 or lower * chore(lunasea): Fix remaining enabled analysis warnings
37 lines
1.6 KiB
Dart
37 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:lunasea/core.dart';
|
|
import 'package:lunasea/modules/tautulli.dart';
|
|
|
|
class TautulliStatisticsTimeRangeButton extends StatelessWidget {
|
|
@override
|
|
Widget build(BuildContext context) =>
|
|
Selector<TautulliState, TautulliStatisticsTimeRange>(
|
|
selector: (_, state) => state.statisticsTimeRange,
|
|
builder: (context, range, _) =>
|
|
LunaPopupMenuButton<TautulliStatisticsTimeRange>(
|
|
tooltip: 'Time Range',
|
|
icon: Icons.access_time,
|
|
onSelected: (value) {
|
|
context.read<TautulliState>().statisticsTimeRange = value;
|
|
context.read<TautulliState>().resetStatistics();
|
|
},
|
|
itemBuilder: (context) =>
|
|
List<PopupMenuEntry<TautulliStatisticsTimeRange>>.generate(
|
|
TautulliStatisticsTimeRange.values.length,
|
|
(index) => PopupMenuItem<TautulliStatisticsTimeRange>(
|
|
value: TautulliStatisticsTimeRange.values[index],
|
|
child: Text(
|
|
TautulliStatisticsTimeRange.values[index].name,
|
|
style: TextStyle(
|
|
fontSize: LunaUI.FONT_SIZE_SUBTITLE,
|
|
color: range ==
|
|
TautulliStatisticsTimeRange.values[index]
|
|
? LunaColours.accent
|
|
: Colors.white,
|
|
),
|
|
),
|
|
),
|
|
)),
|
|
);
|
|
}
|