feat: use platform checkbox

This commit is contained in:
Kingkor Roy Tirtho 2022-11-03 20:11:20 +06:00
parent fb9c0e44be
commit 2211505d71
4 changed files with 9 additions and 11 deletions

View File

@ -75,15 +75,15 @@ class PlaylistCreateDialog extends HookConsumerWidget {
maxLines: 5, maxLines: 5,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
CheckboxListTile( PlatformCheckbox(
value: public.value, value: public.value,
title: const PlatformText("Public"), label: const PlatformText("Public"),
onChanged: (val) => public.value = val ?? false, onChanged: (val) => public.value = val ?? false,
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
CheckboxListTile( PlatformCheckbox(
value: collaborative.value, value: collaborative.value,
title: const PlatformText("Collaborative"), label: const PlatformText("Collaborative"),
onChanged: (val) => collaborative.value = val ?? false, onChanged: (val) => collaborative.value = val ?? false,
), ),
], ],

View File

@ -137,10 +137,8 @@ class TrackTile extends HookConsumerWidget {
itemCount: snapshot.data!.length, itemCount: snapshot.data!.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final playlist = snapshot.data!.elementAt(index); final playlist = snapshot.data!.elementAt(index);
return CheckboxListTile( return PlatformCheckbox(
title: PlatformText(playlist.name!), label: PlatformText(playlist.name!),
controlAffinity:
ListTileControlAffinity.leading,
value: value:
playlistsCheck.value[playlist.id] ?? false, playlistsCheck.value[playlist.id] ?? false,
onChanged: (val) { onChanged: (val) {
@ -181,7 +179,7 @@ class TrackTile extends HookConsumerWidget {
child: Row( child: Row(
children: [ children: [
if (showCheck) if (showCheck)
Checkbox( PlatformCheckbox(
value: isChecked, value: isChecked,
onChanged: (s) => onCheckChange?.call(s), onChanged: (s) => onCheckChange?.call(s),
) )

View File

@ -68,7 +68,7 @@ class TracksTableView extends HookConsumerWidget {
if (heading != null) heading!, if (heading != null) heading!,
Row( Row(
children: [ children: [
Checkbox( PlatformCheckbox(
value: selected.value.length == sortedTracks.length, value: selected.value.length == sortedTracks.length,
onChanged: (checked) { onChanged: (checked) {
if (!showCheck.value) showCheck.value = true; if (!showCheck.value) showCheck.value = true;

View File

@ -199,7 +199,7 @@ class SpotubeState extends ConsumerState<Spotube> with WidgetsBindingObserver {
}; };
}, []); }, []);
platform = TargetPlatform.macOS; platform = TargetPlatform.android;
return PlatformApp.router( return PlatformApp.router(
routeInformationParser: router.routeInformationParser, routeInformationParser: router.routeInformationParser,