mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix: track_table_view table headers
This commit is contained in:
parent
c8b7de0879
commit
d88d287fc5
@ -121,7 +121,8 @@ class TrackTile extends HookConsumerWidget {
|
||||
Positioned.fill(
|
||||
child: Center(
|
||||
child: IconTheme(
|
||||
data: theme.iconTheme.copyWith(size: 26),
|
||||
data: theme.iconTheme
|
||||
.copyWith(size: 26, color: Colors.white),
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
child: !isHovering
|
||||
|
@ -49,8 +49,6 @@ class TracksTableView extends HookConsumerWidget {
|
||||
TextStyle tableHeadStyle =
|
||||
const TextStyle(fontWeight: FontWeight.bold, fontSize: 16);
|
||||
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
|
||||
final selected = useState<List<String>>([]);
|
||||
final showCheck = useState<bool>(false);
|
||||
final sortBy = ref.watch(trackCollectionSortState(playlistId ?? ''));
|
||||
@ -73,29 +71,40 @@ class TracksTableView extends HookConsumerWidget {
|
||||
? [const NotFound(vertical: true)]
|
||||
: [
|
||||
if (heading != null) heading!,
|
||||
Row(
|
||||
LayoutBuilder(builder: (context, constrains) {
|
||||
return Row(
|
||||
children: [
|
||||
Checkbox.adaptive(
|
||||
AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
transitionBuilder: (child, animation) {
|
||||
return FadeTransition(
|
||||
opacity: animation,
|
||||
child: ScaleTransition(
|
||||
scale: animation,
|
||||
child: child,
|
||||
),
|
||||
);
|
||||
},
|
||||
child: showCheck.value
|
||||
? Checkbox.adaptive(
|
||||
value: selected.value.length == sortedTracks.length,
|
||||
onChanged: (checked) {
|
||||
if (!showCheck.value) showCheck.value = true;
|
||||
if (checked == true) {
|
||||
selected.value = sortedTracks.map((s) => s.id!).toList();
|
||||
selected.value =
|
||||
sortedTracks.map((s) => s.id!).toList();
|
||||
} else {
|
||||
selected.value = [];
|
||||
showCheck.value = false;
|
||||
}
|
||||
},
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
"#",
|
||||
textAlign: TextAlign.center,
|
||||
style: tableHeadStyle,
|
||||
),
|
||||
)
|
||||
: constrains.mdAndUp
|
||||
? const SizedBox(width: 32)
|
||||
: const SizedBox(width: 16),
|
||||
),
|
||||
Expanded(
|
||||
flex: 5,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
@ -107,9 +116,9 @@ class TracksTableView extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
// used alignment of this table-head
|
||||
if (mediaQuery.lgAndUp) ...[
|
||||
const SizedBox(width: 100),
|
||||
if (constrains.mdAndUp)
|
||||
Expanded(
|
||||
flex: 3,
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
@ -119,19 +128,13 @@ class TracksTableView extends HookConsumerWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
],
|
||||
if (!mediaQuery.isSm) ...[
|
||||
const SizedBox(width: 10),
|
||||
Text(context.l10n.time, style: tableHeadStyle),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
SortTracksDropdown(
|
||||
value: sortBy,
|
||||
onChanged: (value) {
|
||||
ref
|
||||
.read(
|
||||
trackCollectionSortState(playlistId ?? '').notifier)
|
||||
.read(trackCollectionSortState(playlistId ?? '')
|
||||
.notifier)
|
||||
.state = value;
|
||||
},
|
||||
),
|
||||
@ -210,7 +213,8 @@ class TracksTableView extends HookConsumerWidget {
|
||||
},
|
||||
);
|
||||
if (confirmed != true) return;
|
||||
await downloader.enqueueAll(selectedTracks.toList());
|
||||
await downloader
|
||||
.enqueueAll(selectedTracks.toList());
|
||||
if (context.mounted) {
|
||||
selected.value = [];
|
||||
showCheck.value = false;
|
||||
@ -250,7 +254,8 @@ class TracksTableView extends HookConsumerWidget {
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
...sortedTracks.mapIndexed((i, track) {
|
||||
return TrackTile(
|
||||
index: i,
|
||||
|
Loading…
Reference in New Issue
Block a user